英文:
What is the implicit type of a localparam constant?
问题
来自VHDL背景,我对SystemVerilog的隐式声明类型感到有些困惑。例如,在下面的定义中,UNFUSIBLES_RANGE_BYTES
常量的底层类型是什么?
localparam UNFUSIBLES_RANGE_BYTES = 64'd9223372036854773764;
英文:
Coming from a VHDL background, I'm a bit confused about SystemVerilog's implicit declaration typing. For example, in the following definition, what's the underlying type of the UNFUSIBLES_RANGE_BYTES
constant?
localparam UNFUSIBLES_RANGE_BYTES = 64'd9223372036854773764;
答案1
得分: 1
参考IEEE标准1800-2017,第6.20.4节_本地参数(localparam)_:
> 本地参数与参数相同,除了...
"除了"与您的问题无关。因此,请参考第6.20.2节_值参数_。由于您的声明没有类型规范或范围规范,因此适用以下规定:
> 没有类型或范围规范的参数声明应默认为参数分配的最终值的类型和范围,忽略任何值覆盖。如果表达式是实数,则参数是实数。如果表达式是整数,则参数是大小相同且范围为[size-1:0]
的logic
向量。
这意味着UNFUSIBLES_RANGE_BYTES
是一个64位整数logic
向量。
英文:
Refer to IEEE Std 1800-2017, section 6.20.4 Local parameters (localparam):
> Local parameters are identical to parameters except ...
The "except" is irrelevant to your question. So, refer to section 6.20.2 Value parameters. Since your declaration does not have a type specification or a range specification, this applies:
> A parameter declaration with no type or range specification shall
> default to the type and range of the final value assigned to the
> parameter, after any value overrides have been applied. If the
> expression is real, the parameter is real. If the expression is
> integral, the parameter is a logic
vector of the same size with range
> [size-1:0]
.
This means UNFUSIBLES_RANGE_BYTES
is a 64-bit integral logic
vector.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论