mirror of https://github.com/YosysHQ/yosys.git
newcelltypes: extend testing
This commit is contained in:
parent
b340537796
commit
8f627d43fc
|
|
@ -14,24 +14,30 @@ TEST(CellTypesTest, basic)
|
||||||
log_files.push_back(stdout);
|
log_files.push_back(stdout);
|
||||||
CellTypes older;
|
CellTypes older;
|
||||||
NewCellTypes newer;
|
NewCellTypes newer;
|
||||||
log("setup nullptr\n");
|
|
||||||
older.setup(nullptr);
|
older.setup(nullptr);
|
||||||
newer.setup(nullptr);
|
newer.setup(nullptr);
|
||||||
log("setup type bleh\n");
|
|
||||||
older.setup_type(ID(bleh), {ID::G}, {ID::H, ID::I}, false, true);
|
older.setup_type(ID(bleh), {ID::G}, {ID::H, ID::I}, false, true);
|
||||||
newer.setup_type(ID(bleh), {ID::G}, {ID::H, ID::I}, false, true);
|
newer.setup_type(ID(bleh), {ID::G}, {ID::H, ID::I}, false, true);
|
||||||
|
|
||||||
EXPECT_EQ(older.cell_known(ID(aaaaa)), newer.cell_known(ID(aaaaa)));
|
EXPECT_EQ(older.cell_known(ID(aaaaa)), newer.cell_known(ID(aaaaa)));
|
||||||
EXPECT_EQ(older.cell_known(ID($and)), newer.cell_known(ID($and)));
|
EXPECT_EQ(older.cell_known(ID($and)), newer.cell_known(ID($and)));
|
||||||
|
auto check_port = [&](auto type, auto port) {
|
||||||
|
EXPECT_EQ(older.cell_port_dir(type, port), newer.cell_port_dir(type, port));
|
||||||
|
EXPECT_EQ(older.cell_input(type, port), newer.cell_input(type, port));
|
||||||
|
EXPECT_EQ(older.cell_output(type, port), newer.cell_output(type, port));
|
||||||
|
};
|
||||||
for (size_t i = 0; i < static_cast<size_t>(RTLIL::StaticId::STATIC_ID_END); i++) {
|
for (size_t i = 0; i < static_cast<size_t>(RTLIL::StaticId::STATIC_ID_END); i++) {
|
||||||
IdString type;
|
IdString type;
|
||||||
type.index_ = i;
|
type.index_ = i;
|
||||||
if (older.cell_known(type) != newer.cell_known(type))
|
|
||||||
std::cout << i << " " << type.str() << "\n";
|
|
||||||
EXPECT_EQ(older.cell_known(type), newer.cell_known(type));
|
EXPECT_EQ(older.cell_known(type), newer.cell_known(type));
|
||||||
|
if (older.cell_evaluable(type) != newer.cell_evaluable(type))
|
||||||
|
std::cout << type.str() << "\n";
|
||||||
|
EXPECT_EQ(older.cell_evaluable(type), newer.cell_evaluable(type));
|
||||||
|
for (auto port : StaticCellTypes::builder.cells.data()->inputs.ports)
|
||||||
|
check_port(type, port);
|
||||||
|
for (auto port : StaticCellTypes::builder.cells.data()->outputs.ports)
|
||||||
|
check_port(type, port);
|
||||||
|
|
||||||
if (RTLIL::builtin_ff_cell_types().count(type) != StaticCellTypes::categories.is_ff(type))
|
|
||||||
std::cout << i << " " << type.str() << "\n";
|
|
||||||
EXPECT_EQ(RTLIL::builtin_ff_cell_types().count(type), StaticCellTypes::categories.is_ff(type));
|
EXPECT_EQ(RTLIL::builtin_ff_cell_types().count(type), StaticCellTypes::categories.is_ff(type));
|
||||||
}
|
}
|
||||||
yosys_shutdown();
|
yosys_shutdown();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue