diff --git a/kernel/celltypes.h b/kernel/celltypes.h index 2c3535eac..bf17883b9 100644 --- a/kernel/celltypes.h +++ b/kernel/celltypes.h @@ -548,9 +548,6 @@ struct CellTypes } }; -// initialized by yosys_setup() -extern CellTypes yosys_celltypes; - YOSYS_NAMESPACE_END #endif diff --git a/kernel/newcelltypes.h b/kernel/newcelltypes.h index be661fc4f..868b54c8f 100644 --- a/kernel/newcelltypes.h +++ b/kernel/newcelltypes.h @@ -419,32 +419,7 @@ struct CellTableBuilder { }; - -constexpr CellTableBuilder turbo_builder{}; - -// template -// struct Worlds { -// struct World { -// std::array 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 diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 009da56b9..adfd8d808 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -18,7 +18,7 @@ */ #include "kernel/yosys.h" -#include "kernel/celltypes.h" +#include "kernel/newcelltypes.h" #ifdef YOSYS_ENABLE_READLINE # include @@ -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)) {