Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/21/2019 10:25:30 AM
  6. -- Design Name:
  7. -- Module Name: sum_8b - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx leaf cells in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity sum_8b is
  35. Port ( x : in STD_LOGIC_VECTOR (7 downto 0);
  36. y : in STD_LOGIC_VECTOR (7 downto 0);
  37. tin : in STD_LOGIC;
  38. s : out STD_LOGIC_VECTOR (7 downto 0);
  39. tout : out STD_LOGIC);
  40. end sum_8b;
  41.  
  42. architecture Behavioral of sum_8b is
  43.  
  44. signal p : std_logic_vector (3 downto 0) := "0000";
  45. signal g : std_logic_vector (3 downto 0) := "0000";
  46. signal t : std_logic_vector (3 downto 0) := "0000";
  47.  
  48. begin
  49.  
  50. sum_2ball: for i in 0 to 3 generate
  51. sum_wb1: if i > 0 generate
  52. sum_2bi: entity WORK.sum_2b port map(
  53. x => x (2*i+1 downto 2*i),
  54. y => y (2*i+1 downto 2*i),
  55. t => t(i-1),
  56. s => s (2*i+1 downto 2*i),
  57. p => p(i),
  58. g => g(i));
  59. end generate;
  60. sum_2bii: if i = 0 generate
  61. sum_10: entity WORK.sum_2b port map (
  62. x => x (1 downto 0),
  63. y => y (1 downto 0),
  64. t => tin,
  65. s => s (1 downto 0),
  66. p => p(0),
  67. g => g(0));
  68. end generate;
  69. end generate;
  70.  
  71. --sum_10: entity WORK.sum_2b port map (
  72. -- x => x (1 downto 0),
  73. -- y => y (1 downto 0),
  74. -- t => tin,
  75. -- s => s (1 downto 0),
  76. -- p => p(0),
  77. -- g => g(0));
  78.  
  79. --sum_32: entity WORK.sum_2b port map (
  80. -- x => x (3 downto 2),
  81. -- y => y (3 downto 2),
  82. -- t => t(0),
  83. -- s => s (3 downto 2),
  84. -- p => p(1),
  85. -- g => g(1));
  86.  
  87. --sum_54: entity WORK.sum_2b port map (
  88. -- x => x (5 downto 4),
  89. -- y => y (5 downto 4),
  90. -- t => t(1),
  91. -- s => s (5 downto 4),
  92. -- p => p(2),
  93. -- g => g(2));
  94.  
  95. --sum_76: entity WORK.sum_2b port map (
  96. -- x => x (7 downto 6),
  97. -- y => y (7 downto 6),
  98. -- t => t(2),
  99. -- s => s (7 downto 6),
  100. -- p => p(3),
  101. -- g => g(3));
  102.  
  103. gen_t0: entity WORK.gen_t port map(
  104. p => p,
  105. g => g,
  106. t0 => tin,
  107. t => t);
  108.  
  109. tout <= t(3);
  110.  
  111. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement