S
Simone Winkler
Guest
Hello!
I've got a simple question: I have to model a key with debounce. So I've got
to assign a value of type natural to a time in milliseconds.
My formular would be:
bounce_wait = nr_of_bounces/bounce_frequ * 1 ms;
I've got the code I did below, but it doesn't compile in the line where the
natural-time conversion is done. Also my resolution setting of modelsim is
ok - I'm using modelsim SE 5.5f.
The critical line is:
constant bounce_wait : time := nr_of_bounces/bounce_frequ * 1 ms;
Can you help me?
Thank you!!
____________________________________
library ieee;
use ieee.std_logic_1164.all;
use work.basic_pkg.all;
entity key is
generic(
bounce_frequ: natural;
nr_of_bounces: natural);
port(
in_terminal: in std_logic;
out_terminal: out std_logic;
key_status: in key_action
);
end entity key;
architecture behavioural of key is
signal out_terminal_sig: std_logic;
constant bounce_wait : time := nr_of_bounces/bounce_frequ * 1 ms;
begin
out_terminal <= '1' after bounce_wait when (in_terminal='1' and
key_status=pressed) else out_terminal_sig <= 'Z';
end architecture behavioural;
I've got a simple question: I have to model a key with debounce. So I've got
to assign a value of type natural to a time in milliseconds.
My formular would be:
bounce_wait = nr_of_bounces/bounce_frequ * 1 ms;
I've got the code I did below, but it doesn't compile in the line where the
natural-time conversion is done. Also my resolution setting of modelsim is
ok - I'm using modelsim SE 5.5f.
The critical line is:
constant bounce_wait : time := nr_of_bounces/bounce_frequ * 1 ms;
Can you help me?
Thank you!!
____________________________________
library ieee;
use ieee.std_logic_1164.all;
use work.basic_pkg.all;
entity key is
generic(
bounce_frequ: natural;
nr_of_bounces: natural);
port(
in_terminal: in std_logic;
out_terminal: out std_logic;
key_status: in key_action
);
end entity key;
architecture behavioural of key is
signal out_terminal_sig: std_logic;
constant bounce_wait : time := nr_of_bounces/bounce_frequ * 1 ms;
begin
out_terminal <= '1' after bounce_wait when (in_terminal='1' and
key_status=pressed) else out_terminal_sig <= 'Z';
end architecture behavioural;