Fix sign extension of pattern members, bug882.

This commit is contained in:
Wilson Snyder
2015-02-12 07:47:45 -05:00
parent 108c0f6bb8
commit 052a7e3deb
3 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -3,9 +3,9 @@
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Iztok Jeras.
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); end while(0)
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while(0)
module t (/*AUTOARG*/);
module t (/*AUTOARG*/);
// signed source
logic signed [8-1:0] src;
@@ -17,13 +17,16 @@ module t (/*AUTOARG*/);
} dst;
initial begin
// bug882
// verilator lint_off WIDTH
src = 8'sh05;
dst = '{s: src, u: src};
`checkh (dst.s, 16'h0005);
`checkh (dst.u, 16'h0005);
src = 8'shf5;
dst = '{s: src, u: src};
`checkh (dst.s, 16'hfff5);
`checkh (dst.u, 16'hfff5);
// verilator lint_on WIDTH