diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-04-26 14:40:25 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-04-26 14:40:25 +0200 |
commit | 8f2d90de4ffa4f0e919078649777a5eeeede6b46 (patch) | |
tree | 0d4a47a6695d9e64b1ed26550e2842909292da44 /frontends | |
parent | 94744ac7b0238048869f04ea36cc35314798a70b (diff) | |
download | yosys-8f2d90de4ffa4f0e919078649777a5eeeede6b46.tar.gz yosys-8f2d90de4ffa4f0e919078649777a5eeeede6b46.tar.bz2 yosys-8f2d90de4ffa4f0e919078649777a5eeeede6b46.zip |
Fixed handling of positional module parameters
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/ast.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index 0bd1ba2e0..2c552ea22 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -801,10 +801,10 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, std::map<RTLIL::IdStrin continue; para_counter++; 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]))); 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->children.push_back(AstNode::mkconst_bits(parameters[para_id].bits, false)); 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); continue; } - char buf[100]; - snprintf(buf, 100, "$%d", para_counter); - if (parameters.count(buf) > 0) { - para_id = buf; + para_id = stringf("$%d", para_counter); + if (parameters.count(para_id) > 0) { log("Parameter %d (%s) = %s\n", para_counter, child->str.c_str(), log_signal(RTLIL::SigSpec(parameters[para_id]))); goto rewrite_parameter; } |