Answer:
1. Following is an example of using a parameterized virtual interface with
legal or illegal assignments which works as mentioned(in comments/LRM)
in VCS:
-------------------------------------------------------------------------------
interface PBus #(WIDTH=8); // A parameterized bus interface
logic req, grant;
logic [WIDTH-1:0] addr, data;
modport phy(input addr, ref data);
endinterface
module top;
PBus #(16) p16();
PBus #(32) p32();
virtual PBus V8;
virtual PBus #(35) V35;
virtual PBus #(16) v16;
virtual PBus #(16).phy v16_phy;
virtual PBus #(32) v32;
virtual PBus #(32).phy v32_phy;
initial begin
//following is legal as parameter values match
v16 = p16;
//following is legal as parameter values match
v32 = p32;
//following is illegal as parameter values do not match
//v16 = p32;
//following is illegal as parameter values do not match
//v16 = v32;
//following is a legal assignment from no selected modport
//to selected modport
v16_phy = v16;
//following is an illegal assignment from selected modport
//to no selected modport
//v16 = v16_phy;
//following is a legal assignment from no selected modport
//to selected modport
v32_phy = p32;
//to no selected modport
//v32 = p32.phy;
end
endmodule
--------------------------------------------------------------------------------
2. Following is an example of virtual interface being used as a type parameter
of a parameterized class, which is supported by VCS:
--------------------------------------------------------------------------------
interface PBus #(WIDTH=8); // A parameterized bus interface
logic req, grant;
logic [WIDTH-1:0] addr, data;
modport phy(input addr, ref data);
endinterface
module top;
PBus #(16) p16();
PBus #(32) p32();
prog pg(p16);
endmodule
program prog(interface I);
//Parameter can be overridden at type declaration if required
class cls#(type Tp = virtual PBus #(16));
Tp vpbus;
function new;
// need to assign a proper interface instance depending on the
//parameter value being overridden
vpbus = I;
endfunction
endclass
endprogram
How does VCS support parameterized virtual interface?
最新推荐文章于 2022-10-19 23:38:31 发布
本文通过具体示例深入探讨了虚拟接口在参数化中的应用,包括使用虚拟接口作为参数化的类型参数以及如何在参数化类中利用虚拟接口。详细解释了合法与非法的赋值操作,并展示了如何在不同参数化模块之间进行赋值。
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
ACE-Step
音乐合成
ACE-Step
ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言
1551

被折叠的 条评论
为什么被折叠?



