mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-18 21:25:47 +00:00
WIP
This commit is contained in:
parent
afdae7b87e
commit
c3ffbf6fae
229 changed files with 3902 additions and 3835 deletions
|
|
@ -45,10 +45,10 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
RTLIL::Cell *cell = module->addCell(design->twines.add(Twine{ID(UUT).str()}), cell_type);
|
||||
RTLIL::Wire *wire;
|
||||
|
||||
if (cell_type.in(ID($mux), ID($pmux)))
|
||||
if (cell_type.in(TW($mux), TW($pmux)))
|
||||
{
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
int swidth = cell_type == ID($mux) ? 1 : 1 + xorshift32(8);
|
||||
int swidth = cell_type == TW($mux) ? 1 : 1 + xorshift32(8);
|
||||
|
||||
wire = module->addWire(TW::A);
|
||||
wire->width = width;
|
||||
|
|
@ -71,7 +71,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type.in(ID($_MUX_), ID($_NMUX_)))
|
||||
if (cell_type.in(TW($_MUX_), TW($_NMUX_)))
|
||||
{
|
||||
wire = module->addWire(TW::A);
|
||||
wire->width = 1;
|
||||
|
|
@ -94,7 +94,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($bmux))
|
||||
if (cell_type == TW($bmux))
|
||||
{
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
int swidth = 1 + xorshift32(4 * bloat_factor);
|
||||
|
|
@ -115,7 +115,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($demux))
|
||||
if (cell_type == TW($demux))
|
||||
{
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
int swidth = 1 + xorshift32(6 * bloat_factor);
|
||||
|
|
@ -136,7 +136,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($fa))
|
||||
if (cell_type == TW($fa))
|
||||
{
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($lcu))
|
||||
if (cell_type == TW($lcu))
|
||||
{
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::CO, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($macc_v2))
|
||||
if (cell_type == TW($macc_v2))
|
||||
{
|
||||
Macc macc;
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
|
|
@ -234,7 +234,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($lut))
|
||||
if (cell_type == TW($lut))
|
||||
{
|
||||
int width = 1 + xorshift32(6 * bloat_factor);
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setParam(ID::LUT, config.as_const());
|
||||
}
|
||||
|
||||
if (cell_type == ID($sop))
|
||||
if (cell_type == TW($sop))
|
||||
{
|
||||
int width = 1 + xorshift32(8 * bloat_factor);
|
||||
int depth = 1 + xorshift32(8 * bloat_factor);
|
||||
|
|
@ -355,22 +355,22 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type.in(ID($shiftx))) {
|
||||
if (cell_type.in(TW($shiftx))) {
|
||||
cell->parameters[ID::A_SIGNED] = false;
|
||||
}
|
||||
|
||||
if (cell_type.in(ID($shl), ID($shr), ID($sshl), ID($sshr))) {
|
||||
if (cell_type.in(TW($shl), TW($shr), TW($sshl), TW($sshr))) {
|
||||
cell->parameters[ID::B_SIGNED] = false;
|
||||
}
|
||||
|
||||
if (muxdiv && cell_type.in(ID($div), ID($mod), ID($divfloor), ID($modfloor))) {
|
||||
if (muxdiv && cell_type.in(TW($div), TW($mod), TW($divfloor), TW($modfloor))) {
|
||||
auto b_not_zero = module->ReduceBool(NEW_TWINE, cell->getPort(TW::B));
|
||||
auto div_out = module->addWire(NEW_TWINE, GetSize(cell->getPort(TW::Y)));
|
||||
module->addMux(NEW_TWINE, RTLIL::SigSpec(0, GetSize(div_out)), div_out, b_not_zero, cell->getPort(TW::Y));
|
||||
cell->setPort(TW::Y, div_out);
|
||||
}
|
||||
|
||||
if (cell_type == ID($alu))
|
||||
if (cell_type == TW($alu))
|
||||
{
|
||||
wire = module->addWire(TW::CI);
|
||||
wire->port_input = true;
|
||||
|
|
@ -391,7 +391,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::CO, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($slice))
|
||||
if (cell_type == TW($slice))
|
||||
{
|
||||
int a_size = GetSize(cell->getPort(TW::A));
|
||||
int y_size = 1;
|
||||
|
|
@ -407,7 +407,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setParam(ID::OFFSET, 0);
|
||||
}
|
||||
|
||||
if (cell_type == ID($concat))
|
||||
if (cell_type == TW($concat))
|
||||
{
|
||||
wire = module->addWire(TW::Y);
|
||||
wire->width = GetSize(cell->getPort(TW::A)) + GetSize(cell->getPort(TW::B));
|
||||
|
|
@ -415,7 +415,7 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type == ID($buf))
|
||||
if (cell_type == TW($buf))
|
||||
{
|
||||
wire = module->addWire(TW::Y);
|
||||
wire->width = GetSize(cell->getPort(TW::A));
|
||||
|
|
@ -423,14 +423,14 @@ static RTLIL::Cell* create_gold_module(RTLIL::Design *design, RTLIL::IdString ce
|
|||
cell->setPort(TW::Y, wire);
|
||||
}
|
||||
|
||||
if (cell_type.in(ID($bwmux), ID($bweqx)))
|
||||
if (cell_type.in(TW($bwmux), TW($bweqx)))
|
||||
{
|
||||
int a_size = GetSize(cell->getPort(TW::A));
|
||||
wire = module->addWire(TW::B);
|
||||
wire->width = a_size;
|
||||
wire->port_input = true;
|
||||
cell->setPort(TW::B, wire);
|
||||
if (cell_type == ID($bwmux))
|
||||
if (cell_type == TW($bwmux))
|
||||
{
|
||||
wire = module->addWire(TW::S);
|
||||
wire->width = a_size;
|
||||
|
|
@ -984,101 +984,101 @@ struct TestCellPass : public Pass {
|
|||
std::map<IdString, std::string> cell_types;
|
||||
std::vector<IdString> selected_cell_types;
|
||||
|
||||
cell_types[ID($not)] = "ASY";
|
||||
cell_types[ID($pos)] = "ASY";
|
||||
cell_types[ID($neg)] = "ASY";
|
||||
cell_types[TW($not)] = "ASY";
|
||||
cell_types[TW($pos)] = "ASY";
|
||||
cell_types[TW($neg)] = "ASY";
|
||||
// $buf is unsupported with techmap -assert
|
||||
if (techmap_cmd.compare("techmap -assert") != 0)
|
||||
cell_types[ID($buf)] = "A";
|
||||
cell_types[TW($buf)] = "A";
|
||||
|
||||
cell_types[ID($and)] = "ABSY";
|
||||
cell_types[ID($or)] = "ABSY";
|
||||
cell_types[ID($xor)] = "ABSY";
|
||||
cell_types[ID($xnor)] = "ABSY";
|
||||
cell_types[TW($and)] = "ABSY";
|
||||
cell_types[TW($or)] = "ABSY";
|
||||
cell_types[TW($xor)] = "ABSY";
|
||||
cell_types[TW($xnor)] = "ABSY";
|
||||
|
||||
cell_types[ID($reduce_and)] = "ASY";
|
||||
cell_types[ID($reduce_or)] = "ASY";
|
||||
cell_types[ID($reduce_xor)] = "ASY";
|
||||
cell_types[ID($reduce_xnor)] = "ASY";
|
||||
cell_types[ID($reduce_bool)] = "ASY";
|
||||
cell_types[TW($reduce_and)] = "ASY";
|
||||
cell_types[TW($reduce_or)] = "ASY";
|
||||
cell_types[TW($reduce_xor)] = "ASY";
|
||||
cell_types[TW($reduce_xnor)] = "ASY";
|
||||
cell_types[TW($reduce_bool)] = "ASY";
|
||||
|
||||
cell_types[ID($shl)] = "ABshY";
|
||||
cell_types[ID($shr)] = "ABshY";
|
||||
cell_types[ID($sshl)] = "ABshY";
|
||||
cell_types[ID($sshr)] = "ABshY";
|
||||
cell_types[ID($shift)] = "ABshY";
|
||||
cell_types[ID($shiftx)] = "ABshY";
|
||||
cell_types[TW($shl)] = "ABshY";
|
||||
cell_types[TW($shr)] = "ABshY";
|
||||
cell_types[TW($sshl)] = "ABshY";
|
||||
cell_types[TW($sshr)] = "ABshY";
|
||||
cell_types[TW($shift)] = "ABshY";
|
||||
cell_types[TW($shiftx)] = "ABshY";
|
||||
|
||||
cell_types[ID($lt)] = "ABSY";
|
||||
cell_types[ID($le)] = "ABSY";
|
||||
cell_types[ID($eq)] = "ABSY";
|
||||
cell_types[ID($ne)] = "ABSY";
|
||||
cell_types[TW($lt)] = "ABSY";
|
||||
cell_types[TW($le)] = "ABSY";
|
||||
cell_types[TW($eq)] = "ABSY";
|
||||
cell_types[TW($ne)] = "ABSY";
|
||||
// $eqx, $nex, and $bweqx don't work in sat, and are unsupported with
|
||||
// 'techmap -assert'
|
||||
if (nosat && techmap_cmd.compare("techmap -assert") != 0)
|
||||
{
|
||||
cell_types[ID($eqx)] = "ABSY";
|
||||
cell_types[ID($nex)] = "ABSY";
|
||||
cell_types[ID($bweqx)] = "A";
|
||||
cell_types[TW($eqx)] = "ABSY";
|
||||
cell_types[TW($nex)] = "ABSY";
|
||||
cell_types[TW($bweqx)] = "A";
|
||||
}
|
||||
cell_types[ID($ge)] = "ABSY";
|
||||
cell_types[ID($gt)] = "ABSY";
|
||||
cell_types[TW($ge)] = "ABSY";
|
||||
cell_types[TW($gt)] = "ABSY";
|
||||
|
||||
cell_types[ID($add)] = "ABSY";
|
||||
cell_types[ID($sub)] = "ABSY";
|
||||
cell_types[ID($mul)] = "ABSY";
|
||||
cell_types[ID($div)] = "ABSY";
|
||||
cell_types[ID($mod)] = "ABSY";
|
||||
cell_types[ID($divfloor)] = "ABSY";
|
||||
cell_types[ID($modfloor)] = "ABSY";
|
||||
cell_types[TW($add)] = "ABSY";
|
||||
cell_types[TW($sub)] = "ABSY";
|
||||
cell_types[TW($mul)] = "ABSY";
|
||||
cell_types[TW($div)] = "ABSY";
|
||||
cell_types[TW($mod)] = "ABSY";
|
||||
cell_types[TW($divfloor)] = "ABSY";
|
||||
cell_types[TW($modfloor)] = "ABSY";
|
||||
// $pow doesnt work in sat, not supported with 'techmap -assert', and only
|
||||
// only partially supported with '-simlib'
|
||||
if (nosat && techmap_cmd.compare("aigmap") == 0)
|
||||
cell_types[ID($pow)] = "ABsY";
|
||||
cell_types[TW($pow)] = "ABsY";
|
||||
|
||||
cell_types[ID($logic_not)] = "ASY";
|
||||
cell_types[ID($logic_and)] = "ABSY";
|
||||
cell_types[ID($logic_or)] = "ABSY";
|
||||
cell_types[TW($logic_not)] = "ASY";
|
||||
cell_types[TW($logic_and)] = "ABSY";
|
||||
cell_types[TW($logic_or)] = "ABSY";
|
||||
|
||||
cell_types[ID($mux)] = "*";
|
||||
cell_types[ID($bmux)] = "*";
|
||||
cell_types[ID($demux)] = "*";
|
||||
cell_types[TW($mux)] = "*";
|
||||
cell_types[TW($bmux)] = "*";
|
||||
cell_types[TW($demux)] = "*";
|
||||
// $pmux doesn't work in sat, and is not supported with 'techmap -assert' or
|
||||
// '-simlib'
|
||||
if (nosat && techmap_cmd.compare("aigmap") == 0)
|
||||
cell_types[ID($pmux)] = "*";
|
||||
cell_types[ID($bwmux)] = "A";
|
||||
cell_types[TW($pmux)] = "*";
|
||||
cell_types[TW($bwmux)] = "A";
|
||||
|
||||
cell_types[ID($slice)] = "A";
|
||||
cell_types[ID($concat)] = "AB";
|
||||
cell_types[TW($slice)] = "A";
|
||||
cell_types[TW($concat)] = "AB";
|
||||
|
||||
cell_types[ID($lut)] = "*";
|
||||
cell_types[ID($sop)] = "*";
|
||||
cell_types[ID($alu)] = "ABSY";
|
||||
cell_types[ID($lcu)] = "*";
|
||||
cell_types[ID($macc_v2)] = "*";
|
||||
cell_types[ID($fa)] = "*";
|
||||
cell_types[TW($lut)] = "*";
|
||||
cell_types[TW($sop)] = "*";
|
||||
cell_types[TW($alu)] = "ABSY";
|
||||
cell_types[TW($lcu)] = "*";
|
||||
cell_types[TW($macc_v2)] = "*";
|
||||
cell_types[TW($fa)] = "*";
|
||||
|
||||
cell_types[ID($_BUF_)] = "AYb";
|
||||
cell_types[ID($_NOT_)] = "AYb";
|
||||
cell_types[ID($_AND_)] = "ABYb";
|
||||
cell_types[ID($_NAND_)] = "ABYb";
|
||||
cell_types[ID($_OR_)] = "ABYb";
|
||||
cell_types[ID($_NOR_)] = "ABYb";
|
||||
cell_types[ID($_XOR_)] = "ABYb";
|
||||
cell_types[ID($_XNOR_)] = "ABYb";
|
||||
cell_types[ID($_ANDNOT_)] = "ABYb";
|
||||
cell_types[ID($_ORNOT_)] = "ABYb";
|
||||
cell_types[ID($_MUX_)] = "*";
|
||||
cell_types[ID($_NMUX_)] = "*";
|
||||
cell_types[TW($_BUF_)] = "AYb";
|
||||
cell_types[TW($_NOT_)] = "AYb";
|
||||
cell_types[TW($_AND_)] = "ABYb";
|
||||
cell_types[TW($_NAND_)] = "ABYb";
|
||||
cell_types[TW($_OR_)] = "ABYb";
|
||||
cell_types[TW($_NOR_)] = "ABYb";
|
||||
cell_types[TW($_XOR_)] = "ABYb";
|
||||
cell_types[TW($_XNOR_)] = "ABYb";
|
||||
cell_types[TW($_ANDNOT_)] = "ABYb";
|
||||
cell_types[TW($_ORNOT_)] = "ABYb";
|
||||
cell_types[TW($_MUX_)] = "*";
|
||||
cell_types[TW($_NMUX_)] = "*";
|
||||
// wide $_MUX_ cells are not yet implemented
|
||||
// cell_types[ID($_MUX4_)] = "*";
|
||||
// cell_types[ID($_MUX8_)] = "*";
|
||||
// cell_types[ID($_MUX16_)] = "*";
|
||||
cell_types[ID($_AOI3_)] = "ABCYb";
|
||||
cell_types[ID($_OAI3_)] = "ABCYb";
|
||||
cell_types[ID($_AOI4_)] = "ABCDYb";
|
||||
cell_types[ID($_OAI4_)] = "ABCDYb";
|
||||
// cell_types[TW($_MUX4_)] = "*";
|
||||
// cell_types[TW($_MUX8_)] = "*";
|
||||
// cell_types[TW($_MUX16_)] = "*";
|
||||
cell_types[TW($_AOI3_)] = "ABCYb";
|
||||
cell_types[TW($_OAI3_)] = "ABCYb";
|
||||
cell_types[TW($_AOI4_)] = "ABCDYb";
|
||||
cell_types[TW($_OAI4_)] = "ABCDYb";
|
||||
|
||||
for (; argidx < GetSize(args); argidx++)
|
||||
{
|
||||
|
|
@ -1106,10 +1106,10 @@ struct TestCellPass : public Pass {
|
|||
int charcount = 100;
|
||||
for (auto &it : cell_types) {
|
||||
if (charcount > 60) {
|
||||
cell_type_list += stringf("\n%s", it.first.unescape());
|
||||
cell_type_list += stringf("\n%s", design->twines.unescaped_str(it.first));
|
||||
charcount = 0;
|
||||
} else
|
||||
cell_type_list += stringf(" %s", it.first.unescape());
|
||||
cell_type_list += stringf(" %s", design->twines.unescaped_str(it.first));
|
||||
charcount += GetSize(it.first);
|
||||
}
|
||||
log_cmd_error("The cell type `%s' is currently not supported. Try one of these:%s\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue