Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b474ce0
newcelltypes: init
widlarizer Nov 25, 2025
2e2f9e2
opt_clean: use newcelltypes
widlarizer Nov 25, 2025
d1ade01
opt_expr: use newcelltypes
widlarizer Nov 25, 2025
bea80c0
newcelltypes: TurboCellTypes -> StaticCellTypes
widlarizer Nov 25, 2025
29453aa
newcelltypes: wrap design celltypes support
widlarizer Nov 25, 2025
f6e5ea3
newcelltypes: bounds check
widlarizer Nov 25, 2025
79619a7
newcelltypes: unit test
widlarizer Nov 25, 2025
f4975f2
newcelltypes: fix unit test
widlarizer Nov 25, 2025
e2e7e5e
share: use newcelltypes
widlarizer Nov 25, 2025
746e9f6
newcelltypes: refactor
widlarizer Nov 25, 2025
4b55e5f
newcelltypes: fix non-cells
widlarizer Nov 25, 2025
8c53b70
fixup! opt_clean: use newcelltypes
widlarizer Nov 25, 2025
9877d18
modtools: use newcelltypes
widlarizer Nov 25, 2025
ce3c23f
consteval: use newcelltypes
widlarizer Nov 25, 2025
a8509ae
fixup! consteval: use newcelltypes
widlarizer Nov 25, 2025
299d64a
newcelltypes: comment
widlarizer Nov 25, 2025
92543c5
newcelltypes: test against builtin_ff_cell_types
widlarizer Nov 25, 2025
52d8a3e
abc: use newcelltypes
widlarizer Nov 25, 2025
6cd7c51
aiger2: add TODO
widlarizer Nov 25, 2025
ab4fd8c
drivertools: use newcelltypes
widlarizer Nov 25, 2025
99cb048
backends: use newcelltypes
widlarizer Nov 25, 2025
46f9e70
yosys: use newcelltypes for yosys_celltypes
widlarizer Nov 25, 2025
4dddd6f
yosys: use newcelltypes for yosys_celltypes users
widlarizer Nov 25, 2025
e8f7845
register: use newcelltypes
widlarizer Nov 25, 2025
7f436ec
newcelltypes: proper bounds for unit test
widlarizer Nov 26, 2025
ce6cd32
newcelltypes: fix MSVC build
widlarizer Nov 26, 2025
0d13de9
fixup! register: use newcelltypes
widlarizer Nov 27, 2025
43ca525
pyosys: disable test
widlarizer Nov 27, 2025
105c591
newcelltypes: use unordered_map
widlarizer Nov 27, 2025
b340537
celltypes: fix absurd eval declarations
widlarizer Nov 27, 2025
8f627d4
newcelltypes: extend testing
widlarizer Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ $(eval $(call add_include_file,kernel/bitpattern.h))
$(eval $(call add_include_file,kernel/cellaigs.h))
$(eval $(call add_include_file,kernel/celledges.h))
$(eval $(call add_include_file,kernel/celltypes.h))
$(eval $(call add_include_file,kernel/newcelltypes.h))
$(eval $(call add_include_file,kernel/consteval.h))
$(eval $(call add_include_file,kernel/constids.inc))
$(eval $(call add_include_file,kernel/cost.h))
Expand Down
2 changes: 2 additions & 0 deletions backends/aiger2/aiger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ PRIVATE_NAMESPACE_BEGIN
// TODO
//#define ARITH_OPS ID($add), ID($sub), ID($neg)

// TODO convert to newcelltypes

#define KNOWN_OPS BITWISE_OPS, REDUCE_OPS, LOGIC_OPS, GATE_OPS, ID($pos), CMP_OPS, \
ID($pmux), ID($bmux) /*, ARITH_OPS*/

Expand Down
4 changes: 2 additions & 2 deletions backends/blif/blif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "kernel/rtlil.h"
#include "kernel/register.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#include "kernel/log.h"
#include <string>

Expand Down Expand Up @@ -60,7 +60,7 @@ struct BlifDumper
RTLIL::Module *module;
RTLIL::Design *design;
BlifDumperConfig *config;
CellTypes ct;
NewCellTypes ct;

SigMap sigmap;
dict<SigBit, int> init_bits;
Expand Down
4 changes: 2 additions & 2 deletions backends/edif/edif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "kernel/rtlil.h"
#include "kernel/register.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#include "kernel/log.h"
#include <string>

Expand Down Expand Up @@ -138,7 +138,7 @@ struct EdifBackend : public Backend {
bool lsbidx = false;
std::map<RTLIL::IdString, std::map<RTLIL::IdString, int>> lib_cell_ports;
bool nogndvcc = false, gndvccy = false, keepmode = false;
CellTypes ct(design);
NewCellTypes ct(design);
EdifNames edif_names;

size_t argidx;
Expand Down
4 changes: 2 additions & 2 deletions backends/intersynth/intersynth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "kernel/rtlil.h"
#include "kernel/register.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#include "kernel/log.h"
#include <string>

Expand Down Expand Up @@ -117,7 +117,7 @@ struct IntersynthBackend : public Backend {

std::set<std::string> conntypes_code, celltypes_code;
std::string netlists_code;
CellTypes ct(design);
NewCellTypes ct(design);

for (auto lib : libs)
ct.setup_design(lib);
Expand Down
4 changes: 2 additions & 2 deletions backends/smt2/smt2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "kernel/rtlil.h"
#include "kernel/register.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#include "kernel/log.h"
#include "kernel/mem.h"
#include "libs/json11/json11.hpp"
Expand All @@ -32,7 +32,7 @@ PRIVATE_NAMESPACE_BEGIN

struct Smt2Worker
{
CellTypes ct;
NewCellTypes ct;
SigMap sigmap;
RTLIL::Module *module;
bool bvmode, memmode, wiresmode, verbose, statebv, statedt, forallmode;
Expand Down
4 changes: 2 additions & 2 deletions backends/smv/smv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "kernel/rtlil.h"
#include "kernel/register.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#include "kernel/log.h"
#include <string>

Expand All @@ -29,7 +29,7 @@ PRIVATE_NAMESPACE_BEGIN

struct SmvWorker
{
CellTypes ct;
NewCellTypes ct;
SigMap sigmap;
RTLIL::Module *module;
std::ostream &f;
Expand Down
2 changes: 1 addition & 1 deletion frontends/aiger/aigerparse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "kernel/yosys.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"
#include "aigerparse.h"

YOSYS_NAMESPACE_BEGIN
Expand Down
37 changes: 17 additions & 20 deletions kernel/celltypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,22 @@ struct CellTypes
{
setup_internals_eval();

setup_type(ID($tribuf), {ID::A, ID::EN}, {ID::Y}, true);

setup_type(ID($assert), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);
setup_type(ID($assume), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);
setup_type(ID($live), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);
setup_type(ID($fair), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);
setup_type(ID($cover), {ID::A, ID::EN}, pool<RTLIL::IdString>(), true);
setup_type(ID($initstate), pool<RTLIL::IdString>(), {ID::Y}, true);
setup_type(ID($anyconst), pool<RTLIL::IdString>(), {ID::Y}, true);
setup_type(ID($anyseq), pool<RTLIL::IdString>(), {ID::Y}, true);
setup_type(ID($allconst), pool<RTLIL::IdString>(), {ID::Y}, true);
setup_type(ID($allseq), pool<RTLIL::IdString>(), {ID::Y}, true);
setup_type(ID($equiv), {ID::A, ID::B}, {ID::Y}, true);
setup_type(ID($specify2), {ID::EN, ID::SRC, ID::DST}, pool<RTLIL::IdString>(), true);
setup_type(ID($specify3), {ID::EN, ID::SRC, ID::DST, ID::DAT}, pool<RTLIL::IdString>(), true);
setup_type(ID($specrule), {ID::EN_SRC, ID::EN_DST, ID::SRC, ID::DST}, pool<RTLIL::IdString>(), true);
setup_type(ID($tribuf), {ID::A, ID::EN}, {ID::Y});

setup_type(ID($assert), {ID::A, ID::EN}, pool<RTLIL::IdString>());
setup_type(ID($assume), {ID::A, ID::EN}, pool<RTLIL::IdString>());
setup_type(ID($live), {ID::A, ID::EN}, pool<RTLIL::IdString>());
setup_type(ID($fair), {ID::A, ID::EN}, pool<RTLIL::IdString>());
setup_type(ID($cover), {ID::A, ID::EN}, pool<RTLIL::IdString>());
setup_type(ID($initstate), pool<RTLIL::IdString>(), {ID::Y});
setup_type(ID($anyconst), pool<RTLIL::IdString>(), {ID::Y});
setup_type(ID($anyseq), pool<RTLIL::IdString>(), {ID::Y});
setup_type(ID($allconst), pool<RTLIL::IdString>(), {ID::Y});
setup_type(ID($allseq), pool<RTLIL::IdString>(), {ID::Y});
setup_type(ID($equiv), {ID::A, ID::B}, {ID::Y});
setup_type(ID($specify2), {ID::EN, ID::SRC, ID::DST}, pool<RTLIL::IdString>());
setup_type(ID($specify3), {ID::EN, ID::SRC, ID::DST, ID::DAT}, pool<RTLIL::IdString>());
setup_type(ID($specrule), {ID::EN_SRC, ID::EN_DST, ID::SRC, ID::DST}, pool<RTLIL::IdString>());
setup_type(ID($print), {ID::EN, ID::ARGS, ID::TRG}, pool<RTLIL::IdString>());
setup_type(ID($check), {ID::A, ID::EN, ID::ARGS, ID::TRG}, pool<RTLIL::IdString>());
setup_type(ID($set_tag), {ID::A, ID::SET, ID::CLR}, {ID::Y});
Expand Down Expand Up @@ -195,7 +195,7 @@ struct CellTypes
{
setup_stdcells_eval();

setup_type(ID($_TBUF_), {ID::A, ID::E}, {ID::Y}, true);
setup_type(ID($_TBUF_), {ID::A, ID::E}, {ID::Y});
}

void setup_stdcells_eval()
Expand Down Expand Up @@ -548,9 +548,6 @@ struct CellTypes
}
};

// initialized by yosys_setup()
extern CellTypes yosys_celltypes;

YOSYS_NAMESPACE_END

#endif
6 changes: 3 additions & 3 deletions kernel/consteval.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/macc.h"
#include "kernel/newcelltypes.h"

YOSYS_NAMESPACE_BEGIN

Expand All @@ -40,9 +41,8 @@ struct ConstEval

ConstEval(RTLIL::Module *module, RTLIL::State defaultval = RTLIL::State::Sm) : module(module), assign_map(module), defaultval(defaultval)
{
CellTypes ct;
ct.setup_internals();
ct.setup_stdcells();
auto ct = NewCellTypes();
ct.static_cell_types = StaticCellTypes::Compat::nomem_noff;

for (auto &it : module->cells_) {
if (!ct.cell_known(it.second->type))
Expand Down
6 changes: 3 additions & 3 deletions kernel/drivertools.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "kernel/rtlil.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"

YOSYS_NAMESPACE_BEGIN

Expand Down Expand Up @@ -1093,10 +1093,10 @@ struct DriveSpec

struct DriverMap
{
CellTypes celltypes;
NewCellTypes celltypes;

DriverMap() { celltypes.setup(); }
DriverMap(Design *design) { celltypes.setup(); celltypes.setup_design(design); }
DriverMap(Design *design) { celltypes.setup(design); }

private:

Expand Down
3 changes: 2 additions & 1 deletion kernel/modtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "kernel/yosys.h"
#include "kernel/sigtools.h"
#include "kernel/celltypes.h"
#include "kernel/newcelltypes.h"

YOSYS_NAMESPACE_BEGIN

Expand Down Expand Up @@ -332,7 +333,7 @@ struct ModWalker
RTLIL::Design *design;
RTLIL::Module *module;

CellTypes ct;
NewCellTypes ct;
SigMap sigmap;

dict<RTLIL::SigBit, pool<PortBit>> signal_drivers;
Expand Down
Loading
Loading