CASE奇校验码

时间:2015-10-25 17:11:19

标签: case vhdl parity

我是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

谢谢

1 个答案:

答案 0 :(得分:3)

您的信号inputs从未分配给任何内容。在连接过程中需要一条连接输入w,x,y和z的线。如:

inputs <= w & x & y & z;

您还应该将g1_562 <= outputs;移到流程之外。

相关问题