mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 19:36:21 +00:00
rtlil: allow friends to use Wire constructors with a factory token pattern
This commit is contained in:
parent
3e6b740430
commit
6f0be1b4e9
2 changed files with 11 additions and 15 deletions
|
|
@ -2454,18 +2454,20 @@ void dump_wire(std::ostream &f, std::string indent, const RTLIL::Wire *wire);
|
|||
|
||||
struct RTLIL::Wire : public RTLIL::NamedObject
|
||||
{
|
||||
private:
|
||||
struct ConstructToken { explicit ConstructToken() = default; };
|
||||
friend struct RTLIL::Design;
|
||||
friend struct RTLIL::Cell;
|
||||
friend struct RTLIL::Module;
|
||||
friend struct RTLIL::Patch;
|
||||
public:
|
||||
Hasher::hash_t hashidx_;
|
||||
[[nodiscard]] Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; }
|
||||
|
||||
protected:
|
||||
// use module->addWire() and module->remove() to create or destroy wires
|
||||
friend struct RTLIL::Module;
|
||||
friend struct RTLIL::SigNormIndex;
|
||||
Wire();
|
||||
~Wire();
|
||||
|
||||
friend struct RTLIL::Design;
|
||||
friend struct RTLIL::Cell;
|
||||
friend void RTLIL_BACKEND::dump_wire(std::ostream &f, std::string indent, const RTLIL::Wire *wire);
|
||||
RTLIL::Cell *driverCell_ = nullptr;
|
||||
RTLIL::IdString driverPort_;
|
||||
|
|
@ -2527,13 +2529,13 @@ struct RTLIL::Cell : public RTLIL::NamedObject
|
|||
{
|
||||
private:
|
||||
struct ConstructToken { explicit ConstructToken() = default; };
|
||||
friend struct RTLIL::Module;
|
||||
friend struct RTLIL::Patch;
|
||||
public:
|
||||
Hasher::hash_t hashidx_;
|
||||
[[nodiscard]] Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; }
|
||||
|
||||
// use module->addCell() and module->remove() to create or destroy cells
|
||||
friend struct RTLIL::Module;
|
||||
friend struct RTLIL::Patch;
|
||||
Cell(ConstructToken);
|
||||
~Cell();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,7 @@ Cell* Patch::addCell(IdString name, IdString type) {
|
|||
cell.type = type;
|
||||
return &cell;
|
||||
}
|
||||
// RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, RTLIL::IdString type)
|
||||
// {
|
||||
// RTLIL::Cell *cell = new RTLIL::Cell;
|
||||
// cell->name = std::move(name);
|
||||
// cell->type = type;
|
||||
// add(cell);
|
||||
// return cell;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
YOSYS_NAMESPACE_END
|
||||
Loading…
Add table
Add a link
Reference in a new issue