diff --git a/tools/netlist/netlist.cpp b/tools/netlist/netlist.cpp index 286a9ee20..91b26f7ad 100644 --- a/tools/netlist/netlist.cpp +++ b/tools/netlist/netlist.cpp @@ -93,12 +93,11 @@ class NetlistNode : public Node { void addMemberAccess(string_view name) { selectors.emplace_back(std::make_unique(name)); } - void setName(string_view newName) { name = newName; } - string_view getName() const { return name; } + string_view getName() const { return symbol->name; } public: size_t ID; - string_view name; + const Symbol *symbol; private: static size_t nextID; @@ -124,8 +123,7 @@ class VariableReferenceVisitor : public ASTVisitorkind == ExpressionKind::ElementSelect) { auto index = selector->as().selector().eval(evalCtx); @@ -230,6 +228,13 @@ class UnrollVisitor : public ASTVisitor { void handle(const PortSymbol &symbol) { std::cout << "PortSymbol " << symbol.name << "\n"; + auto &node = netlist.addNode(); + node.symbol = &symbol; + } + + void handle(const ContinuousAssignSymbol &symbol) { + AssignmentVisitor visitor(netlist, evalCtx); + symbol.visit(visitor); } void handle(const ForLoopStatement& loop) { @@ -345,11 +350,6 @@ class UnrollVisitor : public ASTVisitor { stmt.visit(visitor); } - void handle(const ContinuousAssignSymbol &symbol) { - AssignmentVisitor visitor(netlist, evalCtx); - symbol.visit(visitor); - } - private: bool step() { if (anyErrors || !evalCtx.step(SourceLocation::NoLocation)) {