Skip to content

Commit 7fe817c

Browse files
committed
dfflibmap: test negated state next_state with mixed polarities
1 parent 73cbcff commit 7fe817c

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

tests/techmap/dfflibmap.ys

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,19 @@ clean
8181
select -assert-count 0 t:dffn
8282
select -assert-count 5 t:dffsr
8383
select -assert-count 1 t:dffe
84+
85+
design -load orig
86+
dfflibmap -liberty dfflibmap.lib -liberty dfflibmap_dffsr_mixedpol.lib -dont_use dffsr
87+
clean
88+
# We have one more _NOT_ than with the regular dffsr
89+
select -assert-count 6 t:$_NOT_
90+
select -assert-count 1 t:dffn
91+
select -assert-count 4 t:dffsr_mixedpol
92+
select -assert-count 1 t:dffe
93+
# The additional NOT is on ff2.
94+
# Originally, ff2.R is an active high "set".
95+
# dffsr_mixedpol has functionally swapped labels due to the next_state inversion,
96+
# so we use its CLEAR port for the "set",
97+
# but we have to invert it because the CLEAR pin is active low.
98+
# ff2.CLEAR = !R
99+
select -assert-count 1 c:ff2 %x:+[CLEAR] %ci t:$_NOT_ %i
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
library(test) {
2+
cell (dffsr_mixedpol) {
3+
area : 6;
4+
ff("IQ", "IQN") {
5+
// look here
6+
next_state : "!D";
7+
clocked_on : "CLK";
8+
// look here
9+
clear : "!CLEAR";
10+
preset : "PRESET";
11+
clear_preset_var1 : L;
12+
clear_preset_var2 : L;
13+
}
14+
pin(D) {
15+
direction : input;
16+
}
17+
pin(CLK) {
18+
direction : input;
19+
}
20+
pin(CLEAR) {
21+
direction : input;
22+
}
23+
pin(PRESET) {
24+
direction : input;
25+
}
26+
pin(Q) {
27+
direction: output;
28+
function : "IQ";
29+
}
30+
pin(QN) {
31+
direction: output;
32+
function : "IQN";
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)