localparam常量的隐式类型是什么?

huangapple go评论127阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年3月12日 18:12:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712422.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定