Advertisement
Tyler_Elric

ripplecarry

Sep 20th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.95 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3.  
  4. entity ripplecarry is
  5.     Port ( a : in  STD_LOGIC_VECTOR (3 downto 0);
  6.            b : in  STD_LOGIC_VECTOR (3 downto 0);
  7.               cin: in STD_LOGIC;
  8.            c : out  STD_LOGIC_VECTOR (3 downto 0);
  9.            cout : out  STD_LOGIC);
  10. end ripplecarry;
  11.  
  12. architecture Behavioral of ripplecarry is
  13.  
  14. signal SA, SB, SC: STD_LOGIC;
  15.  
  16. component fulladder port (
  17.     a : in  STD_LOGIC;
  18.     b : in  STD_LOGIC;
  19.     cin : in  STD_LOGIC;
  20.     cout : out  STD_LOGIC;
  21.     s : out  STD_LOGIC);
  22. end component;
  23.  
  24. begin
  25.  
  26. FAD1: fulladder port map (
  27.     a => a(0),
  28.     b => b(0),
  29.     cin => cin,
  30.     cout => SA,
  31.     s => c(0)
  32. );
  33.  
  34. FAD2: fulladder port map (
  35.     a => a(1),
  36.     b => b(1),
  37.     cin => SA,
  38.     cout => SB,
  39.     s => c(1)
  40. );
  41.  
  42. FAD3: fulladder port map (
  43.     a => a(2),
  44.     b => b(2),
  45.     cin => SB,
  46.     cout => SC,
  47.     s => c(2)
  48. );
  49.  
  50. FAD4: fulladder port map (
  51.     a => a(3),
  52.     b => b(3),
  53.     cin => SC,
  54.     cout => cout,
  55.     s => c(3)
  56. );
  57.  
  58. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement