Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 3.48 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. entity Extensor is
  4.     port
  5.     (
  6.         X,Y,Z,a,b           : in STD_logic_vector(3 downto 0);
  7.         Ia,Ib,cin           : out STD_logic_vector(3 downto 0)
  8.     );
  9. end Extensor;
  10.  
  11. architecture Estrutural of Extensor is
  12. begin
  13.     Ia <= (not(x) and a) or (x and y and z and not(a));
  14.     Ib <= (not(x) and not(y) and not(z) and b) or (not(x) and not(y) and z and not(b));
  15.     cin(0) <= (y(0) and not(z(0)) and not(a(0)) and b(0)) or (x(0) and not(y(0)) and a(0) and b(0)) or (not(x(0)) and y(0) and not(z(0))) or (not(x(0)) and not(y(0)) and z(0)) or (not(y(0)) and z(0) and b(0)) or (not (y(0)) and z(0) and a(0)) or (y(0) and not(z(0)) and a(0) and not(b(0)));
  16.     cin(3 downto 1) <= (x(3 downto 1) and y(3 downto 1) and not(z(3 downto 1)) and not(a(3 downto 1)) and b(3 downto 1)) or (x(3 downto 1) and y(3 downto 1) and not(z(3 downto 1)) and a(3 downto 1) and not(b(3 downto 1))) or (x(3 downto 1) and not(y(3 downto 1)) and z(3 downto 1) and b(3 downto 1)) or (x(3 downto 1) and not (y(3 downto 1)) and z(3 downto 1) and a(3 downto 1)) or (x(3 downto 1) and not (y(3 downto 1)) and a(3 downto 1) and b(3 downto 1));
  17. end Estrutural;
  18. -----------------------------------------------------------
  19. library ieee;
  20. use ieee.std_logic_1164.all;
  21. entity SomadorCompleto is
  22.     port
  23.     (
  24.         a,b,ci              : in STD_logic_vector(3 downto 0);
  25.         co,s                : out STD_logic_vector(3 downto 0)
  26.     );
  27. end SomadorCompleto;
  28.  
  29. architecture Estrutural of SomadorCompleto is
  30. begin
  31.     co <= (a and b) or (a and ci) or (b and ci);
  32.     s <= (a xor b xor ci);
  33. end Estrutural;
  34. -----------------------------------------------------------
  35. library ieee;
  36. use ieee.std_logic_1164.all;
  37. entity SomadorCompleto4B is
  38.     port
  39.     (
  40.         a,b,ci              : in STD_logic_vector(3 downto 0);
  41.         s                   : out STD_logic_vector(3 downto 0);
  42.         cof                 : out STD_logic
  43.     );
  44. end SomadorCompleto4B;
  45.  
  46. architecture Estrutural of SomadorCompleto4B is
  47. signal coci : STD_logic_vector(3 downto 1);
  48. component SomadorCompleto port
  49.     (
  50.         a,b,ci              : in STD_logic;
  51.         s,co                : out STD_logic
  52.     );
  53. end component SomadorCompleto;
  54. begin
  55.     SomadorCompleto0 : SomadorCompleto port map(a(0),b(0),ci(0),s(0),coci(1));
  56.     SomadorCompleto1 : SomadorCompleto port map(a(1),b(1),ci(1) or coci(1),s(1),coci(2));
  57.     SomadorCompleto2 : SomadorCompleto port map(a(2),b(2),ci(2) or coci(2),s(2),coci(3));
  58.     SomadorCompleto3 : SomadorCompleto port map(a(3),b(3),ci(3) or coci(3),s(3),cof);
  59. end Estrutural;
  60. -----------------------------------------------------------
  61. library ieee;
  62. use ieee.std_logic_1164.all;
  63. entity ULA is
  64.     port
  65.     (
  66.         X,Y,Z          : in STD_logic;
  67.         A,B            : in STD_logic_vector(3 downto 0);
  68.         S              : out STD_logic_vector(3 downto 0);
  69.         Cout           : out STD_logic
  70.     );
  71. end ULA;
  72.  
  73. architecture Estrutural of ULA is
  74. signal sIa : STD_logic_vector(3 downto 0);
  75. signal sIb : STD_logic_vector(3 downto 0);
  76. signal scin : STD_logic_vector(3 downto 0);
  77. component Extensor port
  78.     (
  79.         X,Y,Z               : in STD_logic;
  80.         A,B                 : in STD_logic_vector(3 downto 0);
  81.         Ia,Ib,cin           : out STD_logic_vector(3 downto 0)      
  82.     );
  83. end component Extensor;
  84. component SomadorCompleto4B port
  85.     (
  86.         a,b,ci              : in STD_logic_vector(3 downto 0);
  87.         s               : out STD_logic_vector(3 downto 0);
  88.         cof                 : out STD_logic  
  89.     );
  90. end component SomadorCompleto4B;
  91.  
  92. begin
  93.     Ext: Extensor port map (X,Y,Z,A,B,sIa,sIb,scin);
  94.     SC: SomadorCompleto4B port map (sIa,sIb,scin,s,Cout);
  95. end Estrutural;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement