Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > conversion: natural -> time

Reply
Thread Tools

conversion: natural -> time

 
 
Simone Winkler
Guest
Posts: n/a
 
      04-01-2004
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;


 
Reply With Quote
 
 
 
 
Jim Lewis
Guest
Posts: n/a
 
      04-01-2004
Simone,
I got it to compile. I did not find any issues with
bounce_wait. I did need to fix the syntax of the
assignment to out_terminal:

out_terminal <=
'1' after bounce_wait when (in_terminal='1' and key_status=pressed)
else 'Z'; -- note removed: "out_terminal_sig <="

If you still have problems with your constant, either upgrade
to a newer version of the tool or perhaps try adding parentheses:
constant bounce_wait : time := (nr_of_bounces/bounce_frequ) * 1 ms;
^ ^

Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training private.php?do=newpm&u=
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~



Simone Winkler wrote:

> 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;
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting logic_vector -> natural magik VHDL 4 05-24-2011 09:25 AM
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
Constant conversion (natural to std_logic_vector) a1_nocrap_exh@hotmail.com VHDL 10 04-13-2006 10:29 PM
Does the Microsoft Natural Keyboard Elite have a detachable palm rest? =?Utf-8?B?Y19sZXlkZW4=?= Microsoft Certification 2 02-04-2004 10:28 PM
Java Natural Language Parsing. Aidan Java 2 08-01-2003 08:55 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57