More fixes in ternary op sign handling
authorClifford Wolf <clifford@clifford.at>
Fri, 12 Jul 2013 11:13:04 +0000 (13:13 +0200)
committerClifford Wolf <clifford@clifford.at>
Fri, 12 Jul 2013 11:13:04 +0000 (13:13 +0200)
frontends/ast/genrtlil.cc
tests/simple/vloghammer.v

index a9574254dac33640301cfa0056587cbdf7d4706e..e7ceec5f9d277372cc38ef0765dece1d4c358ed1 100644 (file)
@@ -998,6 +998,9 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
        // generate multiplexer for ternary operator (aka ?:-operator)
        case AST_TERNARY:
                {
+                       if (width_hint < 0)
+                               detectSignWidth(width_hint, sign_hint);
+
                        RTLIL::SigSpec cond = children[0]->genRTLIL();
                        RTLIL::SigSpec val1 = children[1]->genRTLIL(width_hint, sign_hint);
                        RTLIL::SigSpec val2 = children[2]->genRTLIL(width_hint, sign_hint);
index c97a2be50b71c74b179fb32a969db4c16123d564..fffa3505081e8930224487731f5e8692a736d096 100644 (file)
@@ -65,3 +65,11 @@ module test09(a, b, c, y);
   assign y = a ? b : c;
 endmodule
 
+module test10(a, b, c, y);
+  input a;
+  input signed [1:0] b;
+  input signed [2:0] c;
+  output y;
+  assign y = ^(a ? b : c);
+endmodule
+