From 2bec47a4045d23d46e7d300cbf80b2dce1a549a9 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 25 Jul 2014 15:05:18 +0200 Subject: Use only module->addCell() and module->remove() to create and delete cells --- kernel/rtlil.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'kernel/rtlil.h') diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 59db099fb..e1e4a54bc 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -271,7 +271,8 @@ struct RTLIL::Design { return attributes.at(id).as_bool(); \ } -struct RTLIL::Module { +struct RTLIL::Module +{ RTLIL::IdString name; std::set avail_parameters; std::map wires; @@ -295,6 +296,10 @@ struct RTLIL::Module { void add(RTLIL::Cell *cell); void remove(RTLIL::Cell *cell); + void rename(RTLIL::Wire *wire, RTLIL::IdString new_name); + void rename(RTLIL::Cell *cell, RTLIL::IdString new_name); + void rename(RTLIL::IdString old_name, RTLIL::IdString new_name); + RTLIL::Wire *addWire(RTLIL::IdString name, int width = 1); RTLIL::Cell *addCell(RTLIL::IdString name, RTLIL::IdString type); @@ -444,7 +449,19 @@ struct RTLIL::Memory { Memory(); }; -struct RTLIL::Cell { +struct RTLIL::Cell +{ +protected: + // Use module->addCell() and module->remove() to create or destroy modules. + friend struct RTLIL::Module; + Cell() { }; + ~Cell() { }; + +public: + // do not copy simply cells + Cell(RTLIL::Cell &other) = delete; + void operator=(RTLIL::Cell &other) = delete; + RTLIL::IdString name; RTLIL::IdString type; std::map connections; -- cgit v1.2.3