verilator/test_regress/t/t_interface_param2.v

50 lines
1.1 KiB
Systemverilog
Raw Normal View History

2016-12-22 02:00:40 +00:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2016 by Adrian Wise
//bug1104
module t (input clk);
simple_bus sb_intf(clk);
simple_bus #(.DWIDTH(16)) wide_intf(clk);
mem mem(sb_intf.slave);
cpu cpu(sb_intf.master);
mem memW(wide_intf.slave);
cpu cpuW(wide_intf.master);
endmodule
interface simple_bus #(AWIDTH = 8, DWIDTH = 8)
2018-11-26 23:22:20 +00:00
(input logic clk); // Define the interface
2016-12-22 02:00:40 +00:00
logic req, gnt;
logic [AWIDTH-1:0] addr;
logic [DWIDTH-1:0] data;
modport slave( input req, addr, clk,
2018-11-26 23:22:20 +00:00
output gnt,
input data);
2016-12-22 02:00:40 +00:00
modport master(input gnt, clk,
2018-11-26 23:22:20 +00:00
output req, addr,
output data);
2016-12-22 02:00:40 +00:00
2018-11-26 23:22:20 +00:00
initial begin
if (DWIDTH != 16) $stop;
end
2016-12-22 02:00:40 +00:00
endinterface: simple_bus
module mem(interface a);
logic avail;
always @(posedge a.clk)
a.gnt <= a.req & avail;
initial begin
2018-11-26 23:22:20 +00:00
if ($bits(a.data) != 16) $stop;
2016-12-22 02:00:40 +00:00
$write("*-* All Finished *-*\n");
$finish;
end
endmodule
module cpu(interface b);
endmodule