3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-13 04:28:18 +00:00

Fixed handling of positional module parameters

This commit is contained in:
Clifford Wolf 2013-04-26 14:40:25 +02:00
parent 94744ac7b0
commit 8f2d90de4f

View file

@ -801,10 +801,10 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, std::map<RTLIL::IdStrin
continue; continue;
para_counter++; para_counter++;
std::string para_id = child->str; std::string para_id = child->str;
if (parameters.count(child->str) > 0) { if (parameters.count(para_id) > 0) {
log("Parameter %s = %s\n", child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[child->str]))); log("Parameter %s = %s\n", child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[child->str])));
rewrite_parameter: rewrite_parameter:
para_info += stringf("%s=%s", child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[child->str]))); para_info += stringf("%s=%s", child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[para_id])));
child->delete_children(); child->delete_children();
child->children.push_back(AstNode::mkconst_bits(parameters[para_id].bits, false)); child->children.push_back(AstNode::mkconst_bits(parameters[para_id].bits, false));
hash_data.insert(hash_data.end(), child->str.begin(), child->str.end()); hash_data.insert(hash_data.end(), child->str.begin(), child->str.end());
@ -814,10 +814,8 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, std::map<RTLIL::IdStrin
parameters.erase(para_id); parameters.erase(para_id);
continue; continue;
} }
char buf[100]; para_id = stringf("$%d", para_counter);
snprintf(buf, 100, "$%d", para_counter); if (parameters.count(para_id) > 0) {
if (parameters.count(buf) > 0) {
para_id = buf;
log("Parameter %d (%s) = %s\n", para_counter, child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[para_id]))); log("Parameter %d (%s) = %s\n", para_counter, child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[para_id])));
goto rewrite_parameter; goto rewrite_parameter;
} }