yosys: use newcelltypes for yosys_celltypes

This commit is contained in:
Emil J. Tywoniak 2025-11-26 00:47:30 +01:00
parent 99cb0483b8
commit 46f9e70dce
3 changed files with 12 additions and 38 deletions

View File

@ -548,9 +548,6 @@ struct CellTypes
}
};
// initialized by yosys_setup()
extern CellTypes yosys_celltypes;
YOSYS_NAMESPACE_END
#endif

View File

@ -419,32 +419,7 @@ struct CellTableBuilder {
};
constexpr CellTableBuilder turbo_builder{};
// template<typename T>
// struct Worlds {
// struct World {
// std::array<T, MAX_CELLS> data{};
// constexpr T operator()(IdString type) const {
// return data[type.index_];
// }
// constexpr T& operator[](size_t idx) {
// return data[idx];
// }
// constexpr size_t size() const { return data.size(); }
// };
// World is_known {};
// World is_evaluable {};
// World is_combinatorial {};
// World is_synthesizable {};
// World is_stdcell {};
// World is_ff {};
// World is_mem_noff {};
// World is_anyinit {};
// World is_tristate {};
// virtual constexpr Categories();
// };
constexpr CellTableBuilder builder{};
struct PortInfo {
struct PortLists {
@ -460,8 +435,8 @@ struct PortInfo {
PortLists inputs {};
PortLists outputs {};
constexpr PortInfo() {
for (size_t i = 0; i < turbo_builder.count; ++i) {
auto& cell = turbo_builder.cells[i];
for (size_t i = 0; i < builder.count; ++i) {
auto& cell = builder.cells[i];
size_t idx = cell.type.index_;
inputs[idx] = cell.inputs;
outputs[idx] = cell.outputs;
@ -503,8 +478,8 @@ struct Categories {
Category is_anyinit {};
Category is_tristate {};
constexpr Categories() {
for (size_t i = 0; i < turbo_builder.count; ++i) {
auto& cell = turbo_builder.cells[i];
for (size_t i = 0; i < builder.count; ++i) {
auto& cell = builder.cells[i];
size_t idx = cell.type.index_;
is_known.set(idx);
is_evaluable.set(idx, cell.features.is_evaluable);
@ -558,6 +533,8 @@ namespace Compat {
// old setup_stdcells
static constexpr auto stdcells_nomem_noff = Categories::meet(categories.is_stdcell, nomem_noff);
static constexpr auto stdcells_mem = Categories::meet(categories.is_stdcell, categories.is_mem_noff);
// old setup_internals_eval
// static constexpr auto internals_eval = Categories::meet(internals_all, categories.is_evaluable);
};
namespace {
@ -665,6 +642,8 @@ struct NewCellTypes {
}
};
extern NewCellTypes yosys_celltypes;
YOSYS_NAMESPACE_END
#endif

View File

@ -18,7 +18,7 @@
*/
#include "kernel/yosys.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#ifdef YOSYS_ENABLE_READLINE
# include <readline/readline.h>
@ -91,7 +91,7 @@ const char* yosys_maybe_version() {
}
RTLIL::Design *yosys_design = NULL;
CellTypes yosys_celltypes;
NewCellTypes yosys_celltypes;
#ifdef YOSYS_ENABLE_TCL
Tcl_Interp *yosys_tcl_interp = NULL;
@ -240,7 +240,7 @@ void yosys_setup()
Pass::init_register();
yosys_design = new RTLIL::Design;
yosys_celltypes.setup();
yosys_celltypes.static_cell_types = StaticCellTypes::categories.is_known;
log_push();
}
@ -269,8 +269,6 @@ void yosys_shutdown()
log_errfile = NULL;
log_files.clear();
yosys_celltypes.clear();
#ifdef YOSYS_ENABLE_TCL
if (yosys_tcl_interp != NULL) {
if (!Tcl_InterpDeleted(yosys_tcl_interp)) {