简体   繁体   中英

Verilog: How to declare many reg in generate statement according to genvar i

I want to declare many reg in generate statement according to genvar i. For example, I want to declare reg_0, reg_1, reg_2 ... reg_9 if genvar i = 10 i.

How can I do this?

I think you have to declare them as arrays. My Verilog is a little rusty, but I think something like this should work:

reg [width-1:0] foo [0:i - 1];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM