?? compare.vhd
字號:
--** 比 較 器 **--
--文件名:compare.vhd
--功 能:比較兩組數(shù)據(jù)的大小
--說 明:以撥盤開關作為數(shù)據(jù)輸入端,用發(fā)光二極管來表示兩組數(shù)據(jù)的大小,
-- 當左邊的數(shù)據(jù)>右邊的數(shù)據(jù)時左邊的四位發(fā)光二極管亮;
-- 當右邊的數(shù)據(jù)>左邊的數(shù)據(jù)時右邊的四位發(fā)光二極管亮;
-- 當左邊的數(shù)據(jù)=右邊的數(shù)據(jù)時發(fā)光二極管全亮;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity compare is
Port (datain : in std_logic_vector(7 downto 0); --高四位和低四位比較
cs : out std_logic_vector(1 downto 0); --數(shù)碼管、發(fā)光二極管片選信號;
dataout: out std_logic_vector(7 downto 0));
end compare;
architecture Behavioral of compare is
begin
cs<="01"; --選通發(fā)光二極管;
process(datain)
begin
if datain(3 downto 0)>datain(7 downto 4) then
dataout<="00001111";
elsif datain(3 downto 0)=datain(7 downto 4) then
dataout<="00000000";
else dataout<="11110000";
end if;
end process;
end Behavioral;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -