⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 com_max_out_user.vhd

📁 FIFO和计数器以及时钟控制
💻 VHD
字号:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;

entity com_max_out_user is
  port (
    MAX_DATA : out STD_LOGIC_VECTOR(7 downto 0);
    max_usr : out STD_LOGIC_VECTOR(2 downto 0);
	usr_a : in STD_LOGIC_VECTOR(2 downto 0);
	usr_b : in STD_LOGIC_VECTOR(2 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_out_user ;

architecture compare_arch of com_max_out_user 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;
   max_usr <= usr_a;
elsif sym_a > sym_b then
  max_data <= d_b;
  max_usr <= usr_b;
elsif ((sym_a and sym_b) ='1') then
   if ((UNSIGNED(ta) > UNSIGNED(tb)) or ((UNSIGNED(ta) = UNSIGNED(tb)))) then
     max_data <= d_b;
     max_usr <= usr_b;
   else
     max_data <= d_a;
     max_usr <= usr_a;
   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;
     max_usr <= usr_a;
   else
     max_data <= d_b;
     max_usr <= usr_b;
   end if;
end if;
end if;
end process; 
end architecture compare_arch;  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -