Skip to content

Commit b8a1820

Browse files
authored
registers: Optionally disable synopsys macros (#118)
1 parent 6e07bd7 commit b8a1820

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

include/common_cells/registers.svh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
// `FFLSRN: load-enable and synchronous active-low reset
3232
// `FFLNR: load-enable without reset
3333

34+
`ifdef VERILATOR
35+
`define NO_SYNOPSYS_FF 1
36+
`endif
37+
3438
`define REG_DFLT_CLK clk_i
3539
`define REG_DFLT_RST rst_ni
3640

@@ -81,7 +85,7 @@
8185
// __clk: clock input
8286
// __reset_clk: reset input, active-high
8387
`define FFSR(__q, __d, __reset_value, __clk, __reset_clk) \
84-
`ifndef VERILATOR \
88+
`ifndef NO_SYNOPSYS_FF \
8589
/``* synopsys sync_set_reset `"__reset_clk`" *``/ \
8690
`endif \
8791
always_ff @(posedge (__clk)) begin \
@@ -95,7 +99,7 @@
9599
// __clk: clock input
96100
// __reset_n_clk: reset input, active-low
97101
`define FFSRN(__q, __d, __reset_value, __clk, __reset_n_clk) \
98-
`ifndef VERILATOR \
102+
`ifndef NO_SYNOPSYS_FF \
99103
/``* synopsys sync_set_reset `"__reset_n_clk`" *``/ \
100104
`endif \
101105
always_ff @(posedge (__clk)) begin \
@@ -162,9 +166,9 @@
162166
// __clk: clock input
163167
// __reset_clk: reset input, active-high
164168
`define FFLSR(__q, __d, __load, __reset_value, __clk, __reset_clk) \
165-
`ifndef VERILATOR \
169+
`ifndef NO_SYNOPSYS_FF \
166170
/``* synopsys sync_set_reset `"__reset_clk`" *``/ \
167-
`endif \
171+
`endif \
168172
always_ff @(posedge (__clk)) begin \
169173
__q <= (__reset_clk) ? (__reset_value) : ((__load) ? (__d) : (__q)); \
170174
end
@@ -177,9 +181,9 @@
177181
// __clk: clock input
178182
// __reset_n_clk: reset input, active-low
179183
`define FFLSRN(__q, __d, __load, __reset_value, __clk, __reset_n_clk) \
180-
`ifndef VERILATOR \
184+
`ifndef NO_SYNOPSYS_FF \
181185
/``* synopsys sync_set_reset `"__reset_n_clk`" *``/ \
182-
`endif \
186+
`endif \
183187
always_ff @(posedge (__clk)) begin \
184188
__q <= (!__reset_n_clk) ? (__reset_value) : ((__load) ? (__d) : (__q)); \
185189
end
@@ -193,9 +197,9 @@
193197
// __clk: clock input
194198
// __arst_n: asynchronous reset, active-low
195199
`define FFLARNC(__q, __d, __load, __clear, __reset_value, __clk, __arst_n) \
196-
`ifndef VERILATOR \
197-
/``* synopsys sync_set_reset `"__clear`" *``/ \
198-
`endif \
200+
`ifndef NO_SYNOPSYS_FF \
201+
/``* synopsys sync_set_reset `"__clear`" *``/ \
202+
`endif \
199203
always_ff @(posedge (__clk) or negedge (__arst_n)) begin \
200204
if (!__arst_n) begin \
201205
__q <= (__reset_value); \

0 commit comments

Comments
 (0)