mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 11:26:22 +00:00
Preserve param signedness across overrides.
This commit is contained in:
parent
14dbf70074
commit
ad912bc787
1 changed files with 7 additions and 2 deletions
|
|
@ -1875,8 +1875,13 @@ std::string AstModule::derive_common(RTLIL::Design *design, const dict<RTLIL::Id
|
|||
child->children[0]->realvalue = std::stod(it->second.decode_string());
|
||||
} else if ((it->second.flags & RTLIL::CONST_FLAG_STRING) != 0)
|
||||
child->children[0] = AstNode::mkconst_str(loc, it->second.decode_string());
|
||||
else
|
||||
child->children[0] = AstNode::mkconst_bits(loc, it->second.to_bits(), (it->second.flags & RTLIL::CONST_FLAG_SIGNED) != 0, (it->second.flags & RTLIL::CONST_FLAG_UNSIZED) != 0);
|
||||
else {
|
||||
bool is_signed = child->is_signed;
|
||||
if (!is_signed && !child->children.empty() && child->children[0] && child->children[0]->type == AST_CONSTANT)
|
||||
is_signed = child->children[0]->is_signed;
|
||||
is_signed = is_signed || ((it->second.flags & RTLIL::CONST_FLAG_SIGNED) != 0);
|
||||
child->children[0] = AstNode::mkconst_bits(loc, it->second.to_bits(), is_signed, (it->second.flags & RTLIL::CONST_FLAG_UNSIZED) != 0);
|
||||
}
|
||||
rewritten.insert(it->first);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue