【问题标题】:CASE odd parity checkerCASE奇校验检查器
【发布时间】:2015-10-25 17:11:18
【问题描述】:

我是 vhdl 的新手,正在尝试在进程中使用 Case 编写 vhdl 奇校验检查器。当我编译时没有错误,但输出的输出矢量波形由于某种原因是平坦的。我究竟做错了什么?有人可以帮助我或为我指明正确的方向吗?还有其他方法吗?

这是我的代码:

library ieee;
use ieee.std_logic_1164.all;

entity test3 is 
port (
    w, x, y, z  : in std_logic;
    g1_562      : out std_logic);       
end entity test3;

architecture sig of test3 is

signal inputs : std_logic_vector(3 downto 0);
signal outputs: std_logic;
begin  

process(inputs) is
begin
case inputs is
    when "0000" => outputs <= '1';
    when "0011" => outputs <= '1';
    when "0101" => outputs <= '1';
    when "0110" => outputs <= '1';
    when "1001" => outputs <= '1';
    when "1010" => outputs <= '1';
    when "1100" => outputs <= '1';
    when "1111" => outputs <= '1';
    when others => outputs <= '0';
    g1_562 <= outputs;  
end case;
end process;
end architecture sig;

输出为:0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

但应该是:1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1

谢谢

【问题讨论】:

  • 当您驱动 w、x、y 和 z 时,信号输入会发生什么情况?
  • 仔细查看 g1_562 的分配。什么时候执行?另请阅读有关在分配后何时更新诸如输出之类的信号。
  • g1_562 被分配了outputs 的当前值。当任何进程的执行处于挂起状态时,信号值永远不会更新。相反,信号有一个投影输出波形,它可以为当前仿真时间安排更新(假定没有时间表达式after 0 fs),这将确保使用@ 的新值执行增量循环987654325@ 可用。解决方案是将g1_562 分配移到此进程之外(如使其成为并发信号分配)。
  • 感谢提示,已解决!

标签: case vhdl parity


【解决方案1】:

您的信号inputs 永远不会分配给任何东西。您需要在连接输入 w、x、y 和 z 的过程之外有一行。如:

inputs <= w & x & y & z;

您还应该将g1_562 &lt;= outputs; 移出进程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 2015-06-29
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多