AIM OF THE EXPERIMENT:-Binary To Decimal, Gray Code Apparatus Required
AIM OF THE EXPERIMENT:-Binary To Decimal, Gray Code Apparatus Required
AIM OF THE EXPERIMENT:-Binary To Decimal, Gray Code Apparatus Required
end binaryconv;
if (SW="0000") then
LED <= "00000000";
elsif (SW="0001") then
LED <= "00000001";
elsif (SW="0010") then
LED <= "00000011";
elsif (SW="0011") then
LED <= "00000010";
elsif (SW="0100") then
LED <= "00000111";
elsif (SW="0101") then
LED <= "00000110";
elsif (SW="0110") then
LED <= "00000100";
elsif (SW="0111") then
LED <= "00000101";
elsif (SW="1000") then
LED <= "00001111";
elsif (SW="1001") then
LED <= "00001110";
elsif (SW="1010") then
LED <= "00001100";
elsif (SW="1011") then
LED <= "00001101";
elsif (SW="1100") then
LED <= "00001000";
elsif (SW="1101") then
LED <= "00001001";
elsif (SW="1110") then
LED <= "00001011";
else
LED <= "00001010";
end if;
ELSE
END IF;
if BTN_NORTH='0' AND BTN_SOUTH='0' AND BTN_EAST='0' AND BTN_WEST='1'
then-- BINARY TO HEXADECIMAL
IF SW<="1001" THEN
SF_D<="00100011";
S1<="0010" & SW;
SF_D<=S1;
ELSE
if SW>="1001" THEN
if (SW="1010") then
SF_D <= "00010100";
SF_D <= "01000001";
elsif (SW="1011") then
SF_D <= "00010100";
SF_D <= "01000010";
elsif (SW="1100") then
SF_D <= "00010100";
SF_D <= "01000011";
elsif (SW="1101") then
SF_D <= "00010100";
SF_D <= "01000100";
elsif (SW="1110") then
SF_D <= "00010100";
SF_D <= "01000101";
elsif (SW="1111") then
SF_D <= "00010100";
SF_D <= "01000110";
end if;
END IF;
end if;
end if;
end process;
end Behavioral;
constraints.ucf
#rotation button
NET "BTN_EAST" LOC = "H13" | IOSTANDARD = LVTTL | PULLDOWN ;
NET "BTN_NORTH" LOC = "V4" | IOSTANDARD = LVTTL | PULLDOWN ;
NET "BTN_SOUTH" LOC = "K17" | IOSTANDARD = LVTTL | PULLDOWN ;
NET "BTN_WEST" LOC = "D18" | IOSTANDARD = LVTTL | PULLDOWN ;
#switches
NET "SW<0>" LOC = "L13" | IOSTANDARD = LVTTL | PULLUP ;
NET "SW<1>" LOC = "L14" | IOSTANDARD = LVTTL | PULLUP ;
NET "SW<2>" LOC = "H18" | IOSTANDARD = LVTTL | PULLUP ;
NET "SW<3>" LOC = "N17" | IOSTANDARD = LVTTL | PULLUP ;
#character lcd
NET "LCD_E" LOC = "M18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW =
SLOW ;
NET "LCD_RS" LOC = "L18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW
;
NET "LCD_RW" LOC = "L17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW
;
# The LCD four-bit data interface is shared with the StrataFlash.
NET "SF_D<4>" LOC = "R15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW =
SLOW ;
NET "SF_D<5>" LOC = "R16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW =
SLOW ;
NET "SF_D<6>" LOC = "P17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW =
SLOW ;
NET "SF_D<7>" LOC = "M15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW =
SLOW ;
#clk
NET "CLK_50MHZ" LOC = "C9" | IOSTANDARD = LVCMOS33 ;
#LED
NET "LED<7>" LOC = "F9" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<6>" LOC = "E9" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<5>" LOC = "D11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<4>" LOC = "C11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<3>" LOC = "F11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<2>" LOC = "E11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<1>" LOC = "E12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "LED<0>" LOC = "F12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
Test Bench:-
--------------------------------------------------------------------------
------
-- Company:
-- Engineer:
--
-- Create Date: 00:19:55 04/11/2017
-- Design Name:
-- Module Name: D:/vlsi/vlsiproject/binaryconvtest.vhd
-- Project Name: vlsiproject
-- Target Device:
-- Tool versions:
-- Description:
--
-- VHDL Test Bench Created by ISE for module: binaryconv
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
-- Notes:
-- This testbench has been automatically generated using types std_logic
and
-- std_logic_vector for the ports of the unit under test. Xilinx
recommends
-- that these types always be used for the top-level I/O of a design in
order
-- to guarantee that the testbench will bind correctly to the post-
implementation
-- simulation model.
--------------------------------------------------------------------------
------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY binaryconvtest IS
END binaryconvtest;
COMPONENT binaryconv
PORT(
BTN_EAST : IN std_logic;
CLK_50MHZ : IN std_logic;
BTN_NORTH : IN std_logic;
BTN_SOUTH : IN std_logic;
LCD_E : IN std_logic;
LCD_RS : IN std_logic;
LCD_RW : IN std_logic;
BTN_WEST : IN std_logic;
SW : IN std_logic_vector(3 downto 0);
SF_D : OUT std_logic_vector(7 downto 0);
LED : OUT std_logic_vector(7 downto 0)
);
END COMPONENT;
--Inputs
signal BTN_EAST : std_logic := '0';
signal CLK_50MHZ : std_logic := '0';
signal BTN_NORTH : std_logic := '0';
signal BTN_SOUTH : std_logic := '0';
signal LCD_E : std_logic := '0';
signal LCD_RS : std_logic := '0';
signal LCD_RW : std_logic := '0';
signal BTN_WEST : std_logic := '0';
signal SW : std_logic_vector(3 downto 0) := (others => '0');
--Outputs
signal SF_D : std_logic_vector(7 downto 0);
signal LED : std_logic_vector(7 downto 0);
BEGIN
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
wait for CLK_50MHZ_period*10;
wait;
end process;
END;