Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Hanlon committed Mar 16, 2023
1 parent d3a78e3 commit 4cd9042
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tools/netlist/netlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ class NetlistNode : public Node<NetlistNode, NetlistEdge> {
void addMemberAccess(string_view name) {
selectors.emplace_back(std::make_unique<VariableMemberAccess>(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;
Expand All @@ -124,8 +123,7 @@ class VariableReferenceVisitor : public ASTVisitor<VariableReferenceVisitor, fal
void handle(const NamedValueExpression &expr) {
auto &node = netlist.addNode();
visitList.push_back(&node);
node.setName(expr.symbol.name);
//std::cout<<"Got node "<<node.getName()<<"\n";
node.symbol = &(expr.symbol);
for (auto *selector : selectors) {
if (selector->kind == ExpressionKind::ElementSelect) {
auto index = selector->as<ElementSelectExpression>().selector().eval(evalCtx);
Expand Down Expand Up @@ -230,6 +228,13 @@ class UnrollVisitor : public ASTVisitor<UnrollVisitor, true, false> {

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) {
Expand Down Expand Up @@ -345,11 +350,6 @@ class UnrollVisitor : public ASTVisitor<UnrollVisitor, true, false> {
stmt.visit(visitor);
}

void handle(const ContinuousAssignSymbol &symbol) {
AssignmentVisitor visitor(netlist, evalCtx);
symbol.visit(visitor);
}

private:
bool step() {
if (anyErrors || !evalCtx.step(SourceLocation::NoLocation)) {
Expand Down

0 comments on commit 4cd9042

Please sign in to comment.