File tree 1 file changed +64
-0
lines changed
1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ // ------------------------------------------------------------------------------
2
+ // comb_repeater.sv
3
+ // Konstantin Pavlov, [email protected]
4
+ // ------------------------------------------------------------------------------
5
+
6
+ // INFO ------------------------------------------------------------------------
7
+ // Combinational signal repeater
8
+ //
9
+ // Every stage consists of two sequential inverters
10
+ // Configurable number of stages
11
+ //
12
+ // Adapted for AMD/Xilinx devices
13
+ //
14
+
15
+
16
+ /* --- INSTANTIATION TEMPLATE BEGIN ---
17
+
18
+ comb_repeater #(
19
+ .LENGTH( 2 ),
20
+ .WIDTH( 1 )
21
+ ) R1 (
22
+ .in( ),
23
+ .out( )
24
+ );
25
+
26
+ --- INSTANTIATION TEMPLATE END ---*/
27
+
28
+
29
+ module comb_repeater # ( parameter
30
+ LENGTH = 1 , // repeater chain length
31
+ WIDTH = 1 // repeater bus width
32
+ )(
33
+ input [WIDTH - 1 : 0 ] in,
34
+ output logic [WIDTH - 1 : 0 ] out
35
+ );
36
+
37
+
38
+ (* DONT_TOUCH = " TRUE" * ) logic [LENGTH - 1 : 0 ][WIDTH - 1 : 0 ] s1; // first inverter outputs
39
+ (* DONT_TOUCH = " TRUE" * ) logic [LENGTH - 1 : 0 ][WIDTH - 1 : 0 ] s2; // second inverter outputs
40
+
41
+ genvar i;
42
+ generate
43
+ for ( i= 0 ; i< LENGTH ; i= i+ 1 ) begin
44
+
45
+ always_comb begin
46
+
47
+ if ( i== (LENGTH - 1 ) ) begin
48
+ s1[i][WIDTH - 1 : 0 ] <= ~ in[WIDTH - 1 : 0 ];
49
+ end else begin
50
+ s1[i][WIDTH - 1 : 0 ] <= ~ s2[i+ 1 ][WIDTH - 1 : 0 ];
51
+ end
52
+
53
+ if ( i== 0 ) begin
54
+ out[WIDTH - 1 : 0 ] <= ~ s1[i][WIDTH - 1 : 0 ];
55
+ end else begin
56
+ s2[i][WIDTH - 1 : 0 ] <= ~ s1[i][WIDTH - 1 : 0 ];
57
+ end
58
+ end
59
+
60
+ end // for
61
+ endgenerate
62
+
63
+ endmodule
64
+
You can’t perform that action at this time.
0 commit comments