2013-01-15 03:49:22 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
|
|
|
|
// A test case for struct signal bit selection.
|
|
|
|
|
//
|
|
|
|
|
// This test is to check that bit selection of multi-dimensional signal inside
|
|
|
|
|
// of a struct works.
|
|
|
|
|
//
|
2026-01-27 02:24:34 +01:00
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain.
|
|
|
|
|
// SPDX-FileCopyrightText: 2012 Jie Xu
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2013-01-15 03:49:22 +01:00
|
|
|
|
2025-09-13 15:28:43 +02:00
|
|
|
module t;
|
2013-01-15 03:49:22 +01:00
|
|
|
|
2026-03-03 13:21:24 +01:00
|
|
|
typedef struct packed {
|
|
|
|
|
logic [1:0][15:0] channel;
|
|
|
|
|
logic others;
|
|
|
|
|
} buss_t;
|
2013-01-15 03:49:22 +01:00
|
|
|
|
2026-03-03 13:21:24 +01:00
|
|
|
buss_t b;
|
|
|
|
|
reg [7:0] a;
|
2013-01-15 03:49:22 +01:00
|
|
|
|
2026-03-03 13:21:24 +01:00
|
|
|
initial begin
|
|
|
|
|
b = {16'h8765, 16'h4321, 1'b1};
|
|
|
|
|
a = b.channel[0][8+:8];
|
|
|
|
|
if (a != 8'h43) $stop;
|
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
2013-01-15 03:49:22 +01:00
|
|
|
endmodule
|