aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
Diffstat (limited to 'passes')
-rw-r--r--passes/hierarchy/hierarchy.cc20
-rw-r--r--passes/techmap/libparse.cc24
2 files changed, 38 insertions, 6 deletions
diff --git a/passes/hierarchy/hierarchy.cc b/passes/hierarchy/hierarchy.cc
index c460fbbfc..c680dbbd8 100644
--- a/passes/hierarchy/hierarchy.cc
+++ b/passes/hierarchy/hierarchy.cc
@@ -620,17 +620,26 @@ struct HierarchyPass : public Pass {
}
}
+ std::set<Module*> blackbox_derivatives;
+
for (auto module : design->modules())
for (auto cell : module->cells())
{
- if (GetSize(cell->parameters) != 0)
- continue;
-
Module *m = design->module(cell->type);
- if (m == nullptr || m->get_bool_attribute("\\blackbox"))
+ if (m == nullptr)
continue;
+ if (m->get_bool_attribute("\\blackbox") && !cell->parameters.empty()) {
+ IdString new_m_name = m->derive(design, cell->parameters, true);
+ if (new_m_name.empty())
+ continue;
+ if (new_m_name != m->name) {
+ m = design->module(new_m_name);
+ blackbox_derivatives.insert(m);
+ }
+ }
+
for (auto &conn : cell->connections())
{
Wire *w = m->wire(conn.first);
@@ -673,6 +682,9 @@ struct HierarchyPass : public Pass {
}
}
+ for (auto module : blackbox_derivatives)
+ design->remove(module);
+
log_pop();
}
} HierarchyPass;
diff --git a/passes/techmap/libparse.cc b/passes/techmap/libparse.cc
index d5254c029..d3b1ff02f 100644
--- a/passes/techmap/libparse.cc
+++ b/passes/techmap/libparse.cc
@@ -100,8 +100,15 @@ int LibertyParser::lexer(std::string &str)
break;
}
f.unget();
- // fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
- return 'v';
+ if (str == "+" || str == "-") {
+ /* Single operator is not an identifier */
+ // fprintf(stderr, "LEX: char >>%s<<\n", str.c_str());
+ return str[0];
+ }
+ else {
+ // fprintf(stderr, "LEX: identifier >>%s<<\n", str.c_str());
+ return 'v';
+ }
}
if (c == '"') {
@@ -191,6 +198,19 @@ LibertyAst *LibertyParser::parse()
tok = lexer(ast->value);
if (tok != 'v')
error();
+ tok = lexer(str);
+ while (tok == '+' || tok == '-' || tok == '*' || tok == '/') {
+ ast->value += tok;
+ tok = lexer(str);
+ if (tok != 'v')
+ error();
+ ast->value += str;
+ tok = lexer(str);
+ }
+ if (tok == ';')
+ break;
+ else
+ error();
continue;
}