3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-19 10:52:03 +00:00

dfflibmap: test negated state next_state with mixed polarities

This commit is contained in:
Emil J. Tywoniak 2025-07-10 18:54:43 +02:00
parent 73cbcffbbb
commit 7fe817c52f
2 changed files with 51 additions and 0 deletions

View file

@ -81,3 +81,19 @@ clean
select -assert-count 0 t:dffn
select -assert-count 5 t:dffsr
select -assert-count 1 t:dffe
design -load orig
dfflibmap -liberty dfflibmap.lib -liberty dfflibmap_dffsr_mixedpol.lib -dont_use dffsr
clean
# We have one more _NOT_ than with the regular dffsr
select -assert-count 6 t:$_NOT_
select -assert-count 1 t:dffn
select -assert-count 4 t:dffsr_mixedpol
select -assert-count 1 t:dffe
# The additional NOT is on ff2.
# Originally, ff2.R is an active high "set".
# dffsr_mixedpol has functionally swapped labels due to the next_state inversion,
# so we use its CLEAR port for the "set",
# but we have to invert it because the CLEAR pin is active low.
# ff2.CLEAR = !R
select -assert-count 1 c:ff2 %x:+[CLEAR] %ci t:$_NOT_ %i

View file

@ -0,0 +1,35 @@
library(test) {
cell (dffsr_mixedpol) {
area : 6;
ff("IQ", "IQN") {
// look here
next_state : "!D";
clocked_on : "CLK";
// look here
clear : "!CLEAR";
preset : "PRESET";
clear_preset_var1 : L;
clear_preset_var2 : L;
}
pin(D) {
direction : input;
}
pin(CLK) {
direction : input;
}
pin(CLEAR) {
direction : input;
}
pin(PRESET) {
direction : input;
}
pin(Q) {
direction: output;
function : "IQ";
}
pin(QN) {
direction: output;
function : "IQN";
}
}
}