summaryrefslogtreecommitdiff
path: root/frontends/ast/genrtlil.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-08-14 23:14:47 +0200
committerClifford Wolf <clifford@clifford.at>2014-08-14 23:14:47 +0200
commit978a933b6af8863200096bd3a56780e3378e4848 (patch)
treeb6f2dbb89c50c3f6c35098aa8ecff4c20675a52f /frontends/ast/genrtlil.cc
parentc83b9904582b81e71c4c510ffdc26f9796f5da21 (diff)
Added RTLIL::SigSpec::to_sigbit_map()
Diffstat (limited to 'frontends/ast/genrtlil.cc')
-rw-r--r--frontends/ast/genrtlil.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index 24251486..3c8f1fa1 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -400,10 +400,7 @@ struct AST_INTERNAL::ProcessGenerator
case AST_ASSIGN_EQ:
case AST_ASSIGN_LE:
{
- std::map<RTLIL::SigBit, RTLIL::SigBit> new_subst_rvalue_map;
- for (int i = 0; i < SIZE(subst_rvalue_to); i++)
- new_subst_rvalue_map[subst_rvalue_from[i]] = subst_rvalue_to[i];
-
+ std::map<RTLIL::SigBit, RTLIL::SigBit> new_subst_rvalue_map = subst_rvalue_from.to_sigbit_map(subst_rvalue_to);
RTLIL::SigSpec unmapped_lvalue = ast->children[0]->genRTLIL(), lvalue = unmapped_lvalue;
RTLIL::SigSpec rvalue = ast->children[1]->genWidthRTLIL(lvalue.size(), &new_subst_rvalue_map);
lvalue.replace(subst_lvalue_from, subst_lvalue_to);
@@ -421,10 +418,7 @@ struct AST_INTERNAL::ProcessGenerator
case AST_CASE:
{
- std::map<RTLIL::SigBit, RTLIL::SigBit> new_subst_rvalue_map;
- for (int i = 0; i < SIZE(subst_rvalue_to); i++)
- new_subst_rvalue_map[subst_rvalue_from[i]] = subst_rvalue_to[i];
-
+ std::map<RTLIL::SigBit, RTLIL::SigBit> new_subst_rvalue_map = subst_rvalue_from.to_sigbit_map(subst_rvalue_to);
RTLIL::SwitchRule *sw = new RTLIL::SwitchRule;
sw->signal = ast->children[0]->genWidthRTLIL(-1, &new_subst_rvalue_map);
current_case->switches.push_back(sw);
@@ -478,9 +472,7 @@ struct AST_INTERNAL::ProcessGenerator
else if (node->type == AST_BLOCK)
processAst(node);
else {
- std::map<RTLIL::SigBit, RTLIL::SigBit> new_subst_rvalue_map;
- for (int i = 0; i < SIZE(subst_rvalue_to); i++)
- new_subst_rvalue_map[subst_rvalue_from[i]] = subst_rvalue_to[i];
+ std::map<RTLIL::SigBit, RTLIL::SigBit> new_subst_rvalue_map = subst_rvalue_from.to_sigbit_map(subst_rvalue_to);
current_case->compare.push_back(node->genWidthRTLIL(sw->signal.size(), &new_subst_rvalue_map));
}
}