Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.std_logic_1164.all;
  3. entity sum_8bit_ver2 is
  4. port (
  5. a : in std_logic_vector(7 downto 0); -- wejscie 1
  6. b : in std_logic_vector(7 downto 0); -- wejscie 2
  7. q : out std_logic_vector(8 downto 0) -- wyjscie (suma)
  8. );
  9. end sum_8bit_ver2;
  10.  
  11. architecture sum_8bit_v2 of sum_8bit_ver2 is
  12. component half_sum is
  13. port(
  14. a, b : in std_logic; -- wejscia
  15. sum : out std_logic; -- suma
  16. carry : out std_logic -- przeniesienie
  17. );
  18. end component;
  19. component sum is
  20. port(
  21. a, b, ci : in std_logic; -- wejscia
  22. sum : out std_logic; -- suma
  23. co : out std_logic -- przeniesienie
  24. );
  25. end component;
  26. signal c : std_logic_vector(7 downto 0);
  27. begin
  28. blok1: half_sum port map (a=>a(0), b=>b(0), sum=>q(0), carry=>c(0));
  29. blok2: sum port map (a=>a(1), b=>b(1), ci=>c(0), sum=>q(1), co=>c(1));
  30. blok3: sum port map (a=>a(2), b=>b(2), ci=>c(1), sum=>q(2), co=>c(2));
  31. blok4: sum port map (a=>a(3), b=>b(3), ci=>c(2), sum=>q(3), co=>c(3));
  32. blok5: sum port map (a=>a(4), b=>b(4), ci=>c(3), sum=>q(4), co=>c(4));
  33. blok6: sum port map (a=>a(5), b=>b(5), ci=>c(4), sum=>q(5), co=>c(5));
  34. blok7: sum port map (a=>a(6), b=>b(6), ci=>c(5), sum=>q(6), co=>c(6));
  35. blok8: sum port map (a=>a(7), b=>b(7), ci=>c(6), sum=>q(7), co=>q(8));
  36. end sum_8bit_v2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement