diff --git a/tests/techmap/dlatchlibmap-sim.v b/tests/techmap/dlatchlibmap-sim.v index 42006a211..03a2e4817 100644 --- a/tests/techmap/dlatchlibmap-sim.v +++ b/tests/techmap/dlatchlibmap-sim.v @@ -1,30 +1,18 @@ -module dffn(input CLK, D, output reg Q, output QN); +module dlatchn(input ENA, D, output reg Q, output QN); -always @(negedge CLK) - Q <= D; +always @* + if (~ENA) Q <= D; assign QN = ~Q; endmodule -module dffsr(input CLK, D, CLEAR, PRESET, output reg Q, output QN); +module dlatchsr(input ENA, D, CLEAR, PRESET, output reg Q, output QN); -always @(posedge CLK, posedge CLEAR, posedge PRESET) - if (CLEAR) - Q <= 0; - else if (PRESET) - Q <= 1; - else - Q <= D; - -assign QN = ~Q; - -endmodule - -module dffe(input CLK, EN, D, output reg Q, output QN); - -always @(negedge CLK) - if (EN) Q <= D; +always @* + if (CLEAR) Q <= 1'b0; + else if (PRESET) Q <= 1'b1; + else if (ENA) Q <= D; assign QN = ~Q; diff --git a/tests/techmap/dlatchlibmap.lib b/tests/techmap/dlatchlibmap.lib index 54a44a296..1e4f0bc99 100644 --- a/tests/techmap/dlatchlibmap.lib +++ b/tests/techmap/dlatchlibmap.lib @@ -1,16 +1,17 @@ library(test) { - /* D-type flip-flop with asynchronous reset and preset */ - cell (dffn) { + /* D-type latch with reset and preset */ + cell (dlatchn) { area : 6; - ff("IQ", "IQN") { - next_state : "D"; - clocked_on : "!CLK"; + latch("IQ", "IQN") { + data_in : "D"; + enable : "!ENA"; } pin(D) { direction : input; } - pin(CLK) { + pin(ENA) { direction : input; + clock : true; } pin(Q) { direction: output; @@ -21,21 +22,22 @@ library(test) { function : "IQN"; } } - cell (dffsr) { + cell (dlatchsr) { area : 6; - ff("IQ", "IQN") { - next_state : "D"; - clocked_on : "CLK"; - clear : "CLEAR"; - preset : "PRESET"; + latch("IQ", "IQN") { + data_in : "D"; + enable : "ENA"; + clear : "CLEAR"; + preset : "PRESET"; clear_preset_var1 : L; clear_preset_var2 : L; } pin(D) { direction : input; } - pin(CLK) { + pin(ENA) { direction : input; + clock : true; } pin(CLEAR) { direction : input; @@ -52,28 +54,4 @@ library(test) { function : "IQN"; } } - cell (dffe) { - area : 6; - ff("IQ", "IQN") { - next_state : "(D EN) | (IQ !EN)"; - clocked_on : "!CLK"; - } - pin(D) { - direction : input; - } - pin(EN) { - direction : input; - } - pin(CLK) { - direction : input; - } - pin(Q) { - direction: output; - function : "IQ"; - } - pin(QN) { - direction: output; - function : "IQN"; - } - } } diff --git a/tests/techmap/dlatchlibmap.ys b/tests/techmap/dlatchlibmap.ys index 87ecc8bc7..fa0ce65be 100644 --- a/tests/techmap/dlatchlibmap.ys +++ b/tests/techmap/dlatchlibmap.ys @@ -1,15 +1,14 @@ read_verilog -icells <