File tree 1 file changed +52
-0
lines changed
1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ // ------------------------------------------------------------------------------
2
+ // delay.v
3
+ // Konstantin Pavlov, [email protected]
4
+ // ------------------------------------------------------------------------------
5
+
6
+ // INFO -------------------------------------------------------------------------
7
+ // Static Delay for arbitrary signal
8
+ // Another equivalent names for this module:
9
+ // conveyor.sv
10
+ // synchronizer.sv
11
+ //
12
+ // Tip for Xilinx-based implementations:
13
+ // Leave nrst=1'b1 on purpose of inferring Xilinx`s SRL16E/SRL32E primitives
14
+
15
+ /* --- INSTANTIATION TEMPLATE BEGIN ---
16
+
17
+ delay S1 (
18
+ .clk( clk ),
19
+ .nrst( 1'b1 ),
20
+ .ena( 1'b1 )
21
+ .in( ),
22
+ .out( )
23
+ );
24
+
25
+ --- INSTANTIATION TEMPLATE END ---*/
26
+
27
+
28
+ module delay # (
29
+ parameter N = 2 ; // delay/synchronizer chain length
30
+ // default length for synchronizer chain is 2
31
+ )(
32
+ input clk,
33
+ input nrst,
34
+ input ena,
35
+ input in,
36
+ output out,
37
+ );
38
+
39
+
40
+ (* ASYNC_REG = " TRUE" * ) logic [N : 0 ] data = 0 ;
41
+ always_ff @ (posedge clk) begin
42
+ if (~ nrst) begin
43
+ data[N : 0 ] <= 0 ;
44
+ end else if (ena) begin
45
+ data[N : 0 ] <= { data[N - 1 : 0 ],in} ;
46
+ end
47
+ end
48
+
49
+ assign
50
+ out = data[N ];
51
+
52
+ endmodule
You can’t perform that action at this time.
0 commit comments