Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always sorting #3945

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 12 additions & 30 deletions src/DesignCompile/UhdmWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4527,7 +4527,6 @@ void UhdmWriter::writeInstance(ModuleDefinition* mod, ModuleInstance* instance,
}
}


class AlwaysWithForLoop : public VpiListener {
public:
explicit AlwaysWithForLoop() {}
Expand All @@ -4549,10 +4548,10 @@ bool alwaysContainsForLoop(Serializer& serializer, any* root) {
}

// synlig has a major problem processing always blocks.
// They are processed mainly in the allModules section which is incorrect in some case.
// They should be processed from the topModules section.
// Here we try to fix temporarily this by filtering out the always blocks containing for-loops
// from the allModules, and those without from the topModules
// They are processed mainly in the allModules section which is incorrect in
// some case. They should be processed from the topModules section. Here we try
// to fix temporarily this by filtering out the always blocks containing
// for-loops from the allModules, and those without from the topModules
void filterAlwaysBlocks(Serializer& s, design* d) {
if (d->AllModules()) {
for (auto module : *d->AllModules()) {
Expand All @@ -4578,14 +4577,14 @@ void filterAlwaysBlocks(Serializer& s, design* d) {
std::queue<scope*> instances;
if (d->TopModules()) {
for (auto mod : *d->TopModules()) {
instances.push(mod) ;
instances.push(mod);
}
}
while (!instances.empty()) {
scope* current = instances.front();
instances.pop();
if (current->UhdmType() == uhdmmodule_inst) {
module_inst* mod = (module_inst*) current;
module_inst* mod = (module_inst*)current;
if (mod->Process()) {
bool more = true;
while (more) {
Expand All @@ -4605,41 +4604,24 @@ void filterAlwaysBlocks(Serializer& s, design* d) {
}
if (mod->Modules()) {
for (auto m : *mod->Modules()) {
instances.push(m);
instances.push(m);
}
}
if (mod->Gen_scope_arrays()) {
for (auto m : *mod->Gen_scope_arrays()) {
instances.push(m->Gen_scopes()->at(0));
instances.push(m->Gen_scopes()->at(0));
}
}
} else if (current->UhdmType() == uhdmgen_scope) {
gen_scope* sc = (gen_scope*) current;
if (sc->Process()) {
bool more = true;
while (more) {
more = false;
for (std::vector<process_stmt*>::iterator itr =
sc->Process()->begin();
itr != sc->Process()->end(); itr++) {
if ((*itr)->UhdmType() == uhdmalways) {
if (!alwaysContainsForLoop(s, (*itr))) {
more = true;
sc->Process()->erase(itr);
break;
}
}
}
}
}
if (sc->Modules()) {
gen_scope* sc = (gen_scope*)current;
if (sc->Modules()) {
for (auto m : *sc->Modules()) {
instances.push(m);
instances.push(m);
}
}
if (sc->Gen_scope_arrays()) {
for (auto m : *sc->Gen_scope_arrays()) {
instances.push(m->Gen_scopes()->at(0));
instances.push(m->Gen_scopes()->at(0));
}
}
}
Expand Down
Loading