Advertisement
Trilleo

Untitled

May 16th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.67 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.all;
  4. use ieee.numeric_std.all;
  5. use work.all_functions.all;
  6.  
  7. entity my_gates is
  8. port(
  9.         a, b : in std_logic;
  10.         and_out, or_out, xor_out : out std_logic
  11. );
  12. end my_gates;
  13.  
  14. architecture gates of my_gates is
  15.  
  16.     function f_xor(s1, s2 : std_logic) return std_logic is
  17.             begin
  18.                 return (s1 xor s2);
  19.     end f_xor;
  20.  
  21.  
  22.     procedure p_and_or(signal s1,s2 : std_logic; signal out1_and, out2_or : out std_logic) is
  23.         begin  
  24.             out1_and <= s1 and s2;
  25.             out2_or <= s1 or s2;
  26.     end p_and_or;
  27.  
  28. begin
  29.  
  30.     process(a, b)
  31.     begin
  32.         xor_out <= f_xor(a,b);
  33.         p_and_or(a,b, and_out, or_out);
  34.     end process;
  35. end gates;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement