|
|
|

|
|
|
|
|
|

|
|
 |
Modport Expression
|
|
|
A modport expression allows elements of arrays and structures, concatenations of elements, and assignment pattern expressions of elements declared in an interface to be included in a modport list. This modport expression is explicitly named with a port identifier, visible only through the modport connection. |
|
|

|
|
|
One of the best way to use this feature is to use with genvar on modports to make parameterizable interface. Below examples shows exactly same. |
|
|

|
|
|
|
|
|

|
|
 |
Example : Modport Expression
|
|
|

|
|
|
1 // TODO : Complete this example
2 //+++++++++++++++++++++++++++++++++++++++++++++++++
3 // Define the interface
4 //+++++++++++++++++++++++++++++++++++++++++++++++++
5 interface arb_if #(num_agents = 1) (input clk);
6 logic reset;
7 logic [num_agents-1 : 0] req;
8 logic [num_agents-1 : 0] gnt;
9 //=================================================
10 // Modport inside a generate block
11 //=================================================
12 for (genvar i=0; i< num_agents; i++) begin: arb
13 modport arb (input .creq (req[i], clk, reset, output .cgnt (gnt[i]) );
14 modport tb (output .creq (req[i], input clk, reset, .cgnt (gnt[i]) );
15 end
16
17 endinterface
18
19 //+++++++++++++++++++++++++++++++++++++++++++++++++
20 // Testbench Top file
21 //+++++++++++++++++++++++++++++++++++++++++++++++++
22 module interface_modport_expression();
23
24 logic clk = 0;
25 always #1 clk ++;
26
27 arb_if arbif(clk);
28
29 initial begin
30 #100 $finish;
31 end
32
33 endmodule
You could download file interface_modport_expression.sv here
|
|
|

|
|
 |
Simulation : Modport Expression
|
|
|

|
|
|
|
|
|

|
|
|

|
|
|

|
|
|
|
|
|

|
|
|
|
|
|

|
|
Copyright © 1998-2025 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|