File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 12
12
** EdgeDetect.v** - edge detector, gives one-tick pulses on every signal edge
13
13
** ResetSet.v** - SR trigger variant w/o metastable state, set dominates here
14
14
** SetReset.v** - SR trigger variant w/o metastable state, reset dominates here
15
- ** Synch.v** - input syncnronizer, standard way to get rid of metastability issues
15
+ ** Synch.v** - input syncnronizer (and also "static delay module"), standard way to get rid of metastability issues
16
+
17
+ ** DynDelay.v** - dynamic delay made on general-purpose trigger elements
18
+ ** PulseGen.v** - generates pulses with given width and delay
19
+ ** SimplePulseGen.v** - generates one-cycle pulse with given delay
16
20
17
21
Original file line number Diff line number Diff line change 8
8
// Ñòàíäàðòíûé ìåòîä ïîäàâëåíèÿ ìåòàñòàáèëüíîñòè.
9
9
10
10
// (* keep_hierarchy = "yes" *)
11
- module Synch (clk, in, out); // aka "static delay"
11
+ module Synch (clk, nrst, in, out); // aka "static delay"
12
12
13
13
input wire clk;
14
+ input wire nrst;
14
15
input wire [(WIDTH- 1 ):0 ] in;
15
16
output wire [(WIDTH- 1 ):0 ] out;
16
17
@@ -20,11 +21,16 @@ parameter WIDTH = 1; // independent channels
20
21
(* keep = "true" * ) reg [(LENGTH* WIDTH- 1 ):0 ] data = 0 ;
21
22
22
23
always @ (posedge clk) begin
23
- data[(LENGTH* WIDTH- 1 ):0 ] << WIDTH;
24
- data[(WIDTH- 1 ):0 ] <= in[(WIDTH- 1 ):0 ];
24
+ if (~ nrst) begin
25
+ data[(LENGTH* WIDTH- 1 ):0 ] <= 0 ;
26
+ end
27
+ else begin
28
+ data[(LENGTH* WIDTH- 1 ):0 ] <= data[(LENGTH* WIDTH- 1 ):0 ] << WIDTH;
29
+ data[(WIDTH- 1 ):0 ] <= in[(WIDTH- 1 ):0 ];
30
+ end
25
31
end
26
32
27
33
assign
28
- out[(WIDTH- 1 ):0 ] = data[(LENGTH* WIDTH- 1 ):((( LENGTH- 1 )* WIDTH)];
34
+ out[(WIDTH- 1 ):0 ] = data[(LENGTH* WIDTH- 1 ):((LENGTH- 1 )* WIDTH)];
29
35
30
36
endmodule
You can’t perform that action at this time.
0 commit comments