Я написал код для 8-битного сумматора с помощью usign 4-битного переноса вперед. Я создал экземпляр 4-х битного caryy lookhed the adhed, используя карту порта. но я думаю, что я ошибаюсь для сопоставления портов. PLese любой может Хель меня, как я могу исправить отображение порта ..8 бит Ripple carry adder Порт mappinng в VHDL
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity adder_4_bit is
Port (a,b : in STD_LOGIC_VECTOR (3 downto 0);
s : out STD_LOGIC_VECTOR (3 downto 0);
cout: out STD_LOGIC);
end adder_4_bit;
architecture Behavioral of adder_4_bit is
signal g, p, c, b1: STD_LOGIC_VECTOR(3 downto 0);
begin
g <= a and b;
p <= a xor b;
s(0) <= p(0) ;
c(0) <= g(0) or p(0) ;
s(1) <= p(1) xor c(0);
c(1) <= g(1) or (p(1) and g(0)) or (p(1) and p(0));
s(2) <= p(2) xor c(1);
c(2) <= g(2) or (p(2) and g(1)) or (p(2) and p(1) and g(0)) or (p(2) and p(1) and p(0));
s(3) <= p(3) xor c(2);
c(3) <= g(3) or (p(3) and g(2)) or (p(3) and p(2) and g(1)) or (p(3) and p(2) and p(1) and g(0)) or (p(3) and p(2) and p(1) and p(0));
cout <= c(3);
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--********************************************************--
entity Adder_8_bit is
Port (
a,b : in STD_LOGIC_VECTOR (7 downto 0);
s : out STD_LOGIC_VECTOR (7 downto 0);
cout: out STD_LOGIC
);
end Adder_8_bit;k
---******************---
architecture Behavioral of Adder_8_bit is
component adder_4_bit is
Port (
A,B : in STD_LOGIC_VECTOR (3 downto 0);
S: out STD_LOGIC_VECTOR (3 downto 0);
cout: out STD_LOGIC
);
end component;
----
signal a1 ,b1 : STD_LOGIC_VECTOR (7 downto 0);
signal SUM : STD_LOGIC_VECTOR (7 downto 0);
begin
four_bit_adder1: adder_4_bit port map (a1(3 downto 0) ,b1(3 downto 0) , SUM (3 downto 0) , cout) ;
four_bit_adder2: adder_4_bit port map (a1(7 downto 4) ,b1(7 downto 4) , SUM (7 downto 4) , cout) ;
end Behavioral;
Просьба описать желаемое поведение, а также конкретную проблему, с которой вы сталкиваетесь. Тогда, может быть, кто-то может вам помочь. – Ian
Лучшая помощь, которую я могу дать, - предложить вам создать тестовую базу и заставить ее работать правильно в симуляции. –