SV——Verilog和System Verilog中字面值表示

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/m0_38037810/article/details/102759204

0. 介绍

字面值(literal integer)就是类似5、'h10这种值。

1. syntax

<size>'s<base><value>

  • <size> is optional. If given, it specifies the total number of bits represented by the literal integer. If not given, the default size, per the Verilog/SystemVerilog standard is "at least"32 bits.
  • s is optional. If given, it specifies thatthe literal integer should be treated as a signed value in operations. If not given, the default is unsigned. (The signed specifier wasadded to Verilog as part of the Verilog-200I standard.)
  • <base> is required, and specifies whether the value is in binary, octal, decimal, or hex.
  • <value> is required, andspecifies the literal integer value.

The baseoptions are represented using b, 0, d, or h for binary, octal, decimal andhex,
respectively. The base specifier can be either lowercase or uppercase (i.e. ' h 5
and ' H5 are the same).

2. 符号

Unbased literal integers default to signed. Based literal integers default to unsigned.

比如5,表示有符号的5;'d5表示无符号5.

3. reference

《Verilog and SystemVerilog Gotchas》

猜你喜欢

转载自blog.csdn.net/m0_38037810/article/details/102759204
今日推荐