Fixed the fix for propagation of width hints for $signed() and $unsigned()
authorClifford Wolf <clifford@clifford.at>
Thu, 7 Nov 2013 02:01:28 +0000 (03:01 +0100)
committerClifford Wolf <clifford@clifford.at>
Thu, 7 Nov 2013 02:01:28 +0000 (03:01 +0100)
frontends/ast/genrtlil.cc

index ce34f708abf93e492842f1d3a4b15a472283fd37..0fde9b3b98021c61f6b71cb0894fd80f27d9f680 100644 (file)
@@ -947,13 +947,12 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                        return sig;
                }
 
-       // just pass thru the signal. the parent will evaluated the is_signed property and inperpret the SigSpec accordingly
+       // just pass thru the signal. the parent will evaluate the is_signed property and inperpret the SigSpec accordingly
        case AST_TO_SIGNED:
        case AST_TO_UNSIGNED: {
-                       int sub_width_hint;
-                       bool sub_sign_hint;
-                       children[0]->detectSignWidth(sub_width_hint, sub_sign_hint);
-                       RTLIL::SigSpec sig = children[0]->genRTLIL(width_hint, sub_sign_hint);
+                       RTLIL::SigSpec sig = children[0]->genRTLIL();
+                       if (sig.width < width_hint)
+                               sig.extend(width_hint, sign_hint);
                        is_signed = sign_hint;
                        return sig;
        }