Advertisement
Tyler_Elric

fulladder

Sep 20th, 2017
135
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 fulladder is
  5.     Port ( a : in  STD_LOGIC;
  6.            b : in  STD_LOGIC;
  7.            cin : in  STD_LOGIC;
  8.            cout : out  STD_LOGIC;
  9.            s : out  STD_LOGIC);
  10. end fulladder;
  11.  
  12. architecture Behavioral of fulladder is
  13. -- top to bottom, left to right on slide 3 of the powerpoint.
  14.  
  15. signal SA, SB, SC : STD_LOGIC;
  16.  
  17. component andgate port (
  18.     a: in STD_LOGIC;
  19.     b: in STD_LOGIC;
  20.     c: out STD_LOGIC);
  21. end component;
  22.  
  23. component orgate port (
  24.     a: in STD_LOGIC;
  25.     b: in STD_LOGIC;
  26.     c: in STD_LOGIC;
  27.     d: out STD_LOGIC);
  28. end component;
  29.  
  30. component xorgate port (
  31.     a: in STD_LOGIC;
  32.     b: in STD_LOGIC;
  33.     c: in STD_LOGIC;
  34.     d: out STD_LOGIC);
  35. end component;
  36.  
  37. begin
  38.  
  39. GATEA: xorgate port map (
  40.     a => a,
  41.     b => b,
  42.     c => cin,
  43.     d => s
  44. );
  45.  
  46. GATEB: andgate port map (
  47.     a => a,
  48.     b => b,
  49.     c => SA
  50. );
  51.  
  52. GATEC: andgate port map(
  53.     a => a,
  54.     b => cin,
  55.     c => SB
  56. );
  57.  
  58. GATED: andgate port map (
  59.     a => b,
  60.     b => cin,
  61.     c => SC
  62. );
  63.  
  64. GATEF: orgate port map (
  65.     a => SA,
  66.     b => SB,
  67.     c => SC,
  68.     d => cout
  69. );
  70.  
  71. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement