Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > VHDL when question

Reply
Thread Tools

VHDL when question

 
 
Hans
Guest
Posts: n/a
 
      10-19-2004
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


 
Reply With Quote
 
 
 
 
Jim Lewis
Guest
Posts: n/a
 
      10-20-2004
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
 
Reply With Quote
 
 
 
 
ALuPin
Guest
Posts: n/a
 
      10-20-2004
> 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;
 
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
VHDL standard question (VHDL 93 chapter 4.3.2.2) Kim Enkovaara VHDL 9 10-15-2008 11:04 PM
VHDL-2002 vs VHDL-93 vs VHDL-87? afd VHDL 1 03-23-2007 09:33 AM
VHDL 2002 vs VHDL 1993 dude VHDL 1 03-23-2006 01:18 PM
multiD-vhdl: Multi Dimensional Arrays (allowing generics on each dimension) for VHDL (including ports) albert.neu@gmail.com VHDL 2 03-21-2006 04:05 PM
what's the difference between VHDL 93 CONCATENATION and VHDL 87 CONCATENATION? walala VHDL 3 09-18-2003 04:17 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