Verilog: what does begin followed by colon and a variable mean

时光总嘲笑我的痴心妄想 提交于 2021-01-06 11:57:32

问题


What does data_mux mean here? Is it just a name for the block?

if ((PORT_CONFIG == "32") && (P0 == 1'b1))
begin : data_mux
...
end

回答1:


These are block names. Especially useful with generate blocks. For example you can define a generate block such as

genvar i;
generate (for i = 0; i<10; i++)
begin : structures
    reg my_reg;
    // ...
    .. other block descriptions
    // ...
end
endgenerate

Then you can access the block elements later like

structures[3].my_reg <= 1'b1;



回答2:


Yes, it is just the name for the begin/end block. Refer to the free IEEE Std 1800-2012 (section 9.3.4 Block names). In most cases the block label is optional.



来源:https://stackoverflow.com/questions/41990552/verilog-what-does-begin-followed-by-colon-and-a-variable-mean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!