Skip to content

Commit

Permalink
registers: Add FFARNC macro (#214)
Browse files Browse the repository at this point in the history
Co-authored-by: Yvan Tortorella <[email protected]>
  • Loading branch information
yvantor and Yvan Tortorella authored Mar 7, 2024
1 parent a88e217 commit 50ba9de
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/common_cells/registers.svh
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,29 @@
end \
end

// Flip-Flop with asynchronous active-low reset and synchronous clear
// __q: Q output of FF
// __d: D input of FF
// __clear: assign reset value into FF
// __reset_value: value assigned upon reset
// __clk: clock input
// __arst_n: asynchronous reset, active-low
`define FFARNC(__q, __d, __clear, __reset_value, __clk, __arst_n) \
`ifndef NO_SYNOPSYS_FF \
/``* synopsys sync_set_reset `"__clear`" *``/ \
`endif \
always_ff @(posedge (__clk) or negedge (__arst_n)) begin \
if (!__arst_n) begin \
__q <= (__reset_value); \
end else begin \
if (__clear) begin \
__q <= (__reset_value); \
end begin \
__q <= (__d); \
end \
end \
end

// Load-enable Flip-Flop without reset
// __q: Q output of FF
// __d: D input of FF
Expand Down

0 comments on commit 50ba9de

Please sign in to comment.