88,Verilog-2005标准篇:未命名的generate块外部名称

虽然未命名generate块没有可用于层级的名称,但它仍需要有一个名称,以便外部接口可以引用它。为此,系统将自动为每个未命名的generate块分配一个名称。

给定作用域中的每个generate结构体都有一个编号。在该作用域中以文本形式首次出现的结构体的编号为 1,其后每个generate结构体的编号都将增加 1。所有未命名的生成块都将被命名为 “genblk<n>”,其中 <n> 是分配给其外层generate结构体的编号。如果该名称与显式声明的名称相冲突,则会在数字前面加上前导零,直到名称不冲突为止。例如:

module  top;
   parameter  genblk2 = 0;
   genvar  i;
  // The following generate block is implicitly named genblk1
   if (genblk2)  reg  a;  // top.genblk1.a
   else  reg  b;  // top.genblk1.b
  // The following generate block is implicitly named genblk02
  // as genblk2 is already a declared identifier
   if (genblk2)  reg  a;  // top.genblk02.a
   else  reg  b;  // top.genblk02.b
  // The following generate block would have been named genblk3
  // but is explicitly named g1
   for  (i = 0; i < 1; i = i + 1)  begin : g1 // block name
    // The following generate block is implicitly named genblk1
    // as the first nested scope inside of g1
     if (1)  reg  a;  // top.g1[0].genblk1.a
   end
  // The following generate block is implicitly named genblk4 since
  // it belongs to the fourth generate construct in scope "top".
  // The previous generate block would have been
  // named genblk3 if it had not been explicitly named g1
   for  (i = 0; i < 1; i = i + 1)
    // The following generate block is implicitly named genblk1
    // as the first nested generate block in genblk4
     if (1)   reg  a;  // top.genblk4[0].genblk1.a
  // The following generate block is implicitly named genblk5
    if (1)  reg  a;  // top.genblk5.a
endmodule

点赞加关注博主(ID:FPGA小飞)的博文,咱们一起系统学习verilog最终标准IEEE Std 1364-2005吧!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值