diff options
author | Ruben Undheim <ruben.undheim@gmail.com> | 2016-11-06 11:28:06 +0100 |
---|---|---|
committer | Ruben Undheim <ruben.undheim@gmail.com> | 2016-11-06 11:28:06 +0100 |
commit | 11904476fc43de21892c0aaef94480d2a27d05af (patch) | |
tree | adb13b830212c269d58031f900d652f29013d2d7 /techlibs/common/adff2dff.v |
Import yosys_0.7.orig.tar.gz
[dgit import orig yosys_0.7.orig.tar.gz]
Diffstat (limited to 'techlibs/common/adff2dff.v')
-rw-r--r-- | techlibs/common/adff2dff.v | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/techlibs/common/adff2dff.v b/techlibs/common/adff2dff.v new file mode 100644 index 00000000..86744d41 --- /dev/null +++ b/techlibs/common/adff2dff.v @@ -0,0 +1,27 @@ +(* techmap_celltype = "$adff" *) +module adff2dff (CLK, ARST, D, Q); + parameter WIDTH = 1; + parameter CLK_POLARITY = 1; + parameter ARST_POLARITY = 1; + parameter ARST_VALUE = 0; + + input CLK, ARST; + input [WIDTH-1:0] D; + output reg [WIDTH-1:0] Q; + wire reg [WIDTH-1:0] NEXT_Q; + + wire [1023:0] _TECHMAP_DO_ = "proc;;"; + + always @* + if (ARST == ARST_POLARITY) + NEXT_Q <= ARST_VALUE; + else + NEXT_Q <= D; + + if (CLK_POLARITY) + always @(posedge CLK) + Q <= NEXT_Q; + else + always @(negedge CLK) + Q <= NEXT_Q; +endmodule |