Nexys2
Newbie level 5
Hi there,
I'm trying to program my Spartan 3E so I can display the PS2 codes on the 4 digit display. When starting, the display shows 0000. When I press 1,2,3,4 the display shows 1234. But I also want the display to show 1111 when I press four times the 1, and I don't know how to solve this. Anyone ideas?
inputchar is the 7 bit variable to display 1 digit.
I'm trying to program my Spartan 3E so I can display the PS2 codes on the 4 digit display. When starting, the display shows 0000. When I press 1,2,3,4 the display shows 1234. But I also want the display to show 1111 when I press four times the 1, and I don't know how to solve this. Anyone ideas?
Code:
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 13:11:30 05/17/2010
-- Design Name:
-- Module Name: charshift - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity charshift is
Port ( clk : in STD_LOGIC;
inputchar : in STD_LOGIC_VECTOR (6 downto 0);
char1 : out STD_LOGIC_VECTOR (6 downto 0);
char2 : out STD_LOGIC_VECTOR (6 downto 0);
char3 : out STD_LOGIC_VECTOR (6 downto 0);
char4 : out STD_LOGIC_VECTOR (6 downto 0) );
end charshift;
architecture Behavioral of charshift is
signal char1sig : STD_LOGIC_VECTOR (6 downto 0 );
signal char2sig : STD_LOGIC_VECTOR (6 downto 0 );
signal char3sig : STD_LOGIC_VECTOR (6 downto 0 );
signal char4sig : STD_LOGIC_VECTOR (6 downto 0 );
begin
char1 <= char1sig;
char2 <= char2sig;
char3 <= char3sig;
char4 <= char4sig;
process(clk)
begin
if ( clk = '1' and clk'event) then
if (inputchar /= char1sig) and (inputchar /= "1111111") then
char1sig <= inputchar;
char2sig <= char1sig;
char3sig <= char2sig;
char4sig <= char3sig;
else if (inputchar = char1sig) and (inputchar /= "1111111") then
--??
--??
--??
end if;
end if;
end process;
end Behavioral;
inputchar is the 7 bit variable to display 1 digit.