From 621c51589a948ff31b6376b2262d742a5a82ba6c Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 4 May 2014 08:50:44 -0400 Subject: [PATCH] Fix shift by x, bug760. --- src/V3Const.cpp | 3 +++ test_regress/t/t_math_shift.v | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 559094077..90a4e96c4 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -234,16 +234,19 @@ private: } bool operandHugeShiftL(AstNodeBiop* nodep) { return (nodep->rhsp()->castConst() + && !nodep->rhsp()->castConst()->num().isFourState() && nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->width()) && isTPure(nodep->lhsp())); } bool operandHugeShiftR(AstNodeBiop* nodep) { return (nodep->rhsp()->castConst() + && !nodep->rhsp()->castConst()->num().isFourState() && nodep->rhsp()->castConst()->toUInt() >= (uint32_t)(nodep->lhsp()->width()) && isTPure(nodep->lhsp())); } bool operandIsTwo(AstNode* nodep) { return (nodep->castConst() + && !nodep->castConst()->num().isFourState() && nodep->width() <= VL_QUADSIZE && nodep->castConst()->toUQuad()==2); } diff --git a/test_regress/t/t_math_shift.v b/test_regress/t/t_math_shift.v index 796c7403b..0770fd431 100644 --- a/test_regress/t/t_math_shift.v +++ b/test_regress/t/t_math_shift.v @@ -4,11 +4,14 @@ // without warranty, 2004 by Wilson Snyder. module t (/*AUTOARG*/ + // Outputs + ign, // Inputs clk ); input clk; + output [31:0] ign; reg [31:0] right; reg [31:0] left; @@ -16,6 +19,8 @@ module t (/*AUTOARG*/ reg [63:0] qleft; reg [31:0] amt; + assign ign = {31'h0, clk} >>> 4'bx; // bug760 + always @* begin right = 32'h819b018a >> amt; left = 32'h819b018a << amt;