From 681b678417dafeadc6dd4f8d191911712e61ee7b Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 9 Dec 2024 14:18:08 +0100 Subject: [PATCH] dfflibmap: cover enable inference with test --- tests/techmap/dfflibmap-sim.v | 9 +++++++++ tests/techmap/dfflibmap.lib | 32 ++++++++++++++++++++++++++++---- tests/techmap/dfflibmap.ys | 23 ++++++++++++++--------- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/tests/techmap/dfflibmap-sim.v b/tests/techmap/dfflibmap-sim.v index 1788a683bb5..42006a211af 100644 --- a/tests/techmap/dfflibmap-sim.v +++ b/tests/techmap/dfflibmap-sim.v @@ -20,3 +20,12 @@ always @(posedge CLK, posedge CLEAR, posedge PRESET) assign QN = ~Q; endmodule + +module dffe(input CLK, EN, D, output reg Q, output QN); + +always @(negedge CLK) + if (EN) Q <= D; + +assign QN = ~Q; + +endmodule diff --git a/tests/techmap/dfflibmap.lib b/tests/techmap/dfflibmap.lib index ce460877e61..d0cd472c3b0 100644 --- a/tests/techmap/dfflibmap.lib +++ b/tests/techmap/dfflibmap.lib @@ -5,7 +5,7 @@ library(test) { ff("IQ", "IQN") { next_state : "D"; clocked_on : "!CLK"; - } + } pin(D) { direction : input; } @@ -19,7 +19,7 @@ library(test) { pin(QN) { direction: output; function : "IQN"; - } + } } cell (dffsr) { area : 6; @@ -30,7 +30,7 @@ library(test) { preset : "PRESET"; clear_preset_var1 : L; clear_preset_var2 : L; - } + } pin(D) { direction : input; } @@ -50,6 +50,30 @@ library(test) { pin(QN) { direction: output; 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/dfflibmap.ys b/tests/techmap/dfflibmap.ys index e8b12545670..13fb82b475d 100644 --- a/tests/techmap/dfflibmap.ys +++ b/tests/techmap/dfflibmap.ys @@ -1,14 +1,15 @@ read_verilog -icells <