Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.40 KB | None | 0 0
  1. library IEEE ;
  2. use IEEE.std_logic_1164.all ;
  3. use IEEE.std_logic_arith.all ;
  4. use IEEE.std_logic_unsigned.all ;
  5.  
  6. entity porovnaj is
  7.     port(in1 : in bit_vector(7 downto 0);
  8.          in2 : in bit_vector(7 downto 0);
  9.          ci : out bit);
  10. end entity porovnaj;
  11.  
  12. architecture porovnavanie of porovnaj is
  13.   begin
  14.  --  ci <= '1' when in1(7) < in2(7);
  15. process (in1,in2)
  16.   begin
  17.     if (in1(7 downto 1)< in2(7 downto 1)) then
  18.       ci <= '1';
  19.     else
  20.       ci <= '0';
  21. end if;
  22. end process;
  23.    
  24.          
  25.  -- if (in1(7) < in2(7)) then
  26.   --    ci<='1';
  27.   --else
  28.    --   ci<='0';
  29.   --end if ;
  30.  
  31. end architecture porovnavanie;
  32.  
  33.   -- testovacia entita
  34. entity TESTT is
  35. end TESTT;
  36.  
  37. -- architektura testovacej entity
  38. architecture testuj of TESTT is
  39.   component porovnaj is
  40.     port(in1 : in bit_vector(7 downto 0);
  41.          in2 : in bit_vector(7 downto 0);
  42.          ci : out bit);
  43. end component porovnaj;
  44.  
  45. signal vstup1, vstup2 : bit_vector(7 downto 0);
  46. signal vystup : bit;
  47. for porovnavaniee : porovnaj use entity work.porovnaj(porovnavanie);
  48.   begin
  49.    
  50. porovnavaniee : porovnaj
  51.   port map(in1=>vstup1, in2=>vstup2, ci=>vystup);
  52.  
  53.   T01 : vstup1 <= "10000001" after 10 ns, "00000001" after 20 ns, "10000001" after 30 ns, "00000001" after 40 ns;
  54.   T02 : vstup2 <= "00000001" after 10 ns, "10000001" after 20 ns, "00000001" after 30 ns, "10000001" after 40 ns;    
  55.  
  56. end architecture testuj;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement