Line 10... |
Line 10... |
--
|
--
|
-- Dependencies : ieee.std_logic_1164
|
-- Dependencies : ieee.std_logic_1164
|
-- ieee.std_logic_unsigned
|
-- ieee.std_logic_unsigned
|
-- ieee.std_logic_arith
|
-- ieee.std_logic_arith
|
-- ieee.numeric_std
|
-- ieee.numeric_std
|
-- unisim.vcomponents
|
|
--
|
--
|
-- Author : Original Verilog version by John Clayton
|
-- Author : Original Verilog version by John Clayton
|
-- Converted to VHDL by John E. Kent
|
-- Converted to VHDL by John E. Kent
|
--
|
--
|
-- Email : dilbert57@opencores.org
|
-- Email : dilbert57@opencores.org
|
Line 152... |
Line 151... |
-- 2004-10-18 Added ctrl keys to ASCII ROM
|
-- 2004-10-18 Added ctrl keys to ASCII ROM
|
-- Added CAPS Lock toggle.
|
-- Added CAPS Lock toggle.
|
-- 2007-02-06 Added Generic Clock parameter
|
-- 2007-02-06 Added Generic Clock parameter
|
-- 2010-05-31 Revised header, added GPL
|
-- 2010-05-31 Revised header, added GPL
|
-- 2010-06-17 Change some signal names for consistancy
|
-- 2010-06-17 Change some signal names for consistancy
|
--
|
-- 2010-10-24 Rearranged code to prevent shift key outputting characters
|
--
|
--
|
--
|
--
|
---------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
library unisim;
|
--library unisim;
|
use unisim.vcomponents.all;
|
-- use unisim.vcomponents.all;
|
|
|
entity ps2_keyboard is
|
entity ps2_keyboard is
|
generic (
|
generic (
|
CLK_FREQ_MHZ : integer
|
CLK_FREQ_MHZ : integer
|
);
|
);
|
Line 201... |
Line 200... |
constant EXTEND_CODE : integer := 16#E0#;
|
constant EXTEND_CODE : integer := 16#E0#;
|
constant RELEASE_CODE : integer := 16#F0#;
|
constant RELEASE_CODE : integer := 16#F0#;
|
constant LEFT_SHIFT : integer := 16#12#;
|
constant LEFT_SHIFT : integer := 16#12#;
|
constant RIGHT_SHIFT : integer := 16#59#;
|
constant RIGHT_SHIFT : integer := 16#59#;
|
constant CTRL_CODE : integer := 16#14#;
|
constant CTRL_CODE : integer := 16#14#;
|
|
constant LEFT_ALT : integer := 16#11#;
|
constant CAPS_CODE : integer := 16#58#;
|
constant CAPS_CODE : integer := 16#58#;
|
|
constant SCROLL_LOCK : integer := 16#7E#;
|
|
constant NUM_LOCK : integer := 16#77#;
|
|
|
|
|
-- constants
|
-- constants
|
|
|
-- The timer value can be up to (2^bits) inclusive.
|
-- The timer value can be up to (2^bits) inclusive.
|
Line 226... |
Line 228... |
--constant TIMER_60USEC_BITS_PP : integer := 11; -- Number of bits needed for timer
|
--constant TIMER_60USEC_BITS_PP : integer := 11; -- Number of bits needed for timer
|
--constant TIMER_5USEC_VALUE_PP : integer := 125; -- Number of sys_clks for debounce
|
--constant TIMER_5USEC_VALUE_PP : integer := 125; -- Number of sys_clks for debounce
|
--constant TIMER_5USEC_BITS_PP : integer := 7; -- Number of bits needed for timer
|
--constant TIMER_5USEC_BITS_PP : integer := 7; -- Number of bits needed for timer
|
|
|
-- Values for generic Clock up to 50 MHz
|
-- Values for generic Clock up to 50 MHz
|
constant TIMER_60USEC_VALUE_PP : integer := CLK_FREQ_MHZ * 60; -- Number of sys_clks for 60usec.
|
constant TIMER_60USEC_VALUE_PP : integer := CLK_FREQ_MHZ * 60; -- Number of clock cycles for 60usec.
|
constant TIMER_60USEC_BITS_PP : integer := 12; -- Number of bits needed for timer
|
constant TIMER_60USEC_BITS_PP : integer := 12; -- Number of bits needed for timer
|
constant TIMER_5USEC_VALUE_PP : integer := CLK_FREQ_MHZ * 5; -- Number of sys_clks for debounce
|
constant TIMER_5USEC_VALUE_PP : integer := CLK_FREQ_MHZ * 5; -- Number of clock cycles for debounce
|
constant TIMER_5USEC_BITS_PP : integer := 8; -- Number of bits needed for timer
|
constant TIMER_5USEC_BITS_PP : integer := 8; -- Number of bits needed for timer
|
|
|
constant TRAP_SHIFT_KEYS_PP : integer := 1; -- Default: No shift key trap.
|
constant TRAP_SHIFT_KEYS_PP : integer := 1; -- Default: No shift key trap.
|
|
|
-- State encodings, provided as constants
|
-- State encodings, provided as constants
|
Line 383... |
Line 385... |
tx_error <= '0';
|
tx_error <= '0';
|
enable_timer_60usec <= '0';
|
enable_timer_60usec <= '0';
|
enable_timer_5usec <= '0';
|
enable_timer_5usec <= '0';
|
|
|
case (m1_state) is
|
case (m1_state) is
|
|
--
|
|
-- receive clock transitions
|
|
--
|
when m1_rx_clk_h =>
|
when m1_rx_clk_h =>
|
enable_timer_60usec <= '1';
|
enable_timer_60usec <= '1';
|
if (tx_write = '1') then
|
if (tx_write = '1') then
|
m1_next_state <= m1_tx_reset_timer;
|
m1_next_state <= m1_tx_reset_timer;
|
elsif (ps2_clk_s = '0') then
|
elsif (ps2_clk_s = '0') then
|
Line 411... |
Line 416... |
|
|
when m1_rx_rising_edge_marker =>
|
when m1_rx_rising_edge_marker =>
|
enable_timer_60usec <= '0';
|
enable_timer_60usec <= '0';
|
m1_next_state <= m1_rx_clk_h;
|
m1_next_state <= m1_rx_clk_h;
|
|
|
|
--
|
|
-- write to keyboard (Tx)
|
|
--
|
when m1_tx_reset_timer =>
|
when m1_tx_reset_timer =>
|
enable_timer_60usec <= '0';
|
enable_timer_60usec <= '0';
|
m1_next_state <= m1_tx_force_clk_l;
|
m1_next_state <= m1_tx_force_clk_l;
|
|
|
when m1_tx_force_clk_l =>
|
when m1_tx_force_clk_l =>
|
Line 506... |
Line 514... |
when others =>
|
when others =>
|
m1_next_state <= m1_rx_clk_h;
|
m1_next_state <= m1_rx_clk_h;
|
end case;
|
end case;
|
end process;
|
end process;
|
|
|
|
--
|
-- This is the bit counter
|
-- This is the bit counter
|
|
--
|
bit_counter: process(clk, reset, m1_state, bit_count )
|
bit_counter: process(clk, reset, m1_state, bit_count )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if ( reset = '1' ) or
|
if ( reset = '1' ) or ( rx_shifting_done = '1' ) or
|
( rx_shifting_done = '1' ) or
|
|
(m1_state = m1_tx_wait_keyboard_ack) then -- After tx is done.
|
(m1_state = m1_tx_wait_keyboard_ack) then -- After tx is done.
|
bit_count <= "0000"; -- normal reset
|
bit_count <= "0000"; -- normal reset
|
elsif (timer_60usec_done = '1' ) and
|
elsif (timer_60usec_done = '1' ) and
|
(m1_state = m1_rx_clk_h) and
|
(m1_state = m1_rx_clk_h) and
|
(ps2_clk_s = '1') then
|
(ps2_clk_s = '1') then
|
Line 523... |
Line 532... |
elsif (m1_state = m1_rx_falling_edge_marker) or -- increment for rx
|
elsif (m1_state = m1_rx_falling_edge_marker) or -- increment for rx
|
(m1_state = m1_tx_rising_edge_marker) then -- increment for tx
|
(m1_state = m1_tx_rising_edge_marker) then -- increment for tx
|
bit_count <= bit_count + 1;
|
bit_count <= bit_count + 1;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
|
|
|
assign: process( bit_count, tx_write, tx_data_empty_o, m1_state )
|
|
begin
|
|
if (bit_count = TOTAL_BITS) then
|
if (bit_count = TOTAL_BITS) then
|
rx_shifting_done <= '1';
|
rx_shifting_done <= '1';
|
else
|
else
|
rx_shifting_done <= '0';
|
rx_shifting_done <= '0';
|
end if;
|
end if;
|
Line 538... |
Line 544... |
if (bit_count = (TOTAL_BITS-1)) then
|
if (bit_count = (TOTAL_BITS-1)) then
|
tx_shifting_done <= '1';
|
tx_shifting_done <= '1';
|
else
|
else
|
tx_shifting_done <= '0';
|
tx_shifting_done <= '0';
|
end if;
|
end if;
|
|
end process;
|
|
|
|
assign: process( bit_count, tx_write, m1_state, tx_data_empty_o, m1_state )
|
|
begin
|
|
--
|
-- This is the signal which enables loading of the shift register.
|
-- This is the signal which enables loading of the shift register.
|
-- It also indicates "ack" to the device writing to the transmitter.
|
-- It also indicates "ack" to the device writing to the transmitter.
|
|
--
|
if ((tx_write = '1') and (m1_state = m1_rx_clk_h)) or
|
if ((tx_write = '1') and (m1_state = m1_rx_clk_h)) or
|
((tx_write = '1') and (m1_state = m1_rx_clk_l)) then
|
((tx_write = '1') and (m1_state = m1_rx_clk_l)) then
|
tx_data_empty_o <= '1';
|
tx_data_empty_o <= '1';
|
else
|
else
|
tx_data_empty_o <= '0';
|
tx_data_empty_o <= '0';
|
end if;
|
end if;
|
tx_data_empty <= tx_data_empty_o;
|
tx_data_empty <= tx_data_empty_o;
|
end process;
|
end process;
|
|
|
|
-- This is the shift register
|
|
q_shift : process(clk, tx_data_empty_o, tx_parity_bit, tx_data,
|
|
m1_state, q, ps2_data_s, rx_shifting_done )
|
|
begin
|
|
--
|
-- This is the ODD parity bit for the transmitted word.
|
-- This is the ODD parity bit for the transmitted word.
|
-- assign tx_parity_bit = ~^tx_data;
|
-- assign tx_parity_bit = ~^tx_data;
|
--
|
--
|
tx_parity_bit <= not( tx_data(7) xor tx_data(6) xor tx_data(5) xor tx_data(4) xor
|
tx_parity_bit <= not( tx_data(7) xor tx_data(6) xor tx_data(5) xor tx_data(4) xor
|
tx_data(3) xor tx_data(2) xor tx_data(1) xor tx_data(0) );
|
tx_data(3) xor tx_data(2) xor tx_data(1) xor tx_data(0) );
|
|
|
-- This is the shift register
|
|
q_shift : process(clk, tx_data_empty_o, tx_parity_bit, tx_data,
|
|
m1_state, q, ps2_data_s, rx_shifting_done )
|
|
begin
|
|
if clk'event and clk='0' then
|
if clk'event and clk='0' then
|
if (reset = '1') then
|
if (reset = '1') then
|
q <= "00000000000";
|
q <= (others=>'0');
|
elsif (tx_data_empty_o = '1') then
|
elsif (tx_data_empty_o = '1') then
|
q <= "1" & tx_parity_bit & tx_data & "0";
|
q <= "1" & tx_parity_bit & tx_data & "0";
|
elsif ( (m1_state = m1_rx_falling_edge_marker) or
|
elsif ( (m1_state = m1_rx_falling_edge_marker) or
|
(m1_state = m1_tx_rising_edge_marker) ) then
|
(m1_state = m1_tx_rising_edge_marker) ) then
|
q <= ps2_data_s & q((TOTAL_BITS-1) downto 1);
|
q <= ps2_data_s & q((TOTAL_BITS-1) downto 1);
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
-- Create the signals which indicate special scan codes received.
|
|
-- These are the "unlatched versions."
|
|
if (q(8 downto 1) = EXTEND_CODE) and (rx_shifting_done = '1') then
|
|
extended <= '1';
|
|
else
|
|
extended <= '0';
|
|
end if;
|
|
if (q(8 downto 1) = RELEASE_CODE) and (rx_shifting_done = '1') then
|
|
released <= '1';
|
|
else
|
|
released <= '0';
|
|
end if;
|
|
end process;
|
end process;
|
|
|
|
--
|
-- This is the 60usec timer counter
|
-- This is the 60usec timer counter
|
|
--
|
timer60usec: process(clk, enable_timer_60usec, timer_60usec_count)
|
timer60usec: process(clk, enable_timer_60usec, timer_60usec_count)
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (enable_timer_60usec = '0') then
|
if (enable_timer_60usec = '0') then
|
timer_60usec_count <= (others => '0');
|
timer_60usec_count <= (others => '0');
|
Line 603... |
Line 605... |
else
|
else
|
timer_60usec_done <= '0';
|
timer_60usec_done <= '0';
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
--
|
-- This is the 5usec timer counter
|
-- This is the 5usec timer counter
|
|
--
|
timer5usec : process(clk, enable_timer_5usec, timer_5usec_count )
|
timer5usec : process(clk, enable_timer_5usec, timer_5usec_count )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (enable_timer_5usec = '0') then
|
if (enable_timer_5usec = '0') then
|
timer_5usec_count <= (others => '0');
|
timer_5usec_count <= (others => '0');
|
Line 621... |
Line 625... |
else
|
else
|
timer_5usec_done <= '0';
|
timer_5usec_done <= '0';
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
--
|
|
-- Create the signals which indicate special scan codes received.
|
|
-- These are the "unlatched versions."
|
|
--
|
|
extend_release_decode : process( q, rx_shifting_done, extended, released )
|
|
begin
|
|
if (q(8 downto 1) = EXTEND_CODE) and (rx_shifting_done = '1') then
|
|
extended <= '1';
|
|
else
|
|
extended <= '0';
|
|
end if;
|
|
|
|
if (q(8 downto 1) = RELEASE_CODE) and (rx_shifting_done = '1') then
|
|
released <= '1';
|
|
else
|
|
released <= '0';
|
|
end if;
|
|
|
|
if (rx_shifting_done = '1') and (extended = '0') and (released = '0') then
|
|
rx_output_event <= '1';
|
|
else
|
|
rx_output_event <= '0';
|
|
end if;
|
|
|
|
end process;
|
|
|
|
--
|
-- Store the special scan code status bits
|
-- Store the special scan code status bits
|
-- Not the final output, but an intermediate storage place,
|
-- Not the final output, but an intermediate storage place,
|
-- until the entire set of output data can be assembled.
|
-- until the entire set of output data can be assembled.
|
|
--
|
special_scan : process(clk, reset, rx_output_event, rx_shifting_done, extended, released )
|
special_scan : process(clk, reset, rx_output_event, rx_shifting_done, extended, released )
|
begin
|
begin
|
if clk'event and clk='0' then
|
if clk'event and clk='0' then
|
if (reset = '1') or (rx_output_event = '1') then
|
if (reset = '1') or (rx_output_event = '1') then
|
hold_extended <= '0';
|
hold_extended <= '0';
|
Line 640... |
Line 671... |
if (rx_shifting_done = '1') and (released = '1') then
|
if (rx_shifting_done = '1') and (released = '1') then
|
hold_released <= '1';
|
hold_released <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
end process;
|
end process;
|
|
|
|
--
|
|
-- convert scan code to ascii code
|
|
--
|
|
scan_to_ascii : process( shift_key_on, caps_key_on, q )
|
|
begin
|
|
shift_key_plus_code <= shift_key_on & caps_key_on & q(7 downto 1);
|
|
end process;
|
|
|
|
--
|
-- These bits contain the status of the two shift keys
|
-- These bits contain the status of the two shift keys
|
|
--
|
left_shift_proc : process(clk, reset, q, rx_shifting_done, hold_released )
|
left_shift_proc : process(clk, reset, q, rx_shifting_done, hold_released )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (reset = '1') then
|
if (reset = '1') then
|
left_shift_key <= '0';
|
left_shift_key <= '0';
|
elsif (q(8 downto 1) = LEFT_SHIFT) and
|
elsif (q(8 downto 1) = LEFT_SHIFT) and (rx_shifting_done = '1') then
|
(rx_shifting_done = '1') and
|
left_shift_key <= not hold_released;
|
(hold_released = '0') then
|
|
left_shift_key <= '1';
|
|
elsif (q(8 downto 1) = LEFT_SHIFT) and
|
|
(rx_shifting_done = '1') and
|
|
(hold_released = '1') then
|
|
left_shift_key <= '0';
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
right_shift_proc : process(clk, reset, q, rx_shifting_done, hold_released )
|
right_shift_proc : process(clk, reset, q, rx_shifting_done, hold_released )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (reset = '1') then
|
if (reset = '1') then
|
right_shift_key <= '0';
|
right_shift_key <= '0';
|
elsif (q(8 downto 1) = RIGHT_SHIFT) and
|
elsif (q(8 downto 1) = RIGHT_SHIFT) and (rx_shifting_done = '1') then
|
(rx_shifting_done = '1') and
|
right_shift_key <= not hold_released;
|
(hold_released = '0') then
|
|
right_shift_key <= '1';
|
|
elsif (q(8 downto 1) = RIGHT_SHIFT) and
|
|
(rx_shifting_done = '1') and
|
|
(hold_released = '1') then
|
|
right_shift_key <= '0';
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
shift_proc : process( left_shift_key, right_shift_key, shift_key_on, caps_key_on, q )
|
|
begin
|
shift_key_on <= left_shift_key or right_shift_key;
|
shift_key_on <= left_shift_key or right_shift_key;
|
rx_shift_on <= shift_key_on;
|
rx_shift_on <= shift_key_on;
|
|
end process;
|
|
|
--
|
--
|
-- Control keys
|
-- Control keys
|
--
|
--
|
ctrl_proc : process(clk, reset, q, rx_shifting_done, hold_released )
|
ctrl_proc : process(clk, reset, q, rx_shifting_done, hold_released )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (reset = '1') then
|
if (reset = '1') then
|
ctrl_key_on <= '0';
|
ctrl_key_on <= '0';
|
elsif (q(8 downto 1) = CTRL_CODE) and
|
elsif (q(8 downto 1) = CTRL_CODE) and (rx_shifting_done = '1') then
|
(rx_shifting_done = '1') and
|
ctrl_key_on <= not hold_released;
|
(hold_released = '0') then
|
|
ctrl_key_on <= '1';
|
|
elsif (q(8 downto 1) = CTRL_CODE) and
|
|
(rx_shifting_done = '1') and
|
|
(hold_released = '1') then
|
|
ctrl_key_on <= '0';
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
--
|
--
|
Line 709... |
Line 735... |
caps_proc : process(clk, reset, q, rx_shifting_done, hold_released, caps_key_on )
|
caps_proc : process(clk, reset, q, rx_shifting_done, hold_released, caps_key_on )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (reset = '1') then
|
if (reset = '1') then
|
caps_key_on <= '0';
|
caps_key_on <= '0';
|
elsif (q(8 downto 1) = CAPS_CODE) and
|
elsif (q(8 downto 1) = CAPS_CODE) and (rx_shifting_done = '1') then
|
(rx_shifting_done = '1') and
|
if (hold_released = '0') then
|
(hold_released = '0') then
|
|
caps_key_on <= not caps_key_on;
|
caps_key_on <= not caps_key_on;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
end if;
|
end process;
|
end process;
|
|
|
|
--
|
-- Output the special scan code flags, the scan code and the ascii
|
-- Output the special scan code flags, the scan code and the ascii
|
special_scan_proc : process(clk, reset,
|
--
|
|
special_scan_proc : process(clk, reset, rx_output_strobe,
|
hold_extended, hold_released,
|
hold_extended, hold_released,
|
q, ascii, ctrl_key_on )
|
ascii, ctrl_key_on )
|
begin
|
begin
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if (reset = '1') then
|
if (reset = '1') then
|
rx_extended <= '0';
|
rx_extended <= '0';
|
rx_released <= '0';
|
rx_released <= '0';
|
-- rx_scan_code <= "00000000";
|
rx_data <= (others=>'0');
|
rx_data <= "00000000";
|
|
elsif (rx_output_strobe = '1') then
|
elsif (rx_output_strobe = '1') then
|
rx_extended <= hold_extended;
|
rx_extended <= hold_extended;
|
rx_released <= hold_released;
|
rx_released <= hold_released;
|
-- rx_scan_code <= q(8 downto 1);
|
if ctrl_key_on = '1' then
|
elsif ctrl_key_on = '1' then
|
|
rx_data <= ascii and x"1f";
|
rx_data <= ascii and x"1f";
|
else
|
else
|
rx_data <= ascii;
|
rx_data <= ascii;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
end if;
|
end process;
|
end process;
|
|
|
|
--
|
-- Store the final rx output data only when all extend and release codes
|
-- Store the final rx output data only when all extend and release codes
|
-- are received and the next (actual key) scan code is also ready.
|
-- are received and the next (actual key) scan code is also ready.
|
-- (the presence of rx_extended or rx_released refers to the
|
-- (the presence of rx_extended or rx_released refers to the
|
-- the current latest scan code received, not the previously latched flags.)
|
-- the current latest scan code received, not the previously latched flags.)
|
|
--
|
rx_output_proc : process( clk, reset,
|
rx_output_proc : process( clk, reset,
|
rx_shifting_done, rx_output_strobe,
|
rx_shifting_done, rx_output_strobe,
|
extended, released,
|
extended, released,
|
|
hold_extended, hold_released,
|
q, ascii, rx_read )
|
q, ascii, rx_read )
|
begin
|
begin
|
if (rx_shifting_done = '1') and (extended = '0') and (released = '0') then
|
|
rx_output_event <= '1';
|
|
else
|
|
rx_output_event <= '0';
|
|
end if;
|
|
|
|
if clk'event and clk = '0' then
|
if clk'event and clk = '0' then
|
if reset = '1' then
|
if reset = '1' then
|
rx_output_strobe <= '0';
|
rx_output_strobe <= '0';
|
elsif (rx_shifting_done = '1') and
|
elsif (rx_shifting_done = '1') and (rx_output_strobe = '0') and
|
(rx_output_strobe = '0') and
|
(extended = '0') and (released = '0') and
|
(extended = '0') and
|
|
(released = '0') and
|
|
(hold_released = '0' ) and
|
(hold_released = '0' ) and
|
(ascii /= x"00" ) then
|
(ascii /= "00000000" ) then
|
-- ((TRAP_SHIFT_KEYS_PP = 0) or
|
-- ((TRAP_SHIFT_KEYS_PP = 0) or
|
-- ( (q(8 downto 1) /= RIGHT_SHIFT) and
|
-- ( (q(8 downto 1) /= RIGHT_SHIFT) and
|
-- (q(8 downto 1) /= LEFT_SHIFT) and
|
-- (q(8 downto 1) /= LEFT_SHIFT) and
|
-- (q(8 downto 1) /= CTRL_CODE) ) )then
|
-- (q(8 downto 1) /= CTRL_CODE) ) )then
|
rx_output_strobe <= '1';
|
rx_output_strobe <= '1';
|
Line 777... |
Line 798... |
end if;
|
end if;
|
end if;
|
end if;
|
rx_data_ready <= rx_output_strobe;
|
rx_data_ready <= rx_output_strobe;
|
end process;
|
end process;
|
|
|
|
--
|
-- This part translates the scan code into an ASCII value...
|
-- This part translates the scan code into an ASCII value...
|
-- Only the ASCII codes which I considered important have been included.
|
-- Only the ASCII codes which I considered important have been included.
|
-- if you want more, just add the appropriate case statement lines...
|
-- if you want more, just add the appropriate case statement lines...
|
-- (You will need to know the keyboard scan codes you wish to assign.)
|
-- (You will need to know the keyboard scan codes you wish to assign.)
|
-- The entries are listed in ascending order of ASCII value.
|
-- The entries are listed in ascending order of ASCII value.
|
shift_key_plus_code <= shift_key_on & caps_key_on & q(7 downto 1);
|
--
|
|
|
--shift_map : process( shift_key_plus_code )
|
--shift_map : process( shift_key_plus_code )
|
--begin
|
--begin
|
-- case shift_key_plus_code is
|
-- case shift_key_plus_code is
|
-- when x"066" => ascii <= x"08"; -- Backspace ("backspace" key)
|
-- when x"066" => ascii <= x"08"; -- Backspace ("backspace" key)
|
-- when x"166" => ascii <= x"08"; -- Backspace ("backspace" key)
|
-- when x"166" => ascii <= x"08"; -- Backspace ("backspace" key)
|
Line 894... |
Line 914... |
-- when x"15d" => ascii <= x"7c"; -- |
|
-- when x"15d" => ascii <= x"7c"; -- |
|
-- when x"15b" => ascii <= x"7d"; -- }
|
-- when x"15b" => ascii <= x"7d"; -- }
|
-- when x"10e" => ascii <= x"7e"; -- ~
|
-- when x"10e" => ascii <= x"7e"; -- ~
|
-- when x"071" => ascii <= x"7f"; -- (Delete OR DEL on numeric keypad)
|
-- when x"071" => ascii <= x"7f"; -- (Delete OR DEL on numeric keypad)
|
-- when x"171" => ascii <= x"7f"; -- (Delete OR DEL on numeric keypad)
|
-- when x"171" => ascii <= x"7f"; -- (Delete OR DEL on numeric keypad)
|
-- when others => ascii <= x"ff"; -- 0xff used for unlisted characters.
|
-- when others => ascii <= x"00"; -- 0xff used for unlisted characters.
|
-- end case;
|
-- end case;
|
--end process;
|
--end process;
|
|
|
|
|
end rtl;
|
end rtl;
|
|
|
No newline at end of file
|
No newline at end of file
|