如何在测试台上检查状态机案例

发布于 2025-01-24 07:37:30 字数 365 浏览 0 评论 0原文

我正在为SPI奴隶和Wishbone巴士编写代码。问题在于,TestBench文件正确显示了所有信号(在TestBench中使用的信号和端口),但是当我试图在主代码中检查状态计算机时,它没有显示任何红线。我试图定义输出端口并将状态分配给它,它不起作用,因为我不知道如何将输出端口作为字符串制作,因为状态是这样,

TYPE wb_state_t IS
  (
    WB_IDLE,
    WB_WRITE,
    WB_READ,
    WB_FINISH
  );

SIGNAL   wb_state : wb_state_t;

我想分配wb_state到输出端口,以便我可以在测试台中检查状态。 我该怎么做?

I am writing a code for spi slave and wishbone bus. The issue is that the testbench file shows all the signals correctly (the signals and ports that are used in testbench) but when I am trying to check the state machine in the main code it shows nothing red line. I tried to define an output port and assign the state to it, it did not work because I don't know how to make an output port as a string because the state is like this

TYPE wb_state_t IS
  (
    WB_IDLE,
    WB_WRITE,
    WB_READ,
    WB_FINISH
  );

SIGNAL   wb_state : wb_state_t;

I want to assign wb_state to an output port so I can check the state in the testbench.
How can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

追风人 2025-01-31 07:37:30

当您在评论中阅读时,我只需要制作一个简单的软件包,然后将状态机壳放入其中,然后将其称为顶级和TestBench文件。

Library IEEE;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
    package wb_state_machine is 
             TYPE wb_state_t IS
      (
        WB_IDLE,
        WB_WRITE,
        WB_READ,
        WB_FINISH
      );
      end package;

As you read in the comments, I only needed to make a simple package and put the state machine cases in it and call it in both the top level and the testbench files.

Library IEEE;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
    package wb_state_machine is 
             TYPE wb_state_t IS
      (
        WB_IDLE,
        WB_WRITE,
        WB_READ,
        WB_FINISH
      );
      end package;
写下不归期 2025-01-31 07:37:30

大量模拟器能够显示内部信号。例如,在Vivado或Questa上,您可以在Wave页面上单击设计名称。然后,您发出信号并在波浪和重新模拟上滑动

lot of simulator are able to display internal signal. for instance on vivado or Questa you can click on the design name when you are on the waves page. Then you take your signal and slide it on waves and rerun simulation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文