I used to come here for C problems and/or Java.
These days I'm learning VHDL and I'm currently stuck in a very small problem. I thought maybe some fresh eyes could give me the solution. I'm that close to get it.
This is a simple 1-BIT ADDER [works fine]
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity ADDC1 is
port ( A, B, CIN : in std_logic;
COUT, SUM : out std_logic);
end entity;
architecture DF of ADDC1 is
begin
SUM <= A XOR B XOR CIN;
COUT <= (A AND B) OR (B AND CIN) OR (A AND CIN);
end architecture;
My goal is to make a chained 4-BIT adder with this as a component.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity ADDC4 is
port (
I1, I2: in std_logic_vector(3 downto 0);
CIN : in std_logic;
SUM : out std_logic_vector(3 downto 0);
COUT : out std_logic );
end entity ADDC4;
architecture STRUCT of ADDC4 is
component ADDC1(DF) is
port ( A: in std_logic;
B: in std_logic;
CIN: in std_logic;
COUT: out std_logic;
SUM : out std_logic);
end component;
signal COI1,COI2,COI3 : std_logic;
begin
AD1: work.ADCC1 port map (A => I1(0), B => I2(0), CIN => CIN, SUM => SUM(0), COUT => COI1);
AD2: work.ADCC1 port map (A => I1(1), B => I2(1), CIN => COI1, SUM => SUM(1), COUT => COI2);
AD3: work.ADCC1 port map (A => I1(2), B => I2(2), CIN => COI2, SUM => SUM(2), COUT => COI3);
AD4: work.ADCC1 port map (A => I1(3), B => I2(3), CIN => COI3, SUM => SUM(3), COUT => COUT);
end architecture STRUCT;
I checked a few sites, lost an hour, I know it must be a stupid simple thing I'm not seeing because I'm not familiar with the language.
The general idea seems to be good though.
Could you help ?