-- ENGN3213, adder4-v.vhd -- Name: , date: library IEEE; use IEEE.std_logic_1164.all; entity adder4 is port( a,b : in std_logic_vector(3 downto 0); Ci : in std_logic; s : out std_logic_vector(3 downto 0); Co : out std_logic); end adder4; architecture structure of adder4 is component adder port(X,Y,Cin : in std_logic; Cout, Sum : out std_logic); end component; signal c : std_logic_vector(3 downto 1); begin fa0: adder port map (a(0), b(0), Ci, c(1), s(0)); fa1: adder port map (a(1), b(1), c(1), c(2), s(1)); fa2: adder port map (a(2), b(2), c(2), c(3), s(2)); fa3: adder port map (a(3), b(3), c(3), Co, s(3)); end structure;
and save in your main project folder adder4-v.
Synthesis Check Syntax
Project Add Source File(s)..
In this VHDL code, note:
Using the VHDL source files, draw a block diagram of the 4-bit adder showing the interconnections with the 1-bit modules. Compare with the schematic diagram used earlier.
ANU Engineering - ENGN3213