FavoriteLoading
0

Range must be bounded by constant expressions.错误的解决办法

在Verilog语言中,不允许在冒号前后都出现变量。比如我们有一个变量i,我们需要取出从i*8+7到i*8这8位数据,直接写[i*8+7:i*8]是会报错的。正确的写法是:

[8*i+7 -: 8]

编程规范是:

logic [15:0] down_vect;
logic [0:15] up_vect;
down_vect[lsb_base_expr +: width_expr]
up_vect[msb_base_expr +: width_expr]
down_vect[msb_base_expr -: width_expr]
up_vect[lsb_base_expr -: width_expr]

参考:
http://bbs.eetop.cn/thread-398143-1-1.html
https://verificationacademy.com/forums/systemverilog/range-must-be-bounded-constant-expressions