2019-11-08 00:15:55 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
|
|
|
|
// This file ONLY is placed into the Public Domain, for any use,
|
|
|
|
|
// without warranty, 2017 by Johan Bjork.
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2019-11-08 00:15:55 +01:00
|
|
|
|
|
|
|
|
interface simple_bus #(PARAMETER = 0);
|
2025-04-02 15:43:12 +02:00
|
|
|
typedef struct packed {
|
|
|
|
|
logic [31:0] data;
|
|
|
|
|
logic [3:0] mask;
|
|
|
|
|
} payload_t;
|
|
|
|
|
|
2025-08-30 00:33:14 +02:00
|
|
|
parameter [6:0] DUMMY = 22;
|
2025-04-02 15:43:12 +02:00
|
|
|
payload_t payload;
|
|
|
|
|
logic [1:0] x;
|
2019-11-08 00:15:55 +01:00
|
|
|
endinterface
|
|
|
|
|
|
|
|
|
|
module t ();
|
|
|
|
|
simple_bus sb_intf();
|
2025-04-02 15:43:12 +02:00
|
|
|
localparam LP = $bits(sb_intf.payload.data);
|
2025-08-30 00:33:14 +02:00
|
|
|
simple_bus #(.PARAMETER($bits(sb_intf.DUMMY))) simple();
|
2025-04-02 15:43:12 +02:00
|
|
|
simple_bus #(.PARAMETER($bits(sb_intf.x))) simple2();
|
2019-11-08 00:15:55 +01:00
|
|
|
initial begin
|
2025-04-02 15:43:12 +02:00
|
|
|
if (LP != 32) $stop;
|
2019-11-08 00:15:55 +01:00
|
|
|
if (simple.PARAMETER != 7) $stop;
|
2025-04-02 15:43:12 +02:00
|
|
|
if (simple2.PARAMETER != 2) $stop;
|
2019-11-08 00:15:55 +01:00
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
|
|
|
|
endmodule
|