3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

Use undef (x/z vs. NaN) rules for real values from IEEE Std 1800-2012

This commit is contained in:
Clifford Wolf 2014-06-16 15:05:37 +02:00
parent 0c4c79c4c6
commit 82bbd2f077
2 changed files with 11 additions and 0 deletions

View file

@ -783,6 +783,8 @@ double AstNode::asReal(bool is_signed)
double v = 0;
for (size_t i = 0; i < val.bits.size(); i++)
// IEEE Std 1800-2012 Par 6.12.2: Individual bits that are x or z in
// the net or the variable shall be treated as zero upon conversion.
if (val.bits.at(i) == RTLIL::State::S1)
v += exp2(i);
if (is_negative)