Lect43 How To Create An Interface
Lect43 How To Create An Interface
grant[1:0]
request[1:0]
Arbiter
rst clk
Usage:
Module definition
module arb(arb_if.DUT arb_bus);
or
Instantiation
arb a1 (arb_bus.DUT);
Mixing interface and ordinary ports
Typically only common busses will be encapsulated in an interface
`default_nettype none
`include "arb_if.v"
module test;
bit clk;
bit [7:0] data_in, data_out;
always #5 clk = ~clk;
arb_if arb_bus(clk);
arb arb (.data_in(data_in), arb_bus.DUT,
.data_out(data_out));
endmodule
Simulation Log:
Value of a = 6, b = 4
Sum of a and b, c = 10
Example
Example of named port bundle