2015-02-12 00:46:19 +00:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Iztok Jeras.
2015-02-12 12:47:45 +00:00
`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)
2015-02-12 00:46:19 +00:00
2015-02-12 12:47:45 +00:00
module t ( /*AUTOARG*/ ) ;
2015-02-12 00:46:19 +00:00
// signed source
logic signed [ 8 - 1 : 0 ] src ;
// destination structure
struct packed {
logic signed [ 16 - 1 : 0 ] s ;
logic unsigned [ 16 - 1 : 0 ] u ;
} dst ;
initial begin
2015-02-12 12:47:45 +00:00
// bug882
2015-02-12 00:46:19 +00:00
// verilator lint_off WIDTH
src = 8 ' sh05 ;
dst = ' { s: src , u: src } ;
2015-02-12 12:47:45 +00:00
`checkh ( dst . s , 16 'h0005 ) ;
2015-02-12 00:46:19 +00:00
`checkh ( dst . u , 16 'h0005 ) ;
src = 8 ' shf5 ;
dst = ' { s: src , u: src } ;
2015-02-12 12:47:45 +00:00
`checkh ( dst . s , 16 'hfff5 ) ;
2015-02-12 00:46:19 +00:00
`checkh ( dst . u , 16 'hfff5 ) ;
// verilator lint_on WIDTH
$write ( " *-* All Finished *-* \n " ) ;
$finish ;
end
endmodule