Skip to content

Commit

Permalink
Do convert UninstantiatedDef symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Jun 13, 2024
1 parent 28c27a6 commit 28689f9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions slang_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,29 @@ struct ModulePopulatingVisitor : public ast::ASTVisitor<ModulePopulatingVisitor,
global_diagclient->clear();
}

void handle(const ast::UninstantiatedDefSymbol &sym)
{
require(sym, !sym.isChecker());
require(sym, sym.paramExpressions.empty());

std::string instanceName;
sym.getHierarchicalPath(instanceName);

RTLIL::Cell *cell = mod->addCell(id(instanceName),
id(sym.definitionName));

auto port_names = sym.getPortNames();
auto port_conns = sym.getPortConnections();

log_assert(port_names.size() == port_conns.size());
for (int i = 0; i < port_names.size(); i++) {
require(sym, !port_names[i].empty());
auto &expr = port_conns[i]->as<ast::SimpleAssertionExpr>().expr;
cell->setPort(RTLIL::escape_id(std::string{port_names[i]}),
evaluate_rhs(mod, expr, NULL));
}
}

void handle(YS_MAYBE_UNUSED const ast::Type &type) {}
void handle(YS_MAYBE_UNUSED const ast::NetType &type) {}
void handle(YS_MAYBE_UNUSED const ast::ForwardingTypedefSymbol &sym) {}
Expand Down

0 comments on commit 28689f9

Please sign in to comment.