2020-12-17 17:26:53 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
2025-08-26 00:47:08 +02:00
|
|
|
// A test that a package import declaration can precede a parameter port list
|
2024-03-02 15:05:21 +01:00
|
|
|
// in an interface declaration. See IEEE 1800-2023 25.3.
|
2020-12-17 17:26:53 +01:00
|
|
|
//
|
2026-01-27 02:24:34 +01:00
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain.
|
|
|
|
|
// SPDX-FileCopyrightText: 2013 Jeremy Bennett
|
2020-12-17 17:26:53 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
|
|
|
|
|
package bus_pkg;
|
|
|
|
|
parameter WIDTH = 8;
|
|
|
|
|
endpackage
|
|
|
|
|
|
|
|
|
|
interface simple_bus
|
2026-03-08 23:26:40 +01:00
|
|
|
import bus_pkg::*; // Import preceding parameters.
|
|
|
|
|
#(
|
|
|
|
|
p_width = WIDTH
|
|
|
|
|
) (
|
|
|
|
|
input logic clk
|
|
|
|
|
);
|
2020-12-17 17:26:53 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
logic req, gnt;
|
|
|
|
|
logic [p_width-1:0] addr;
|
|
|
|
|
logic [p_width-1:0] data;
|
2020-12-17 17:26:53 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
modport slave(input req, addr, clk, output gnt, input data);
|
2020-12-17 17:26:53 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
modport master(input gnt, clk, output req, addr, output data);
|
2020-12-17 17:26:53 +01:00
|
|
|
|
|
|
|
|
endinterface
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module mem (
|
|
|
|
|
simple_bus a
|
|
|
|
|
);
|
|
|
|
|
logic avail;
|
|
|
|
|
always @(posedge a.clk) a.gnt <= a.req & avail;
|
|
|
|
|
initial begin
|
|
|
|
|
if ($bits(a.data) != 8) $stop;
|
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
2020-12-17 17:26:53 +01:00
|
|
|
endmodule
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module t (
|
|
|
|
|
input clk
|
|
|
|
|
);
|
|
|
|
|
simple_bus sb (clk);
|
|
|
|
|
mem mem (sb.slave);
|
2020-12-17 17:26:53 +01:00
|
|
|
endmodule
|