📄 com_max.vhd
字号:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
entity com_max is
port (
MAX_DATA : out STD_LOGIC_VECTOR(7 downto 0);
MIN_DATA : out STD_LOGIC_VECTOR(7 downto 0);
clk : in std_logic;
D_A : in STD_LOGIC_VECTOR(7 downto 0);
D_B : in STD_LOGIC_VECTOR(7 downto 0)
);
end com_max;
architecture compare_arch of com_max is
signal sym_a,sym_b : std_logic;
signal ta ,tb : std_logic_vector(6 downto 0);
begin
sym_a <= d_a(7);
sym_b <= d_b(7);
ta <= d_a(6 downto 0);
tb <= d_b(6 downto 0);
process(clk,ta,tb,sym_a,sym_b)
begin
if rising_edge(clk) then
if sym_a < sym_b then
max_data <= d_a;
min_data <= d_b;
elsif sym_a > sym_b then
max_data <= d_b;
min_data <= d_a;
elsif ((sym_a and sym_b) ='1') then
if ((UNSIGNED(ta) > UNSIGNED(tb)) or ((UNSIGNED(ta) = UNSIGNED(tb)))) then
max_data <= d_b;
min_data <= d_a;
else
max_data <= d_a;
min_data <= d_b;
end if;
elsif ((sym_a or sym_b) ='0') then
if ((UNSIGNED(ta) > UNSIGNED(tb)) or ((UNSIGNED(ta) = UNSIGNED(tb)))) then
max_data <= d_a;
min_data <= d_b;
else
max_data <= d_b;
min_data <= d_a;
end if;
end if;
end if;
end process;
end architecture compare_arch;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -