Make return value of $clog2 signed
authorSylvain Munaut <tnt@246tNt.com>
Sat, 24 Nov 2018 17:49:23 +0000 (18:49 +0100)
committerSylvain Munaut <tnt@246tNt.com>
Sat, 24 Nov 2018 17:49:23 +0000 (18:49 +0100)
As per Verilog 2005 - 17.11.1.

Fixes #708

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
frontends/ast/simplify.cc

index bb4c9735de8b9cabccc89805e7411cc73d11ca1d..55abe165f87b012d13426546f40cb85e8b54d4df 100644 (file)
@@ -1913,7 +1913,7 @@ skip_dynamic_range_lvalue_expansion:;
                                        if (arg_value.bits.at(i) == RTLIL::State::S1)
                                                result = i + 1;
 
-                               newNode = mkconst_int(result, false);
+                               newNode = mkconst_int(result, true);
                                goto apply_newNode;
                        }