fpga 简单编解码器的设计,我用VHDL,Quartus,拜托各位大侠了 5
2个回答
展开全部
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY encoder IS
PORT(input : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
y : OUT STD_LOGIC_VECTOR(2 DOWNTO 0));
END encoder;
ARCHITECTURE rtl OF encoder IS
BEGIN
PROCESS(input)
BEGIN
CASE input IS
WHEN “01111111”=>y<=“111”;
WHEN “10111111”=>y<=“110”;
WHEN “11011111”=>y<=“101”;
WHEN “11101111”=>y<=“100”;
WHEN “11110111”=>y<=“011”;
WHEN “11111011”=>y<=“010”;
WHEN “11111101”=>y<=“001”;
WHEN “11111110”=>y<=“000”;
WHEN OTHERS=>y<=“XXX”;
END CASE;
END PROCESS;
END rtl;
USE ieee.std_logic_1164.all;
ENTITY encoder IS
PORT(input : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
y : OUT STD_LOGIC_VECTOR(2 DOWNTO 0));
END encoder;
ARCHITECTURE rtl OF encoder IS
BEGIN
PROCESS(input)
BEGIN
CASE input IS
WHEN “01111111”=>y<=“111”;
WHEN “10111111”=>y<=“110”;
WHEN “11011111”=>y<=“101”;
WHEN “11101111”=>y<=“100”;
WHEN “11110111”=>y<=“011”;
WHEN “11111011”=>y<=“010”;
WHEN “11111101”=>y<=“001”;
WHEN “11111110”=>y<=“000”;
WHEN OTHERS=>y<=“XXX”;
END CASE;
END PROCESS;
END rtl;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询