Guest
Hello,
I am trying to write a code to scan the code generated by the keyboard
through an FPGA board. The project is now in an early development
stage.
Heres the most basic process in which I try to synchronise the inputs
to the system viz. kb_clk and data to the on board 'sys_clk', the
system clk.
heres the code ive written,
Library ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
entity code_test_process1 is
port(
kb_clk : IN std_logic;
data : IN std_logic_vector(7 downto 0));
end code_test_process1;
architecture trial1 of code_test_process1 is
signal sys_clk : std_logic;
signal current_kbclk : std_logic;
signal current_data : std_logic_vector(7 downto 0);
begin
process(sys_clk)
begin
if rising_edge(sys_clk) then
current_kbclk <= kb_clk;
current_data <= data;
end if;
end process;
end trial1;
the test bench file for the above program is here:
library work;
Library ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
use work.all;
entity test_bench is
begin
end test_bench;
architecture test of test_bench is
signal kb_clk,sys_clk : std_logic;
signal data : std_logic_vector(7 downto 0);
component code_test_process1 is
port(
kb_clk : IN std_logic;
data : IN std_logic_vector(7 downto 0));
end component code_test_process1;
for all:code_test_process1 use entity
work.code_test_process1(trial1);
begin
P1:code_test_process1 port map(kb_clk => kb_clk,data =>
data);
process
begin
data <= X"10" after 100 ns,X"08" after 200
ns,X"A2" after 300 ns,X"2F" after 400 ns,X"11" after 500 ns,X"3C" after
600 ns;
sys_clk <= '1' after 150 ns,'0' after 250 ns,'1'
after 420 ns,'0' after 475 ns,'1' after 550 ns,'1' after 570 ns;
kb_clk <= '1' after 50 ns,'0' after 100 ns,'1'
after 150 ns,'0' after 200 ns,'1' after 250 ns,'0' after 300 ns,'1'
after 350 ns,'0' after 400 ns,'1' after 450 ns,'0' after 500 ns,'1'
after 550 ns,'0' after 600 ns;
wait;
end process;
end test;
What I don't understand now is how do I display the contents of the
signals current_kbclk and current_data which are internal to the entity
code_test_process1 so that I may check if the inputs are sampled only
at sys_clk or not. How do I display those signals as well on the wave?
Best Regards,
Aijaz Baig.
I am trying to write a code to scan the code generated by the keyboard
through an FPGA board. The project is now in an early development
stage.
Heres the most basic process in which I try to synchronise the inputs
to the system viz. kb_clk and data to the on board 'sys_clk', the
system clk.
heres the code ive written,
Library ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
entity code_test_process1 is
port(
kb_clk : IN std_logic;
data : IN std_logic_vector(7 downto 0));
end code_test_process1;
architecture trial1 of code_test_process1 is
signal sys_clk : std_logic;
signal current_kbclk : std_logic;
signal current_data : std_logic_vector(7 downto 0);
begin
process(sys_clk)
begin
if rising_edge(sys_clk) then
current_kbclk <= kb_clk;
current_data <= data;
end if;
end process;
end trial1;
the test bench file for the above program is here:
library work;
Library ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
use work.all;
entity test_bench is
begin
end test_bench;
architecture test of test_bench is
signal kb_clk,sys_clk : std_logic;
signal data : std_logic_vector(7 downto 0);
component code_test_process1 is
port(
kb_clk : IN std_logic;
data : IN std_logic_vector(7 downto 0));
end component code_test_process1;
for all:code_test_process1 use entity
work.code_test_process1(trial1);
begin
P1:code_test_process1 port map(kb_clk => kb_clk,data =>
data);
process
begin
data <= X"10" after 100 ns,X"08" after 200
ns,X"A2" after 300 ns,X"2F" after 400 ns,X"11" after 500 ns,X"3C" after
600 ns;
sys_clk <= '1' after 150 ns,'0' after 250 ns,'1'
after 420 ns,'0' after 475 ns,'1' after 550 ns,'1' after 570 ns;
kb_clk <= '1' after 50 ns,'0' after 100 ns,'1'
after 150 ns,'0' after 200 ns,'1' after 250 ns,'0' after 300 ns,'1'
after 350 ns,'0' after 400 ns,'1' after 450 ns,'0' after 500 ns,'1'
after 550 ns,'0' after 600 ns;
wait;
end process;
end test;
What I don't understand now is how do I display the contents of the
signals current_kbclk and current_data which are internal to the entity
code_test_process1 so that I may check if the inputs are sampled only
at sys_clk or not. How do I display those signals as well on the wave?
Best Regards,
Aijaz Baig.