Hardware Reference
In-Depth Information
9.3.1.1
Positional Association
In module
m1
below, the actual arguments of the checker are passed according to
the order of the corresponding formal arguments. The default values passed to
n
and
clk
are identified by commas, one comma for each unspecified actual argument.
Were these default arguments the last arguments in the list, there would be no need
for these commas. Positional argument association is really convenient only when
the number of checker arguments is small.
module
m1(
input logic
clk, rst, send, ack, ...);
default clocking
@(
posedge
clk);
endclocking
...
request_granted check(send, ack,,, rst);
endmodule
:m1
9.3.1.2
Explicit Named Association
In module
m2
below, the actual arguments of the checker are passed by an explicit
indication of the formal argument names. In the case of the named association, the
order of the actual arguments is not important. Omitting default values does not
require any additional notation. A named association is convenient when the number
of checker arguments is large, or when the default values are passed to the arguments
in the middle of the argument list.
module
m2(
input logic
clk, rst, send, ack, ...);
default clocking
@(
posedge
clk);
endclocking
...
request_granted check(.rst(rst), .req(send), .gnt(ack));
endmodule
:m2
9.3.1.3
Implicit Named Association
When the names of actual and formal arguments coincide, there is no need to repeat
the argument names. In module
m3
, argument
rst
is passed by implicit named
association.
module
m3(
input logic
clk, rst, send, ack, ...);
default clocking
@(
posedge
clk);
endclocking
...
request_granted check(.rst, .req(send), .gnt(ack));
endmodule
:m3
Search WWH ::
Custom Search