格雷码转自然码的VHDL实现
发布时间:2008/5/28 0:00:00 访问次数:619
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;
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;
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;
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;
上一篇:PLC的英文全称是什么
上一篇:PLC与FIELD BUS