3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-04 02:10:24 +00:00

improved (fixed) conversion of real values to bit vectors

This commit is contained in:
Clifford Wolf 2014-06-14 20:38:05 +02:00
parent 39eb347c67
commit 149fe83a8d
4 changed files with 30 additions and 11 deletions

View file

@ -915,10 +915,10 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
case AST_REALVALUE:
{
int intvalue = round(realvalue);
log("Warning: converting real value %e to integer %d at %s:%d.\n",
realvalue, intvalue, filename.c_str(), linenum);
return RTLIL::SigSpec(intvalue);
RTLIL::SigSpec sig = realAsConst(width_hint);
log("Warning: converting real value %e to binary %s at %s:%d.\n",
realvalue, log_signal(sig), filename.c_str(), linenum);
return sig;
}
// simply return the corresponding RTLIL::SigSpec for an AST_IDENTIFIER node