mirror of
https://github.com/YosysHQ/yosys
synced 2026-06-05 00:20:52 +00:00
pmgen: hold sigmap pointer instead of owning it
This commit is contained in:
parent
647541a4c1
commit
8bbb0acdda
10 changed files with 61 additions and 42 deletions
|
|
@ -361,7 +361,7 @@ with open(outfile, "w") as f:
|
|||
|
||||
print("struct {}_pm {{".format(prefix), file=f)
|
||||
print(" Module *module;", file=f)
|
||||
print(" SigMap sigmap;", file=f)
|
||||
print(" SigMap *sigmap;", file=f)
|
||||
print(" std::function<void()> on_accept;", file=f)
|
||||
print(" bool setup_done;", file=f)
|
||||
print(" bool generate_mode;", file=f)
|
||||
|
|
@ -423,7 +423,7 @@ with open(outfile, "w") as f:
|
|||
print("", file=f)
|
||||
|
||||
print(" void add_siguser(const SigSpec &sig, Cell *cell) {", file=f)
|
||||
print(" for (auto bit : sigmap(sig)) {", file=f)
|
||||
print(" for (auto bit : (*sigmap)(sig)) {", file=f)
|
||||
print(" if (bit.wire == nullptr) continue;", file=f)
|
||||
print(" sigusers[bit].insert(cell);", file=f)
|
||||
print(" }", file=f)
|
||||
|
|
@ -453,12 +453,12 @@ with open(outfile, "w") as f:
|
|||
|
||||
print(" SigSpec port(Cell *cell, IdString portname) {", file=f)
|
||||
print(" try {", file=f)
|
||||
print(" return sigmap(cell->getPort(portname));", file=f)
|
||||
print(" return (*sigmap)(cell->getPort(portname));", file=f)
|
||||
print(" } catch(std::out_of_range&) { log_error(\"Accessing non existing port %s\\n\",portname); }", file=f)
|
||||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
print(" SigSpec port(Cell *cell, IdString portname, const SigSpec& defval) {", file=f)
|
||||
print(" return sigmap(cell->connections_.at(portname, defval));", file=f)
|
||||
print(" return (*sigmap)(cell->connections_.at(portname, defval));", file=f)
|
||||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
|
||||
|
|
@ -475,21 +475,21 @@ with open(outfile, "w") as f:
|
|||
|
||||
print(" int nusers(const SigSpec &sig) {", file=f)
|
||||
print(" pool<Cell*> users;", file=f)
|
||||
print(" for (auto bit : sigmap(sig))", file=f)
|
||||
print(" for (auto bit : (*sigmap)(sig))", file=f)
|
||||
print(" for (auto user : sigusers[bit])", file=f)
|
||||
print(" users.insert(user);", file=f)
|
||||
print(" return GetSize(users);", file=f)
|
||||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
|
||||
print(" {}_pm(Module *module, const vector<Cell*> &cells) :".format(prefix), file=f)
|
||||
print(" module(module), sigmap(module), setup_done(false), generate_mode(false), rngseed(12345678) {", file=f)
|
||||
print(" {}_pm(Module *module, SigMap *map, const vector<Cell*> &cells) :".format(prefix), file=f)
|
||||
print(" module(module), sigmap(map), setup_done(false), generate_mode(false), rngseed(12345678) {", file=f)
|
||||
print(" setup(cells);", file=f)
|
||||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
|
||||
print(" {}_pm(Module *module) :".format(prefix), file=f)
|
||||
print(" module(module), sigmap(module), setup_done(false), generate_mode(false), rngseed(12345678) {", file=f)
|
||||
print(" {}_pm(Module *module, SigMap *map) :".format(prefix), file=f)
|
||||
print(" module(module), sigmap(map), setup_done(false), generate_mode(false), rngseed(12345678) {", file=f)
|
||||
print(" }", file=f)
|
||||
print("", file=f)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue