Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.26 KB | None | 0 0
  1.  
  2. library IEEE;
  3. use IEEE.STD_LOGIC_1164.ALL;
  4.  
  5. entity mul4x4 is
  6.     Port ( x0 : in  STD_LOGIC_VECTOR (3 downto 0);
  7.            x1 : in  STD_LOGIC_VECTOR (3 downto 0);
  8.            y : out  STD_LOGIC_VECTOR (7 downto 0));
  9. end mul4x4;
  10.  
  11. architecture Behavioral of mul4x4 is
  12.  
  13. component sum8bit is
  14.     Port ( COUT : out  STD_LOGIC;
  15.            CIN : in  STD_LOGIC;
  16.            x0 : in  STD_LOGIC_VECTOR (7 downto 0);
  17.            x1 : in  STD_LOGIC_VECTOR (7 downto 0);
  18.            y : out  STD_LOGIC_VECTOR (7 downto 0));
  19. end component;
  20.  
  21. signal line0:STD_LOGIC_VECTOR (7 downto 0);
  22. signal line1:STD_LOGIC_VECTOR (7 downto 0);
  23. signal line2:STD_LOGIC_VECTOR (7 downto 0);
  24. signal line3:STD_LOGIC_VECTOR (7 downto 0);
  25. signal add0:STD_LOGIC_VECTOR (7 downto 0);
  26. signal add1:STD_LOGIC_VECTOR (7 downto 0);
  27. begin
  28.  
  29. line0 <= "00000000" when x1(0) = '0' else "0000"&x0;
  30. line1 <= "00000000" when x1(1) = '0' else "000"&x0&"0";
  31. line2 <= "00000000" when x1(2) = '0' else "00"&x0&"00";
  32. line3 <= "00000000" when x1(3) = '0' else "0"&x0&"000";
  33.  
  34. S80: sum8bit port map (CIN => '0', x0 => line0, x1 => line1, y => add0);
  35. S81: sum8bit port map (CIN => '0', x0 => line2, x1 => line3, y => add1);
  36. S82: sum8bit port map (CIN => '0', x0 => add0, x1 => add1, y => y);
  37.  
  38.  
  39. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement