HM VHDL Lab
HM VHDL Lab
USING VHDL
(Theory cum Practical Course)
Branch :
………………………………
.
BONAFIDE CERTIFICATE
Mr./Ms.……………………………………………………… of …… semester
B.E. ..……………………………………..…………………………………… in
the …………………………………………………………………..Laboratory
Program Outcomes:
OBJECTIVES:
List of Experiments:
Total Period: 30
OUTCOMES:
CO1: Understand the basics of Hardware Description Languages, Program structure and basic
language elements of VHDL
CO2: Understand various statements and delay models of behavior modelling Using VHDL
CO3: Understand the gate level and structural level modelling using VHDL
CO4: Understand an advanced technique in VHDL
CO5: Summarize various optimization methods, circuit design of Datapath and memory system
HARDWARE MODELING USING VHDL LABORATORY
Course Objectives:
➢ To know introduction to VHDL, its structure, data types and operators, logic synthesis.
➢ To Understand syntax and statement of Behavioral Modeling using VHDL language
➢ To illustrate Gate level modelling, Dataflow level modeling, in VHDL
➢ To introduce Advanced Topics in VHDL using Packages and libraries
➢ To understand the concept of Hardware Modelling using VHDL
Course Outcomes:
CO/PO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
C301.1 3 2 2 3 1 1 1 1
C301.2 3 2 2 1 3 1 1 1 1
C301.3 3 2 2 3 1 1 1 1
C301.4 3 2 2 3 1 1 1 1
C301.5 3 2 2 3 1 1 1 1
INDEX
EXPERIMENT
PAGE CO PO MAPPING MAR
NAME OF THE EXPERIMENT SIGN
NO. DATE NO. KS
PO1, PO2, PO3, PO4,
Circuit implementation using VHDL PO5, PO9, PO10,
1 (Dataflow, Gate level and Behavioral) PO11, PO12, PSO1,
PSO2
3 Design of Adders
PO1, PO2, PO3, PO4,
16-Bit Ripple Carry Adder PO5, PO9, PO10,
3a
PO11, PO12, PSO1,
PSO2
PO1, PO2, PO3, PO4,
3b 16-Bit Carry Save Adder PO5, PO9, PO10, PO11,
PO12, PSO1, PSO2
16-Bit Carry Select Adder PO1, PO2, PO3, PO4,
3c PO5, PO9, PO10, PO11,
PO12, PSO1, PSO2
PO1, PO2, PO3, PO4,
3d 16-Bit Carry Skip Adder PO5, PO9, PO10, PO11,
PO12, PSO1, PSO2
PO1, PO2, PO3, PO4,
4 Realization of VLSI Multiplier PO5, PO9, PO10, PO11,
PO12, PSO1, PSO2
PO1, PO2, PO3, PO4,
4-Bit BRAUN Multiplier
4a PO5, PO9, PO10, PO11,
PO12, PSO1, PSO2
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 8:1 Multiplexer using VHDL and obtain its Simulation,
Synthesis using Behavioral, Structural and Dataflow Modelling.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
PROCEDURE
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
entity MUX8to1 is
Port (
sel : in STD_LOGIC_VECTOR(2 downto 0);
inputs : in STD_LOGIC_VECTOR(7 downto 0);
y : out STD_LOGIC
);
end MUX8to1;
architecture Behavioral of MUX8to1 is
begin
y <= inputs(0) when sel = "000" else
inputs(1) when sel = "001" else
inputs(2) when sel = "010" else
inputs(3) when sel = "011" else
inputs(4) when sel = "100" else
inputs(5) when sel = "101" else
DATAFLOW MODEL
Simulation Result
RTL Analysis
entity mux_8to1 is
Port ( inputs : in STD_LOGIC_VECTOR (7 downto 0);
sel : in STD_LOGIC_VECTOR (2 downto 0);
y : out STD_LOGIC);
end mux_8to1;
entity mux_8to1 is
Port ( I : in STD_LOGIC_VECTOR (7 downto 0);
S : in STD_LOGIC_VECTOR (2 downto 0);
Y : out STD_LOGIC);
end mux_8to1;
architecture gate_level of mux_8to1 is
signal A, B, C, D, E, F : STD_LOGIC;
begin
A <= (not S(2)) and (not S(1)) and (not S(0)) and I(0);
B <= (not S(2)) and (not S(1)) and S(0) and I(1);
C <= (not S(2)) and S(1) and (not S(0)) and I(2);
D <= (not S(2)) and S(1) and S(0) and I(3);
E <= S(2) and (not S(1)) and (not S(0)) and I(4);
F <= S(2) and (not S(1)) and S(0) and I(5);
Y <= A or B or C or D or E or F or G or H;
end gate_level;
TEST BENCH(VHDL)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity mux_8to1_tb is
end mux_8to1_tb;
component MUX8to1
Port (
inputs : in STD_LOGIC_VECTOR(7 downto 0);
sel : in STD_LOGIC_VECTOR(2 downto 0);
y : out STD_LOGIC
);
end component;
signal y : STD_LOGIC;
begin
uut: MUX8to1 port map (
inputs => inputs,
sel => sel,
y => y
);
stim_proc: process
begin
wait;
end process;
end testbench;
RESULT
Thus the outputs of Multiplexers are verified by synthesizing and simulating VHDL
code. By completing this experiment, students will gain a deeper understanding of Multiplexer.
Problems encountered in the designing of Multiplexer are identified in the study (PO2) are
analyzed with Xilinx Vivado tool (PO5) and results are verified (PO3) through simulation
(PO4).
EXP NO: 2 SYSTEM TASKS AND FUNCTIONS
DATE:
AIM
To develop the source code for a VHDL program for implementation of System Tasks
and Functions.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
-- Entity Declaration
entity SystemTasksFunctions is
Port (
clk : in std_logic;
reset : in std_logic;
input_a : in std_logic_vector(7 downto 0);
input_b : in std_logic_vector(7 downto 0);
result_out: out std_logic_vector(7 downto 0)
);
end SystemTasksFunctions;
begin
-- Output assignment
result_out <= internal_result;
end Behavioral;
TEST BENCH(VHDL)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
-- Entity Declaration for Testbench
entity SystemTasksFunctions_tb is
end SystemTasksFunctions_tb;
begin
-- Stimulus process
stimulus_process : process
begin
reset <= '1';
wait for 20 ns;
reset <= '0';
RESULT
Thus the outputs of a program implementing System Tasks and Functions are verified
by synthesizing and simulating VHDL code. By completing this experiment, students will gain
a deeper understanding of System Tasks and Functions. Problems encountered in the designing
of System Tasks and Functions are identified in the study (PO2) are analyzed with Xilinx
Vivado tool (PO5) and results are verified (PO3) through simulation (PO4).
RIPPLE CARRY ADDER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for different types of 16 Bit Ripple Carry Adder using VHDL and
obtains its Simulation, Synthesis using Behavioral, Structural and Dataflow Modelling.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
PROCEDURE
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE (BEHAVIOURAL MODEL)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity RippleCarryAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR(15 downto 0);
Cout : out STD_LOGIC
);
end RippleCarryAdder16bit;
DATAFLOW MODEL
Simulation Result
RTL Analysis
entity RippleCarryAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
Cin : in STD_LOGIC; -- Carry-in
Sum : out STD_LOGIC_VECTOR(15 downto 0);
Cout : out STD_LOGIC
);
end RippleCarryAdder16bit;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity FullAdder is
Port (
A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
Sum : out STD_LOGIC;
Cout : out STD_LOGIC
);
end FullAdder;
architecture Structural of FullAdder is
begin
Sum <= A xor B xor Cin;
Cout <= (A and B) or (A and Cin) or (B and Cin);
end Structural;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity RippleCarryAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR(15 downto 0);
Cout : out STD_LOGIC
);
end RippleCarryAdder16bit;
architecture Structural of RippleCarryAdder16bit is
signal Carry: STD_LOGIC_VECTOR(15 downto 0);
component FullAdder
Port (
A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
Sum : out STD_LOGIC;
Cout : out STD_LOGIC
);
end component;
begin
end Structural;
TEST BENCH:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity tb_RippleCarryAdder16bit is
end tb_RippleCarryAdder16bit;
begin
uut: RippleCarryAdder16bit
Port map (
A => A,
B => B,
Cin => Cin,
Sum => Sum,
Cout => Cout
);
stim_proc: process
begin
-- Initialize inputs
A <= (others => '0');
B <= (others => '0');
A <= "0000000000000001";
B <= "0000000000000010";
Cin <= '0';
wait for 100 ps;
A <= "1111000000000111";
B <= "1110000000000011";
Cin <= '0';
wait for 100 ps;
A <= "1111111111111111";
B <= "0000000000000001";
Cin <= '0';
wait for 100 ps;
A <= "1010101010101010";
B <= "0101010101010101";
Cin <= '1';
wait for 100 ps;
wait;
end process;
end sim;
RESULT
Thus the outputs of a program implementing 16-bit Ripple Carry Adder are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 16-bit Ripple Carry Adder. Problems encountered in the designing of
16-bit Ripple Carry Adder are identified in the study (PO2) are analyzed with Xilinx Vivado
tool (PO5) and results are verified (PO3) through simulation (PO4).
CARRY SAVE ADDER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for different types of 16 Bit Carry Save Adder using VHDL and
obtains its Simulation, Synthesis using Behavioral, Structural and Dataflow Modelling.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
PROCEDURE
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity CarrySaveAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input A
B : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input B
C : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input C
Sum : out STD_LOGIC_VECTOR(15 downto 0); -- Intermediate sum output
Carry : out STD_LOGIC_VECTOR(15 downto 0) -- Carry output
);
end CarrySaveAdder16bit;
Simulation Result
RTL Analysis
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity CarrySaveAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input A
B : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input B
C : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input C
Sum : out STD_LOGIC_VECTOR(15 downto 0); -- Intermediate sum output
Carry : out STD_LOGIC_VECTOR(15 downto 0) -- Carry output
);
end CarrySaveAdder16bit;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity CarrySaveAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
C : in STD_LOGIC_VECTOR(15 downto 0);
Sum : out STD_LOGIC_VECTOR(15 downto 0);
Carry : out STD_LOGIC_VECTOR(15 downto 0)
);
end CarrySaveAdder16bit;
begin
FA0: FullAdder Port map (
A => A(0),
B => B(0),
Cin => C(0),
Sum => Sum(0),
Cout => Carry_internal(0)
);
FA1: FullAdder Port map (
A => A(1),
B => B(1),
Cin => C(1),
Sum => Sum(1),
Cout => Carry_internal(1)
);
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Adder16bit is
end Adder16bit;
begin
uut: CarrySaveAdder16bit
Port map (
A => A,
B => B,
C => C,
Sum => Sum,
carry => carry
);
stim_proc: process
begin
-- Initialize inputs
A <= (others => '0');
B <= (others => '0');
C <= '0';
A <= "0000000000000001";
B <= "0000000000000010";
C <= '0';
wait for 100 ps;
A <= "1111000000000111";
B <= "1110000000000011";
C <= '0';
wait for 100 ps;
A <= "1111111111111111";
B <= "0000000000000001";
C <= '0';
wait for 100 ps;
A <= "1010101010101010";
B <= "0101010101010101";
C <= '1';
wait for 100 ps;
wait;
end process;
end sim;
RESULT
Thus the outputs of a program implementing 16-bit Carry Save Adder are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 16-bit Carry Save Adder Problems encountered in the designing of 16-
bit Carry Save Adder are identified in the study (PO2) are analyzed with Xilinx Vivado tool
(PO5) and results are verified (PO3) through simulation (PO4).
CARRY SELECT ADDER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for different types of 16 Bit Carry Select Adder using VHDL and
obtains its Simulation, Synthesis using Behavioral, Structural and Dataflow Modelling.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
PROCEDURE
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE (BEHAVIOURAL MODEL)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity carry_select_adder_16bit is
Port ( A : in STD_LOGIC_VECTOR (15 downto 0);
B : in STD_LOGIC_VECTOR (15 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR (15 downto 0);
Cout : out STD_LOGIC);
end carry_select_adder_16bit;
begin
-- 4-bit Ripple Carry Adder for least significant bits
S0(3 downto 0) <= A(3 downto 0) + B(3 downto 0) + Cin;
DATAFLOW MODEL
Simulation Result
RTL Analysis
end Behavioral;
entity carry_select_adder_16bit is
Port ( A : in STD_LOGIC_VECTOR (15 downto 0);
B : in STD_LOGIC_VECTOR (15 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR (15 downto 0);
Cout : out STD_LOGIC);
end carry_select_adder_16bit;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity FullAdder is
Port (
A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
Sum : out STD_LOGIC;
Cout : out STD_LOGIC
);
end FullAdder;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity RippleCarryAdder8bit is
Port (
A : in STD_LOGIC_VECTOR(7 downto 0);
B : in STD_LOGIC_VECTOR(7 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR(7 downto 0);
Cout : out STD_LOGIC
);
end RippleCarryAdder8bit;
component FullAdder
Port (
A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
Sum : out STD_LOGIC;
Cout : out STD_LOGIC
);
end component;
begin
carry(0) <= Cin;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity CarrySelectAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input A
B : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input B
Cin : in STD_LOGIC; -- Carry input
Sum : out STD_LOGIC_VECTOR(15 downto 0); -- Sum output
Cout : out STD_LOGIC -- Carry output
);
end CarrySelectAdder16bit;
component MUX2to1
Port (
A0 : in STD_LOGIC_VECTOR(15 downto 0);
A1 : in STD_LOGIC_VECTOR(15 downto 0);
Sel : in STD_LOGIC;
MuxOut : out STD_LOGIC_VECTOR(15 downto 0)
);
end component;
begin
-- Lower 8-bit adder with carry-in 0
RCA_low0: RippleCarryAdder8bit Port map (
A => A(7 downto 0),
B => B(7 downto 0),
Cin => '0',
Sum => Sum0(7 downto 0),
Cout => Cout0
);
end Structural;
TEST BENCH :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity tb_CarrySelectAdder16bit is
-- Testbench has no ports
end tb_CarrySelectAdder16bit;
begin
-- Instantiate the Unit Under Test (UUT)
uut: CarrySelectAdder16bit
Port map (
A => A,
B => B,
Cin => Cin,
Sum => Sum,
Cout => Cout
);
stim_proc: process
begin
-- Test 1: All inputs are zero
A <= (others => '0');
B <= (others => '0');
Cin <= '0';
wait for 10 ns;
RESULT
Thus the outputs of a program implementing 16-bit Carry Select Adder are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 16-bit Carry Select Adder Problems encountered in the designing of
16-bit Carry Select Adder are identified in the study (PO2) are analyzed with Xilinx Vivado
tool (PO5) and results are verified (PO3) through simulation (PO4).
CARRY SKIP ADDER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for different types of 16 Bit Carry Skip Adder using VHDL and
obtains its Simulation, Synthesis using Behavioral, Structural and Dataflow Modelling.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
PROCEDURE
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
entity carry_skip_adder is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR(15 downto 0);
Cout : out STD_LOGIC
);
end carry_skip_adder;
Simulation Result
LUT Design
gen_pro: for i in 0 to 15 generate
P(i) <= A(i) xor B(i);
G(i) <= A(i) and B(i);
end generate;
sum_calc: for i in 0 to 15 generate
Sum(i) <= P(i) xor C(i);
C(i+1) <= G(i) or (P(i) and C(i));
end generate;
Cout <= C(16);
end Behavioral;
entity CarrySkipAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input A
B : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input B
Cin : in STD_LOGIC; -- Carry input
Sum : out STD_LOGIC_VECTOR(15 downto 0); -- Sum output
Cout : out STD_LOGIC -- Carry output
);
end CarrySkipAdder16bit;
begin
-- Propagate and Generate signals
P <= A xor B;
G <= A and B;
-- Calculate carry signals using dataflow modeling
C(0) <= Cin;
C(1) <= C(0) or G(0);
C(2) <= (C(1) and P(1)) or G(1);
C(3) <= (C(2) and P(2)) or G(2);
C(4) <= (C(3) and P(3)) or G(3);
C(5) <= (C(4) and P(4)) or G(4);
C(6) <= (C(5) and P(5)) or G(5);
C(7) <= (C(6) and P(6)) or G(6);
C(8) <= (C(7) and P(7)) or G(7);
C(9) <= (C(8) and P(8)) or G(8);
C(10) <= (C(9) and P(9)) or G(9);
C(11) <= (C(10) and P(10)) or G(10);
C(12) <= (C(11) and P(11)) or G(11);
C(13) <= (C(12) and P(12)) or G(12);
C(14) <= (C(13) and P(13)) or G(13);
C(15) <= (C(14) and P(14)) or G(14);
C(16) <= (C(15) and P(15)) or G(15);
end Dataflow;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity FullAdder is
Port (
A : in STD_LOGIC;
B : in STD_LOGIC;
Cin : in STD_LOGIC;
Sum : out STD_LOGIC;
Cout : out STD_LOGIC
);
end FullAdder;
architecture Structural of FullAdder is
begin
Sum <= A xor B xor Cin;
Cout <= (A and B) or (B and Cin) or (Cin and A);
end Structural;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity CarrySkipAdder16bit is
Port (
A : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input A
B : in STD_LOGIC_VECTOR(15 downto 0); -- 16-bit input B
Cin : in STD_LOGIC; -- Carry input
Sum : out STD_LOGIC_VECTOR(15 downto 0); -- Sum output
Cout : out STD_LOGIC -- Carry output
);
end CarrySkipAdder16bit;
begin
-- Instantiate Full Adders
FA0: FullAdder port map (A(0), B(0), Cin, Sum(0), carry(1));
FA1: FullAdder port map (A(1), B(1), carry(1), Sum(1), carry(2));
FA2: FullAdder port map (A(2), B(2), carry(2), Sum(2), carry(3));
FA3: FullAdder port map (A(3), B(3), carry(3), Sum(3), carry(4));
FA4: FullAdder port map (A(4), B(4), carry(4), Sum(4), carry(5));
FA5: FullAdder port map (A(5), B(5), carry(5), Sum(5), carry(6));
FA6: FullAdder port map (A(6), B(6), carry(6), Sum(6), carry(7));
FA7: FullAdder port map (A(7), B(7), carry(7), Sum(7), carry(8));
FA8: FullAdder port map (A(8), B(8), carry(8), Sum(8), carry(9));
FA9: FullAdder port map (A(9), B(9), carry(9), Sum(9), carry(10));
FA10: FullAdder port map (A(10), B(10), carry(10), Sum(10), carry(11));
FA11: FullAdder port map (A(11), B(11), carry(11), Sum(11), carry(12));
FA12: FullAdder port map (A(12), B(12), carry(12), Sum(12), carry(13));
FA13: FullAdder port map (A(13), B(13), carry(13), Sum(13), carry(14));
FA14: FullAdder port map (A(14), B(14), carry(14), Sum(14), carry(15));
FA15: FullAdder port map (A(15), B(15), carry(15), Sum(15), Cout);
-- Carry-Skip Logic
carry(0) <= Cin;
carry(1) <= carry(0) or (A(0) and B(0));
carry(2) <= carry(1) or (A(1) and B(1));
carry(3) <= carry(2) or (A(2) and B(2));
carry(4) <= carry(3) or (A(3) and B(3));
carry(5) <= carry(4) or (A(4) and B(4));
carry(6) <= carry(5) or (A(5) and B(5));
carry(7) <= carry(6) or (A(6) and B(6));
carry(8) <= carry(7) or (A(7) and B(7));
carry(9) <= carry(8) or (A(8) and B(8));
carry(10) <= carry(9) or (A(9) and B(9));
carry(11) <= carry(10) or (A(10) and B(10));
carry(12) <= carry(11) or (A(11) and B(11));
carry(13) <= carry(12) or (A(12) and B(12));
carry(14) <= carry(13) or (A(13) and B(13));
carry(15) <= carry(14) or (A(14) and B(14));
Cout <= carry(15);
end Structural;
TEST BENCH(VHDL)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity carry_skip_adder_tb is
end carry_skip_adder_tb;
architecture Behavioral of carry_skip_adder_tb is
component carry_skip_adder
Port (
A : in STD_LOGIC_VECTOR(15 downto 0);
B : in STD_LOGIC_VECTOR(15 downto 0);
Cin : in STD_LOGIC;
Sum : out STD_LOGIC_VECTOR(15 downto 0);
Cout : out STD_LOGIC
);
end component;
begin
uut: carry_skip_adder
Port map (
A => A,
B => B,
Cin => Cin,
Sum => Sum,
Cout => Cout
);
stim_proc: process
begin
A <= "0000000000000001";
B <= "0000000000000001";
Cin <= '0';
wait for 100 ps;
A <= "1111111111111111";
B <= "0000000000000001";
Cin <= '0';
wait for 100 ps;
A <= "1111111111111111";
B <= "0000000000000001";
Cin <= '1';
wait for 100 ps;
A <= "1010101010101010";
B <= "0101010101010101";
Cin <= '0';
wait for 100 ps;
A <= "1000000000000000";
B <= "1000000000000000";
Cin <= '1';
wait for 100 ps;
A <= "0001001000110100";
B <= "0100001100100001";
Cin <= '0';
wait for 100 ps;
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 16-bit Carry Skip Adder are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 16-bit Carry Skip Adder Problems encountered in the designing of 16-
bit Carry Skip Adder are identified in the study (PO2) are analyzed with Xilinx Vivado tool
(PO5) and results are verified (PO3) through simulation (PO4).
BRAUN MULTIPLIER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 4-bit Braun multiplier by using VHDL and obtain the simulation,
synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity BraunMultiplier4bit is
Port (
A : in STD_LOGIC_VECTOR (3 downto 0); -- 4-bit input A
B : in STD_LOGIC_VECTOR (3 downto 0); -- 4-bit input B
Product : out STD_LOGIC_VECTOR (7 downto 0) -- 8-bit product output
);
end BraunMultiplier4bit;
S1 <= P0 + P1;
S2 <= S1 + P2;
S3 <= S2 + P3;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity BraunMultiplier4bit_tb is
end BraunMultiplier4bit_tb;
begin
UUT: BraunMultiplier4bit
port map (
A => A,
B => B,
Product => Product
);
-- Test process
process
begin
-- Test Case 1
A <= "0011"; -- A = 3
B <= "0010"; -- B = 2
wait for 10 ns;
-- Test Case 2
A <= "0101"; -- A = 5
B <= "0011"; -- B = 3
wait for 10 ns;
-- Test Case 3
A <= "1111"; -- A = 15
B <= "1111"; -- B = 15
wait for 10 ns;
-- Test Case 4
A <= "1001"; -- A = 9
B <= "0110"; -- B = 6
wait for 10 ns;
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 4-bit Braun Multiplier are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 4-bit Braun Multiplier Problems encountered in the designing of 4-bit
Braun Multiplier are identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5)
and results are verified (PO3) through simulation (PO4).
BOOTH MULTIPLIER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 4-bit Booth multiplier by using VHDL and obtain the simulation,
synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_signed.ALL;
ENTITY BoothMultiplier4bit IS
PORT(A : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
Product : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END BoothMultiplier4bit;
q(8 DOWNTO 5) := A;
q(9) := A(3);
var := (NOT A) + 1;
s(8 DOWNTO 5) := var;
s(9) := NOT(A(3));
p(4 DOWNTO 1) := B;
FOR i IN 1 TO 4 LOOP
IF (p(1 DOWNTO 0) = "01") THEN
p := p + q;
ELSIF (p(1 DOWNTO 0) = "10") THEN
p := p + s;
END IF;
p(8 DOWNTO 0) := p(9 DOWNTO 1);
END LOOP;
END IF;
Product <= p(8 DOWNTO 1);
END PROCESS;
END behavior;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity BoothMultiplier4bit_tb is
end BoothMultiplier4bit_tb;
begin
-- Instantiate the Booth Multiplier
UUT: BoothMultiplier4bit
port map (
A => A,
B => B,
Product => Product
);
-- Test process
process
begin
-- Test Case 1: 3 * 2 = 6
A <= "0011"; -- A = 3
B <= "0010"; -- B = 2
wait for 20 ns;
-- Test Case 2: -3 * 2 = -6
A <= "1101"; -- A = -3 (2's complement)
B <= "0010"; -- B = 2
wait for 20 ns;
-- Test Case 3: -3 * -2 = 6
A <= "1101"; -- A = -3
B <= "1110"; -- B = -2
wait for 20 ns;
-- Test Case 4: 7 * -1 = -7
A <= "0111"; -- A = 7
B <= "1111"; -- B = -1
wait for 20 ns;
-- Finish simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 4-bit Booth Multiplier are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 4-bit Booth Multiplier Problems encountered in the designing of 4-bit
Booth Multiplier are identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5)
and results are verified (PO3) through simulation (PO4).
BOOTH MULTIPLIER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 4-bit Wallace multiplier by using VHDL and obtain the simulation,
synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity WallaceTreeMultiplier4bit is
Port (
A : in STD_LOGIC_VECTOR(3 downto 0); -- 4-bit multiplicand
B : in STD_LOGIC_VECTOR(3 downto 0); -- 4-bit multiplier
Product : out STD_LOGIC_VECTOR(7 downto 0) -- 8-bit product output
);
end WallaceTreeMultiplier4bit;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity WallaceTreeMultiplier4bit_tb is
end WallaceTreeMultiplier4bit_tb;
begin
-- Instantiate the Wallace Tree Multiplier
UUT: WallaceTreeMultiplier4bit
port map (
A => A,
B => B,
Product => Product
);
-- Test process
process
begin
-- Test Case 1: 3 * 2 = 6
A <= "0011"; -- A = 3
B <= "0010"; -- B = 2
wait for 20 ns;
-- Test Case 2: 5 * 4 = 20
A <= "0101"; -- A = 5
B <= "0100"; -- B = 4
wait for 20 ns;
-- Test Case 3: 7 * 7 = 49
A <= "0111"; -- A = 7
B <= "0111"; -- B = 7
wait for 20 ns;
-- Test Case 4: 8 * 3 = 24
A <= "1000"; -- A = 8
B <= "0011"; -- B = 3
wait for 20 ns;
-- Finish simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 4-bit Wallace Multiplier are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 4-bit Wallace Multiplier Problems encountered in the designing of 4-
bit Wallace Multiplier are identified in the study (PO2) are analyzed with Xilinx Vivado tool
(PO5) and results are verified (PO3) through simulation (PO4).
4-BIT ALU
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 4-bit Arithmetic Logic Unit (ALU) by using VHDL and obtain the
simulation, synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ALU is
Port (
A : in STD_LOGIC_VECTOR(3 downto 0); -- 4-bit input A
B : in STD_LOGIC_VECTOR(3 downto 0); -- 4-bit input B
Op : in STD_LOGIC_VECTOR(1 downto 0); -- 2-bit operation code
Result : out STD_LOGIC_VECTOR(3 downto 0) -- 4-bit result
);
end ALU;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ALU_tb is
end ALU_tb;
begin
-- Instantiate the ALU component
uut: ALU
Port map (
A => A,
B => B,
Op => Op,
Result => Result
);
-- Stop simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 4-bit Arithmetic Logic Unit (ALU) are
verified by synthesizing and simulating VHDL code. By completing this experiment, students
will gain a deeper understanding of 4-bit Arithmetic Logic Unit (ALU) Problems encountered
in the designing of 4-bit Arithmetic Logic Unit (ALU) are identified in the study (PO2) are
analyzed with Xilinx Vivado tool (PO5) and results are verified (PO3) through simulation
(PO4).
DESIGN OF REAL TIME CLOCK
BEHAVIOURAL MODEL
Simulation Result
LUT Design
EXP NO: 6 DESIGN OF REAL TIME CLOCK
DATE:
AIM
To develop the source code for Real Time Clock by using VHDL and obtain the simulation,
synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity RealTimeClock is
Port (
clk : in STD_LOGIC; -- Clock input
reset : in STD_LOGIC; -- Asynchronous reset
hours : out STD_LOGIC_VECTOR(4 downto 0); -- 5-bit hours (0-23)
minutes : out STD_LOGIC_VECTOR(5 downto 0); -- 6-bit minutes (0-59)
seconds : out STD_LOGIC_VECTOR(5 downto 0) -- 6-bit seconds (0-59)
);
end RealTimeClock;
-- Assigning to outputs
seconds <= sec_count;
minutes <= min_count;
hours <= hour_count;
end Behavioral;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity RealTimeClock_tb is
end RealTimeClock_tb;
begin
-- Instantiate the RealTimeClock
UUT: RealTimeClock
port map (
clk => clk,
reset => reset,
hours => hours,
minutes => minutes,
seconds => seconds
);
-- Clock generation
clk_process : process
begin
while true loop
clk <= '0';
wait for 10 ns;
clk <= '1';
wait for 10 ns;
end loop;
end process;
process
begin
reset <= '1';
wait for 20 ns;
reset <= '0';
wait for 1 us;
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 4-bit Wallace Multiplier are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 4-bit Wallace Multiplier Problems encountered in the designing of 4-
bit Wallace Multiplier are identified in the study (PO2) are analyzed with Xilinx Vivado tool
(PO5) and results are verified (PO3) through simulation (PO4).
FPGA IMPLEMENTATION - 8:3 ENCODER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 8:3 Encoder by using VHDL and obtain the simulation, synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Encoder8to3 is
Port (
data_in : in STD_LOGIC_VECTOR(7 downto 0); -- 8-bit input
data_out : out STD_LOGIC_VECTOR(2 downto 0); -- 3-bit output
valid : out STD_LOGIC -- Output valid signal
);
end Encoder8to3;
entity tb_Encoder8to3 is
end tb_Encoder8to3;
component Encoder8to3
Port (
data_in : in STD_LOGIC_VECTOR(7 downto 0); -- 8-bit input
data_out : out STD_LOGIC_VECTOR(2 downto 0); -- 3-bit output
valid : out STD_LOGIC -- Output valid signal
);
end component;
begin
uut: Encoder8to3
Port map (
data_in => data_in,
data_out => data_out,
valid => valid
);
stim_proc: process
begin
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 8:3 Encoder are verified by synthesizing
and simulating VHDL code. By completing this experiment, students will gain a deeper
understanding of 8:3 Encoder Problems encountered in the designing of 8:3 Encoder are
identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5) and results are verified
(PO3) through simulation (PO4).
FPGA IMPLEMENTATION - 3:8 DECODER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 3:8 Decoder by using VHDL and obtain the simulation, synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity decoder_3to8 is
Port (
input : in STD_LOGIC_VECTOR (2 downto 0);
output : out STD_LOGIC_VECTOR (7 downto 0)
);
end decoder_3to8;
end process;
end Behavioral;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity tb_decoder_3to8 is
end tb_decoder_3to8;
begin
-- Instantiate the UUT
uut: decoder_3to8
port map (
input => input,
output => output
);
-- Stimulus process
stim_proc: process
begin
-- Apply each input value and wait for 10 ns
input <= "000"; wait for 100 ps;
input <= "001"; wait for 100 ps;
input <= "010"; wait for 100 ps;
input <= "011"; wait for 100 ps;
input <= "100"; wait for 100 ps;
input <= "101"; wait for 100 ps;
input <= "110"; wait for 100 ps;
input <= "111"; wait for 100 ps;
-- End simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 3:8 Decoder are verified by synthesizing
and simulating VHDL code. By completing this experiment, students will gain a deeper
understanding of 3:8 Decoder Problems encountered in the designing of 3:8 Decoder are
identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5) and results are verified
(PO3) through simulation (PO4).
FPGA IMPLEMENTATION - D FLIP FLOP
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for D Flip Flop by using VHDL and obtain the simulation, synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity d_flip_flop is
Port (
clk : in STD_LOGIC;
D : in STD_LOGIC;
Q : out STD_LOGIC
);
end d_flip_flop;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity tb_d_flip_flop is
end tb_d_flip_flop;
architecture Behavioral of tb_d_flip_flop is
signal clk : STD_LOGIC := '0';
signal D : STD_LOGIC := '0';
signal Q : STD_LOGIC;
component d_flip_flop
Port (
clk : in STD_LOGIC;
D : in STD_LOGIC;
Q : out STD_LOGIC
);
end component;
begin
uut: d_flip_flop
port map (
clk => clk,
D => D,
Q => Q
);
clk_process :process
begin
clk <= '1';
wait for 100 ps;
clk <= '0';
wait for 100 ps;
end process;
stim_proc: process
begin
D <= '1'; wait for 80 ps;
D <= '0'; wait for 80 ps;
D <= '1'; wait for 80 ps;
D <= '0'; wait for 80 ps;
D <= '1'; wait for 80 ps;
D <= '0'; wait for 80 ps;
D <= '1'; wait for 80 ps;
D <= '0'; wait for 80 ps;
wait;
end process;
end Behavioral
RESULT
Thus the outputs of a program implementing D Flip Flop are verified by synthesizing
and simulating VHDL code. By completing this experiment, students will gain a deeper
understanding of D Flip Flop Problems encountered in the designing of D Flip Flop are
identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5) and results are verified
(PO3) through simulation (PO4).
4-BIT COUNTER
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
AIM
To develop the source code for 4-Bit Counter by using VHDL and obtain the simulation, synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter_4bit is
Port (
clk : in STD_LOGIC;
rst : in STD_LOGIC;
q : out STD_LOGIC_VECTOR (3 downto 0)
);
end counter_4bit;
q <= count;
end Behavioral;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity tb_counter_4bit is
end tb_counter_4bit;
begin
-- Instantiate the UUT
uut: counter_4bit
port map (
clk => clk,
rst => rst,
q => q
);
-- Clock process
clk_process :process
begin
clk <= '0';
wait for 10 ns;
clk <= '1';
wait for 10 ns;
end process;
-- Stimulus process
stim_proc: process
begin
-- Apply reset
rst <= '1';
wait for 20 ns;
rst <= '0';
wait for 100 ns;
-- End simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 4-Bit Counter are verified by synthesizing
and simulating VHDL code. By completing this experiment, students will gain a deeper
understanding of 4-Bit Counter Problems encountered in the designing of 4-Bit Counter are
identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5) and results are verified
(PO3) through simulation (PO4).
FPGA IMPLEMENTATION – 2-BIT COMPARATOR
BEHAVIOURAL MODEL
Simulation Result
RTL Analysis
EXP NO: 9a FPGA IMPLEMENTATION – 2-BIT COMPARATOR
DATE:
AIM
To develop the source code for 2-Bit Comparator by using VHDL and obtain the simulation,
synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity comparator_2bit is
Port (
A : in STD_LOGIC_VECTOR (1 downto 0);
B : in STD_LOGIC_VECTOR (1 downto 0);
A_eq_B: out STD_LOGIC;
A_gt_B: out STD_LOGIC;
A_lt_B: out STD_LOGIC
);
end comparator_2bit;
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity tb_comparator_2bit is
end tb_comparator_2bit;
begin
-- Instantiate the UUT
uut: comparator_2bit
port map (
A => A,
B => B,
A_eq_B=> A_eq_B,
A_gt_B=> A_gt_B,
A_lt_B=> A_lt_B
);
-- Stimulus process
stim_proc: process
begin
-- Test case 1: A = 00, B = 00
A <= "00"; B <= "00"; wait for 20 ns;
-- End simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing 2-Bit Comparator are verified by
synthesizing and simulating VHDL code. By completing this experiment, students will gain a
deeper understanding of 2-Bit Comparator Problems encountered in the designing of 2-Bit
Comparator are identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5) and
results are verified (PO3) through simulation (PO4).
SHIFT REGISTER
Simulation Result
RTL Analysis
EXP NO: 9b FPGA IMPLEMENTATION – SHIFT REGISTER
DATE:
AIM
To develop the source code for Shift Register by using VHDL and obtain the simulation, synthesis.
SOFTWARE REQUIREMENT
Xilinx Vivado 2023.1.1 Software
ALGORITHM
Step1: Define the specifications and initialize the design.
Step2: Declare the name of the entity and architecture by using VHDL source code.
Step3: Write the source code in VHDL.
Step4: Check the syntax and debug the errors if found, obtain the synthesis is report.
Step5: Verify the output by simulating the source code.
Step6: Write all possible combinations of input using the test bench.
PROGRAM
VHDL SOURCE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity shift_register is
Port (
clk : in STD_LOGIC;
rst : in STD_LOGIC;
d_in : in STD_LOGIC;
q_out : out STD_LOGIC_VECTOR (3 downto 0)
);
end shift_register;
LUT Design
TEST BENCH
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity tb_shift_register is
end tb_shift_register;
begin
-- Instantiate the UUT
uut: shift_register
port map (
clk => clk,
rst => rst,
d_in => d_in,
q_out => q_out
);
-- Clock process
clk_process :process
begin
clk <= '0';
wait for 10 ns;
clk <= '1';
wait for 10 ns;
end process;
-- Stimulus process
stim_proc: process
begin
-- Apply reset
rst <= '1';
wait for 20 ns;
rst <= '0';
wait for 20 ns;
-- Reset again
rst <= '1';
wait for 20 ns;
rst <= '0';
-- End simulation
wait;
end process;
end Behavioral;
RESULT
Thus the outputs of a program implementing Shift Register are verified by synthesizing
and simulating VHDL code. By completing this experiment, students will gain a deeper
understanding of Shift Register Problems encountered in the designing of Shift Register are
identified in the study (PO2) are analyzed with Xilinx Vivado tool (PO5) and results are verified
(PO3) through simulation (PO4).