Attention
This documentation is a work in progress. Expect to see errors and unfinished things.
async_to_sync_reset_shift Source File
1module async_to_sync_reset_shift(
2 input clk,
3 input Pinput,
4 output Poutput
5);
6parameter LENGTH =8;
7parameter INPUT_POLARITY = 1'b1;
8parameter OUTPUT_POLARITY= 1'b1;
9
10reg [LENGTH-1:0] shift=0;
11always @(Pinput or (clk)) begin
12 if ( Pinput == INPUT_POLARITY ) begin
13 shift <= {LENGTH{OUTPUT_POLARITY}};
14 end
15 else if (clk) begin
16 shift <= {shift[LENGTH-2:0], ~OUTPUT_POLARITY};
17 end
18end
19// Output the result on edge - helps to meet timing
20//always @(posedge clk) begin
21// Poutput <= shift[LENGTH-1];
22//end
23assign Poutput=shift[LENGTH-1];
24endmodule