mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-28 16:53:45 +02:00
By adding ivtest to the iverilog source tree, it is easier to keep the regression test synchronized with the source that is being tested. This should be especially helpful for PRs that add a new feature, and have a matching ivtest PR with the regression test for that feature.
28 lines
799 B
Verilog
28 lines
799 B
Verilog
// This tests system functions available for packed structures
|
|
//
|
|
// This file ONLY is placed into the Public Domain, for any use,
|
|
// without warranty, 2012 by Iztok Jeras.
|
|
|
|
module test;
|
|
|
|
typedef struct packed {
|
|
logic [7:0] high;
|
|
logic [7:0] low;
|
|
} word_t;
|
|
|
|
// Declare word0 as a VARIABLE
|
|
word_t word0;
|
|
|
|
// error counter
|
|
bit err = 0;
|
|
|
|
initial begin
|
|
if ($bits(word0 ) !== 16) begin $display("FAILED -- $bits(word0 ) = %d", $bits(word0 )); err=1; end
|
|
if ($bits(word0.high) !== 8) begin $display("FAILED -- $bits(word0.high) = %d", $bits(word0.high)); err=1; end
|
|
if ($bits(word0.low ) !== 8) begin $display("FAILED -- $bits(word0.low ) = %d", $bits(word0.low )); err=1; end
|
|
|
|
if (!err) $display("PASSED");
|
|
end
|
|
|
|
endmodule // test
|