verilator/test_regress/t/t_class_packed.v

37 lines
740 B
Systemverilog
Raw Normal View History

2020-09-25 13:37:38 +02:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2020 Wilson Snyder
2020-09-25 13:37:38 +02:00
// SPDX-License-Identifier: CC0-1.0
2026-03-08 23:26:40 +01:00
module t (
input clk
);
//TODO sub #(.WIDTH(1)) w1();
//TODO sub #(.WIDTH(2)) w2();
//TODO sub #(.WIDTH(3)) w3();
//TODO sub #(.WIDTH(4)) w4();
sub #(.WIDTH(5)) w5 ();
always @(posedge clk) begin
$write("*-* All Finished *-*\n");
$finish;
end
2020-09-25 13:37:38 +02:00
endmodule
module sub ();
2026-03-08 23:26:40 +01:00
parameter WIDTH = 5; // WIDTH >= 5 fails. WIDTH <= 4 passes
2020-09-25 13:37:38 +02:00
2026-03-08 23:26:40 +01:00
typedef struct packed {logic [WIDTH-1:0] data;} [15:0] w_t;
2020-09-25 13:37:38 +02:00
2026-03-08 23:26:40 +01:00
class WrReqQ;
w_t w;
endclass
2020-09-25 13:37:38 +02:00
2026-03-08 23:26:40 +01:00
initial begin
if ($bits(w_t) != WIDTH * 16) $stop;
end
2020-09-25 13:37:38 +02:00
endmodule