A An simple interface declaration is declared as follows (see
the Syntax 19-1 for the complete syntax) :
interface <identifier>; <interface_items>
endinterface [: <name> <identifier>]
interface identifier;
...
interface_items
...
endinterface [ : identifier
]
Editor’s Note: This declaration is
greatly generalized from the full BNF, but looks like it is the BNF. Is that a
problem?
module
top;
logic
req, gnt,
start, rdy; // req is logic
not bit here
logic
clk = 0;
logic
[1:0] mode;
logic
[7:0] addr, data;
wire [7:0] data;
memMod mem(req, clk, start, mode, addr, data, gnt, rdy);
cpuMod cpu(clk, gnt, rdy,
data, req, start, addr,
mode);
endmodule
Editor’s Note:
Does “data” also need to change from logic to wire in the top module?
module
omniMod(interface
interface b);
//...
endmodule: omniMod
task
a.Read(input
logic logic [7:0]
raddr); // Read method
if
(raddr >= minaddr
&& raddr <= maxaddr)
begin
avail = 0;
#10 a.data = mem[raddr];
avail = 1;
end
endtask
task
a.Write(input
logic logic [7:0]
waddr); // Write method
if
(waddr >= minaddr
&& waddr <= maxaddr)
begin
avail = 0;
#10 mem[waddr] = a.data;
avail = 1;
end
endtask