如何在modelsim中显示波形中的文本

问题描述 投票:0回答:2

我有一个信号

reg [1:0] BRESP
对应于 4 个字符串值:
okay
exokay
slverr
decerr

如何在信号

BRESP
的波形中显示这些值?

verilog modelsim waveform
2个回答
0
投票

在 Modelsim 参考手册中植入

radix define
命令


0
投票

这取决于模拟器。有些具有参数可以检测设计中的 FSM 并在波形上显示 FSM 的状态名称(例如 ModelSim)。 Xilinx ISim 没有此功能(也许它的新版本已经实现了此功能,但我不知道)。

无论你有什么模拟器,我都会提供一个通用的解决方案:

首先定义固定数量的字符来显示州名称。通常 10 个字符就足够了,然后声明 10 x 8 位寄存器来保存这些字符:

reg [3:0] current_state; // Assuming a 4-bit state memory that supports 16 number of states.
reg [3:0] next_state;
reg [10*8-1:0] current_state_text; // 10 x 8-bit registers
reg [10*8-1:0] next_state_text;

always @ (posedge Clock or negedge Reset)
  begin: STATE_MEMORY
    if (!Reset) begin
     current_state <= STATE_RESRT;
     current_state_text <= "*****RESET"; // This text MUST be 10 characters
     // I put starts (*) but you should replace it with 5 spaces 
end 
else 
  current_state <= next_state;
end

// Now every time you want to change the state, change the state text also like above.

在仿真软件内将

current_state_text
next_state_text
信号的基数设置为 ASCII。

© www.soinside.com 2019 - 2024. All rights reserved.