aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/celltypes.h
diff options
context:
space:
mode:
authorJannis Harder <me@jix.one>2022-11-02 17:12:51 +0100
committerJannis Harder <me@jix.one>2022-11-30 18:24:35 +0100
commit7203ba7bc1d83777bd2c2c347d45209d8e3d4b84 (patch)
treeda57415b2168bf02cb0efa485a91769850e66cf8 /kernel/celltypes.h
parentf2c531e65f4518abe58d04e53d0116583651ac50 (diff)
downloadyosys-7203ba7bc1d83777bd2c2c347d45209d8e3d4b84.tar.gz
yosys-7203ba7bc1d83777bd2c2c347d45209d8e3d4b84.tar.bz2
yosys-7203ba7bc1d83777bd2c2c347d45209d8e3d4b84.zip
Add bitwise `$bweqx` and `$bwmux` cells
The new bitwise case equality (`$bweqx`) and bitwise mux (`$bwmux`) cells enable compact encoding and decoding of 3-valued logic signals using multiple 2-valued signals.
Diffstat (limited to 'kernel/celltypes.h')
-rw-r--r--kernel/celltypes.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/celltypes.h b/kernel/celltypes.h
index e617b4603..63e7408c1 100644
--- a/kernel/celltypes.h
+++ b/kernel/celltypes.h
@@ -116,7 +116,8 @@ struct CellTypes
ID($shl), ID($shr), ID($sshl), ID($sshr), ID($shift), ID($shiftx),
ID($lt), ID($le), ID($eq), ID($ne), ID($eqx), ID($nex), ID($ge), ID($gt),
ID($add), ID($sub), ID($mul), ID($div), ID($mod), ID($divfloor), ID($modfloor), ID($pow),
- ID($logic_and), ID($logic_or), ID($concat), ID($macc)
+ ID($logic_and), ID($logic_or), ID($concat), ID($macc),
+ ID($bweqx)
};
for (auto type : unary_ops)
@@ -125,7 +126,7 @@ struct CellTypes
for (auto type : binary_ops)
setup_type(type, {ID::A, ID::B}, {ID::Y}, true);
- for (auto type : std::vector<RTLIL::IdString>({ID($mux), ID($pmux)}))
+ for (auto type : std::vector<RTLIL::IdString>({ID($mux), ID($pmux), ID($bwmux)}))
setup_type(type, {ID::A, ID::B, ID::S}, {ID::Y}, true);
for (auto type : std::vector<RTLIL::IdString>({ID($bmux), ID($demux)}))
@@ -430,6 +431,11 @@ struct CellTypes
return const_demux(arg1, arg2);
}
+ if (cell->type == ID($bweqx))
+ {
+ return const_bweqx(arg1, arg2);
+ }
+
if (cell->type == ID($lut))
{
int width = cell->parameters.at(ID::WIDTH).as_int();
@@ -490,6 +496,8 @@ struct CellTypes
{
if (cell->type.in(ID($mux), ID($_MUX_)))
return const_mux(arg1, arg2, arg3);
+ if (cell->type == ID($bwmux))
+ return const_bwmux(arg1, arg2, arg3);
if (cell->type == ID($pmux))
return const_pmux(arg1, arg2, arg3);
if (cell->type == ID($_AOI3_))