Looking up modport drivers from their loads #1522
-
|
Following on from #1510, I can now access the drivers for output modports of an interface. What I am pondering is how to go about identifying uses of these outputs. For ports, it is straightforward because you can just look up the drivers via the In the example from the issue: modport Then, What I want to be able to do is look up the driver of My thinking so far is to follow the interface connection to the instance as in Any pointers appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
|
If you operate on the underlying variable instead of the modport port I think this becomes much easier, since the drivers get propagated to the variable symbol. The modport itself is sort of a fiction that exists only to translate the lookups; you can have modports with explicit ports that don't actually exist as underlying symbols, like e.g. interface I;
logic a, b;
modport m(input .foo({a, b}));
endinterface
module n(I.m i);
assign x = i.foo[0];
endmodule
module top;
I i();
assign i.a = 1;
n n1(i);
endmoduleIn this case there's no good way to know that the driver of |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @MikePopoloski, that's super useful. |
Beta Was this translation helpful? Give feedback.
-
|
Having played around with this a bit more, I still can't quite achieve what I want to. (Or maybe I'm still taking the wrong approach...) I take your point about operating on the interface variables rather than the modports, but I still can't see a straightforward way to go from a lsp / hierarchical expression (whether it be an lvalue or rvalue) and use that to resolve to the corresponding interface member variables without recursing through the modport connection expressions. The |
Beta Was this translation helpful? Give feedback.
-
|
Sorry to drag this question out! But, going back to your previous comment regarding the connection expression in the modport port (
I must be missing something, but I can't see how the driver tracker resolves the bit positions of This same thing applies generally to connection expressions in port hookups and in assignments to/from concatenations. So how is it handled? |
Beta Was this translation helpful? Give feedback.
After looking at this more and fixing a few things, I believe the case with concatenations is now handled "correctly". The LRM is completely silent about how this is supposed to work and most tools I've tried don't support modport expressions at all or are riddled with bugs so there's not really a consensus anyway.
Modport expressions that are assignment pattern lvalues still don't count as an LSP themselves in slang (I can't figure out how that should even really work) so a write to such a modport port still counts as driving all of the members of the assignment pattern expression, even if the write expression includes some kind of selector that would exclude some of them.
This stuff is …