格雷码转自然码的VHDL实现
library IEEE;
use IEEE.std_logic_1164.all;
entity grey2norm is
generic (width: integer := 8);
port (
grey: in std_logic_vector(width - 1 downto 0);
norm: out std_logic_vector(width - 1 downto 0)
);
end grey2norm;
architecture behav of grey2norm is
begin
process(grey)
variable temp : std_logic;
begin
for i in width-1 downto 0 loop
temp := '0';
for j in width-1 downto i loop
temp := temp xor grey(j);
end loop;
norm(i) <= temp ;
end loop;
end process;
end behav;
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。