Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - VHDL when question

 
Thread Tools Search this Thread
Old 10-19-2004, 09:47 PM   #1
Default VHDL when question


Hey Everyone,

Is this VHDL code valid:

sig_a <= sig_b when sig_c = '1';

when sig_c = '0' I want sig_a to keep its current value. Or must the when
clause always end with an else e.g.

sig_a <= sig_b when sig_c = '1' else '0';

TIA




Hans
  Reply With Quote
Old 10-20-2004, 01:13 AM   #2
Jim Lewis
 
Posts: n/a
Default Re: VHDL when question
Hans,
> Is this VHDL code valid:
>
> sig_a <= sig_b when sig_c = '1';


In VHDL-93 and beyond, yes.

It simulates as a latch (level sensitive storage) just
like you want. For synthesis, I would be cautious as
some synthesis tools may not support this. If you are
conservative, you would do well to use the equvalent
process:

process (sig_b, sig_c)
begin
if sig_c = '1' then
sig_a <= sig_b ;
end if ;
end process ;

The synthesis standard, 1076.6-2004 says compliant
synthesis tools must support this, so if you find
a tool that does not, kick them.

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


Jim Lewis
  Reply With Quote
Old 10-20-2004, 11:58 AM   #3
ALuPin
 
Posts: n/a
Default Re: VHDL when question
> when sig_c = '0' I want sig_a to keep its current value. Or must the when
> clause always end with an else e.g.
>
> sig_a <= sig_b when sig_c = '1' else '0';
>
> TIA


The assignment you make is a combinational one
that is you need to register sig_a if you want to keep the value. For
that purpose you need a clock.

process(Clk)
begin
if rising_edge(Clk) then
sig_a <= sig_a; -- else tree of sic_c condition: you do not need
it here,
-- but it is good for visualization

if sig_c='1' then
sig_a <= sig_b;
end if;
end if;

end process;


ALuPin
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL sll shift question ohaqqi Hardware 4 09-29-2009 11:27 AM
How to execute an external software from VHDL? And how to interface VHDL with JAVA? becool_nikks Software 0 03-06-2009 07:08 PM
Help on auto conversion from Matlab to vhdl on filter design hardheart Hardware 0 12-07-2007 09:19 AM
Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good God DVD Video 3 04-25-2005 04:19 PM
Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good Filthy Mcnasty DVD Video 0 04-25-2005 04:29 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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