mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-18 21:25:47 +00:00
cleaner with warning
This commit is contained in:
parent
c3a9a6d90e
commit
20c1f3212f
4 changed files with 13 additions and 9 deletions
|
|
@ -397,7 +397,7 @@ int FstData::getWidth(fstHandle signal)
|
|||
}
|
||||
|
||||
// Auto-discover scope from FST by finding the top module
|
||||
std::vector<std::string> FstData::autoScope(Module *topmod) {
|
||||
std::string FstData::autoScope(Module *topmod) {
|
||||
|
||||
log("Auto-discovering scopes from file...\n");
|
||||
std::string top = RTLIL::unescape_id(topmod->name);
|
||||
|
|
@ -449,11 +449,17 @@ std::vector<std::string> FstData::autoScope(Module *topmod) {
|
|||
if (results.empty()) {
|
||||
log_warning("Could not auto-discover scope for module '%s'...\n",
|
||||
RTLIL::unescape_id(topmod->name).c_str());
|
||||
return "";
|
||||
} else {
|
||||
log("Found %d scopes for module '%s':\n", GetSize(results), RTLIL::unescape_id(topmod->name).c_str());
|
||||
for (const auto& scope : results) {
|
||||
log(" %s\n", scope.c_str());
|
||||
}
|
||||
if (results.size() > 1) {
|
||||
log_warning("Multiple scopes found for module '%s'. Using the first one.\n",
|
||||
RTLIL::unescape_id(topmod->name).c_str());
|
||||
}
|
||||
std::string scope = results[0];
|
||||
}
|
||||
return results;
|
||||
return scope;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class FstData
|
|||
double getTimescale() { return timescale; }
|
||||
const char *getTimescaleString() { return timescale_str.c_str(); }
|
||||
int getWidth(fstHandle signal);
|
||||
std::vector<std::string> autoScope(Module *topmod);
|
||||
std::string autoScope(Module *topmod);
|
||||
private:
|
||||
void extractVarNames();
|
||||
|
||||
|
|
|
|||
|
|
@ -1475,12 +1475,11 @@ struct SimWorker : SimShared
|
|||
fst = new FstData(sim_filename);
|
||||
timescale = fst->getTimescaleString();
|
||||
if (scope.empty()) {
|
||||
std::vector<std::string> scopes = fst->autoScope(topmod);
|
||||
if (scopes.empty()) {
|
||||
scope = fst->autoScope(topmod);
|
||||
if (scope.empty()) {
|
||||
log_error("No scope found for module '%s'. Please specify -scope explicitly.\n",
|
||||
RTLIL::unescape_id(topmod->name).c_str());
|
||||
}
|
||||
scope = scopes[0]; // Use the first scope found by default
|
||||
}
|
||||
log("Using scope: \"%s\"\n", scope.c_str());
|
||||
|
||||
|
|
|
|||
|
|
@ -200,12 +200,11 @@ struct RegRenamePass : public Pass {
|
|||
try {
|
||||
FstData fst(vcd_filename);
|
||||
if (scope.empty()) {
|
||||
std::vector<std::string> scopes = fst.autoScope(topmod);
|
||||
if (scopes.empty()) {
|
||||
scope = fst.autoScope(topmod);
|
||||
if (scope.empty()) {
|
||||
log_error("No scope found for module '%s'. Please specify -scope explicitly.\n",
|
||||
RTLIL::unescape_id(topmod->name).c_str());
|
||||
}
|
||||
scope = scopes[0]; // Use the first scope found by default
|
||||
}
|
||||
log("Using scope: \"%s\"\n", scope.c_str());
|
||||
for (auto &var : fst.getVars()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue