01-08-2016, 04:05 PM
Introduction
The purpose of this lab is to implement a finite state machine in VHDL to perform three simple calculations: addition, subtraction, and multiplication. You are required to design a calculator using VHDL. It should take in 3 inputs: two 4-bit operands and a 2-bit operator. Check it's functionality using ALDEC VHDL simulator, then wire up the DIP switch to the XS40 board and download your program unto XS40 board and verify correctness again.
Apparatus Required:
10 pin DIP Switch
XS40 Board
Program:
--
-- Tony Givargis
--
--********************************************************************
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
--********************************************************************
entity WRLED is
port (rst: in STD_LOGIC;
clk: in STD_LOGIC;
val : in UNSIGNED(3 downto 0);
led: out UNSIGNED(6 downto 0));
end WRLED;
--********************************************************************
architecture WRLED_arch of WRLED is
-- finish entity
end WRLED_arch;
--********************************************************************
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
--********************************************************************
entity XS40 is
port (rst: in STD_LOGIC;
clk: in STD_LOGIC;
--define operands and operator here
led: out UNSIGNED(6 downto 0));
end XS40;
--********************************************************************
architecture XS40_ARCH of XS40 is
component WRLED
port(val: in UNSIGNED(3 downto 0);
led: out UNSIGNED(6 downto 0));
end component;
signal val:UNSIGNED(3 downto 0);
begin
U1:WRLED port map(val, led);
process(rst, clk, ...)
-- insert calculator code here
end process;
end XS40_ARCH;
I. Procedure
simulation:
Complete the code and test the functionality using ALDEC VHDL.
You may find the 7-segment display diagram useful to complete the WRLED entity.
Show TA the waveforms.
downloading:
If you are unfamiliar with downloading to the XS40 board, run through the tutorial and see if you can get the XS40 board to count.
(Remember: Jumper on J4 needs to be set when loading program but disconnected when running program)
Wire up the circuit, it is up to you to choose the connections. You will probably need the circuit diagram or the XS40 board manual.
You will need to create a .ucf to download your VHDL calculator.
Generate a bit file and download your program unto the XS40 board and test your program.
The purpose of this lab is to implement a finite state machine in VHDL to perform three simple calculations: addition, subtraction, and multiplication. You are required to design a calculator using VHDL. It should take in 3 inputs: two 4-bit operands and a 2-bit operator. Check it's functionality using ALDEC VHDL simulator, then wire up the DIP switch to the XS40 board and download your program unto XS40 board and verify correctness again.
Apparatus Required:
10 pin DIP Switch
XS40 Board
Program:
--
-- Tony Givargis
--
--********************************************************************
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
--********************************************************************
entity WRLED is
port (rst: in STD_LOGIC;
clk: in STD_LOGIC;
val : in UNSIGNED(3 downto 0);
led: out UNSIGNED(6 downto 0));
end WRLED;
--********************************************************************
architecture WRLED_arch of WRLED is
-- finish entity
end WRLED_arch;
--********************************************************************
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
--********************************************************************
entity XS40 is
port (rst: in STD_LOGIC;
clk: in STD_LOGIC;
--define operands and operator here
led: out UNSIGNED(6 downto 0));
end XS40;
--********************************************************************
architecture XS40_ARCH of XS40 is
component WRLED
port(val: in UNSIGNED(3 downto 0);
led: out UNSIGNED(6 downto 0));
end component;
signal val:UNSIGNED(3 downto 0);
begin
U1:WRLED port map(val, led);
process(rst, clk, ...)
-- insert calculator code here
end process;
end XS40_ARCH;
I. Procedure
simulation:
Complete the code and test the functionality using ALDEC VHDL.
You may find the 7-segment display diagram useful to complete the WRLED entity.
Show TA the waveforms.
downloading:
If you are unfamiliar with downloading to the XS40 board, run through the tutorial and see if you can get the XS40 board to count.
(Remember: Jumper on J4 needs to be set when loading program but disconnected when running program)
Wire up the circuit, it is up to you to choose the connections. You will probably need the circuit diagram or the XS40 board manual.
You will need to create a .ucf to download your VHDL calculator.
Generate a bit file and download your program unto the XS40 board and test your program.