aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cellaigs.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2017-05-17 09:08:29 +0200
committerClifford Wolf <clifford@clifford.at>2017-05-17 09:08:29 +0200
commit05cdd58c8dc73968992681d0ee1cbfa89880b94f (patch)
tree426fabb50c83d45f1194bd94125d4701242e920f /kernel/cellaigs.cc
parent9f4fbc5e74747c8973da3a2fd42d2ef40dbe1fa5 (diff)
downloadyosys-05cdd58c8dc73968992681d0ee1cbfa89880b94f.tar.gz
yosys-05cdd58c8dc73968992681d0ee1cbfa89880b94f.tar.bz2
yosys-05cdd58c8dc73968992681d0ee1cbfa89880b94f.zip
Add $_ANDNOT_ and $_ORNOT_ gates
Diffstat (limited to 'kernel/cellaigs.cc')
-rw-r--r--kernel/cellaigs.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/kernel/cellaigs.cc b/kernel/cellaigs.cc
index 41f81355d..5fd76afe5 100644
--- a/kernel/cellaigs.cc
+++ b/kernel/cellaigs.cc
@@ -202,6 +202,16 @@ struct AigMaker
return or_gate(and_gate(A, B), nor_gate(A, B));
}
+ int andnot_gate(int A, int B)
+ {
+ return and_gate(A, not_gate(B));
+ }
+
+ int ornot_gate(int A, int B)
+ {
+ return or_gate(A, not_gate(B));
+ }
+
int mux_gate(int A, int B, int S)
{
return or_gate(and_gate(A, not_gate(S)), and_gate(B, S));
@@ -290,7 +300,7 @@ Aig::Aig(Cell *cell)
goto optimize;
}
- if (cell->type.in("$and", "$_AND_", "$_NAND_", "$or", "$_OR_", "$_NOR_", "$xor", "$xnor", "$_XOR_", "$_XNOR_"))
+ if (cell->type.in("$and", "$_AND_", "$_NAND_", "$or", "$_OR_", "$_NOR_", "$xor", "$xnor", "$_XOR_", "$_XNOR_", "$_ANDNOT_", "$_ORNOT_"))
{
for (int i = 0; i < GetSize(cell->getPort("\\Y")); i++) {
int A = mk.inport("\\A", i);
@@ -300,7 +310,9 @@ Aig::Aig(Cell *cell)
cell->type.in("$or", "$_OR_") ? mk.or_gate(A, B) :
cell->type.in("$_NOR_") ? mk.nor_gate(A, B) :
cell->type.in("$xor", "$_XOR_") ? mk.xor_gate(A, B) :
- cell->type.in("$xnor", "$_XNOR_") ? mk.xnor_gate(A, B) : -1;
+ cell->type.in("$xnor", "$_XNOR_") ? mk.xnor_gate(A, B) :
+ cell->type.in("$_ANDNOT_") ? mk.andnot_gate(A, B) :
+ cell->type.in("$_ORNOT_") ? mk.ornot_gate(A, B) : -1;
mk.outport(Y, "\\Y", i);
}
goto optimize;