Can you have a generic virtual interface?
A customer asked me whether you have a generic virtual interface, which could point at any kind of interface? eg
virtual interface vif;
instead of
virtual APB_if vif;
I would be nice perhaps. And you'd think it might be possible, because generic interface ports are possible. (See IEEE 1800-2017, section 25.3.3).
However, this is one of those questions that I realise I know the answer to as soon as I try to start answering it.
However, this is one of those questions that I realise I know the answer to as soon as I try to start answering it.
virtual APB_if vif;
is actually short for
virtual interface APB_if vif;
(ie the "interface" is optional). So, because of that,
virtual interface vif;
is clearly nonsense. IEEE 1800-2017, section 25.9 shows the syntax of a virtual interface:
virtual [ interface ] interface_identifier [ parameter_value_assignment ] [ . modport_identifier ]
interface I;
bit b;
endinterface
module M;
I i ();
// This line is NG:
//virtual interface vif1 = i;
// but these two are OK:
virtual I vif2 = i;
virtual interface I vif3 = i;
endmodule
https://www.edaplayground.com/x/6LXr
A customer asked me about this. I didn't know the answer, so I wrote a few lines of code on EDA Playground. EDA Playground is great for that, because it's always on. You don't have to queue for licences, wait for EDA tools to start, create new files, fire up editors...
virtual [ interface ] interface_identifier [ parameter_value_assignment ] [ . modport_identifier ]
interface I;
bit b;
endinterface
module M;
I i ();
// This line is NG:
//virtual interface vif1 = i;
// but these two are OK:
virtual I vif2 = i;
virtual interface I vif3 = i;
endmodule
https://www.edaplayground.com/x/6LXr
A customer asked me about this. I didn't know the answer, so I wrote a few lines of code on EDA Playground. EDA Playground is great for that, because it's always on. You don't have to queue for licences, wait for EDA tools to start, create new files, fire up editors...
Comments
Post a Comment