From 0df2169f8189b7c63a970311f1f43021529c0950 Mon Sep 17 00:00:00 2001 From: Iztok Jeras Date: Mon, 22 Jun 2026 01:12:09 +0200 Subject: [PATCH] dlatchlibmap: modified copies of dfflibmap* test files for dlatchlibmap tests --- tests/techmap/dlatchlibmap-sim.v | 28 +--- tests/techmap/dlatchlibmap.lib | 52 ++----- tests/techmap/dlatchlibmap.ys | 97 ++++++------ .../techmap/dlatchlibmap_dlatch_not_data.lib | 12 +- tests/techmap/dlatchlibmap_dlatchn.lib | 35 +---- .../dlatchlibmap_dlatchsr_mixedpol.lib | 17 +- .../dlatchlibmap_dlatchsr_not_data.lib | 12 +- .../dlatchlibmap_dlatchsr_not_data_l.lib | 15 +- tests/techmap/dlatchlibmap_dlatchsr_r.lib | 15 +- tests/techmap/dlatchlibmap_dlatchsr_s.lib | 15 +- tests/techmap/dlatchlibmap_dlatchsr_x.lib | 15 +- tests/techmap/dlatchlibmap_formal.ys | 146 ++++++++---------- tests/techmap/dlatchlibmap_proc_formal.ys | 52 ++----- 13 files changed, 207 insertions(+), 304 deletions(-) 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 <