Fixed constant "cond ? string1 : string2" with strings of different size
authorClifford Wolf <clifford@clifford.at>
Sat, 25 Oct 2014 16:23:53 +0000 (18:23 +0200)
committerClifford Wolf <clifford@clifford.at>
Sat, 25 Oct 2014 16:23:53 +0000 (18:23 +0200)
frontends/ast/ast.cc

index 7a7bd30389f33e71b9b2a1817df8acf6ca34a184..56ea64effd43ddc530a709adec8c54a88066e394 100644 (file)
@@ -706,6 +706,8 @@ AstNode *AstNode::mkconst_bits(const std::vector<RTLIL::State> &v, bool is_signe
 AstNode *AstNode::mkconst_str(const std::vector<RTLIL::State> &v)
 {
        AstNode *node = mkconst_str(RTLIL::Const(v).decode_string());
+       while (GetSize(node->bits) < GetSize(v))
+               node->bits.push_back(RTLIL::State::S0);
        log_assert(node->bits == v);
        return node;
 }