Guest User

Untitled

a guest
Nov 27th, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.08 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3.  
  4. entity cmp2 is
  5.         port (
  6.           clk : in std_logic; -- тактовый сигнал
  7.           a1, a0: in std_logic; -- биты первого числа
  8.               b1, b0: in std_logic; -- биты второго числа
  9.               ext_e, ext_g, ext_l: in std_logic; -- входы увеличения разрядности
  10.               e: out std_logic;  -- equal
  11.               g: out std_logic;  -- greater
  12.               l: out std_logic); -- less
  13. end cmp2;
  14.  
  15. architecture logic of cmp2 is
  16. begin
  17.         process (clk)
  18.                 variable e1: std_logic;
  19.         begin
  20.         if rising_edge(clk) then
  21.                     e1 := not (a1 xor b1);
  22.                     e <= ext_e and e1 and (not (a0 xor b0));
  23.                     g <= ext_g or
  24.                          (ext_e and
  25.                          ((a1 and (not b1)) or (e1 and a0 and (not b0))));
  26.                     l <= ext_l or
  27.                          (ext_e and
  28.                          ((b1 and (not a1)) or (e1 and b0 and (not a0))));
  29.         end if;
  30.         end process;
  31. end logic;
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment