我最近在Verilog代码中找到了这样的代码,我指的是编写有限状态机.
reg [15:0]Bus;
Bus=zzzzzzzzzzzz1111;
Run Code Online (Sandbox Code Playgroud)
这是什么意思z
?
从IEEE Std 1800-2012,"6.3.1逻辑值"部分:
z-表示高阻抗状态
The SystemVerilog value set consists of the following four basic values:
0—represents a logic zero or a false condition
1—represents a logic one or a true condition
x—represents an unknown logic value
z—represents a high-impedance state
The values 0 and 1 are logical complements of one another.
Run Code Online (Sandbox Code Playgroud)
Z 代表高阻抗状态,但您为什么要那样呢?
这基本上意味着您没有驱动总线的输出,因此其他东西可以驱动它。
您最有可能在驱动设备的输出端口时使用它,例如 FPGA 正在与另一个使用 I2C 协议的芯片通信,您发送读取请求,然后在总线上驱动 Z 以允许设备响应您请求的数据