[ImportVerilog] Fix root op ordering

Use `upper_bound` to pick an insertion point for modules. This ensures
that multiple parametrizations of a module appear in the order in which
they were instantiated, instead of the reverse order.
This commit is contained in:
Fabian Schuiki 2024-07-17 12:39:12 -07:00
parent 9845589129
commit 419de21c45
No known key found for this signature in database
GPG Key ID: C42F5825FC5275E6
1 changed files with 1 additions and 1 deletions

View File

@ -534,7 +534,7 @@ Context::convertModuleHeader(const slang::ast::InstanceBodySymbol *module) {
// Pick an insertion point for this module according to the source file
// location.
auto it = orderedRootOps.lower_bound(module->location);
auto it = orderedRootOps.upper_bound(module->location);
if (it == orderedRootOps.end())
builder.setInsertionPointToEnd(intoModuleOp.getBody());
else