Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Re: When do I always put a "else NULL" statement in my VHDL code?

Reply
Thread Tools

Re: When do I always put a "else NULL" statement in my VHDL code?

 
 
Jim Lewis
Guest
Posts: n/a
 
      09-15-2003
Walala,
The "else null ;" does nothing for synthesis or simulation.
It does document that fact that you deliberately left this
branch open.

It does imply "else count <= count ;". Note, don't do this
as it causes simulations to run slower (it schedules signal count
to get the value from the expression count).

For your loop code,
p0: PROCESS(rst, clk)
BEGIN
if rst = '1' then
for I in 0 to 7 loop
for J in 0 to 7 loop
XX(I)(J)<=0;
end loop;
end loop;
elsif (clk'event and clk = '1') then
....

You can replace the loop with:
if rst = '1' then
XX <= (others => (others => 0) ) ;


Cheers,
Jim Lewis
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training (E-Mail Removed)
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

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



walala wrote:

> Dear all,
>
> I feel confused by "else null" statement:
>
> if rst = '1' then
> count <= 0;
> elsif clk'event and clk = '1' then
> if(INPUTEND = '1') then
> ...
> end if;
> end if;
>
> I learned from books that I should exhaust all branches of "if"
> statement, so I write in the following way:
>
> if rst = '1' then
> count <= 0;
> elsif clk'event and clk = '1' then
> if (INPUTEND = '1') then
> ...
> else
> null;
> end if;
> else
> null;
> end if;
>
>
> But I also saw on the Internet sometimes people don't write code in my
> cubersome way...
>
> Can anybody clarify a little for me? When I need to write this "else
> null", and when I don't need it?
>
> Thanks a lot,
>
> -Walala


 
Reply With Quote
 
 
 
 
walala
Guest
Posts: n/a
 
      09-16-2003
Dear Jim,

Good code! Thank you very much for pointing out that me for me! I did not
know I can do in such a simpler way before... Let me have a try any rate!

-Walala
>
> You can replace the loop with:
> if rst = '1' then
> XX <= (others => (others => 0) ) ;
>
>
> Cheers,
> Jim Lewis
> --



 
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-2002 vs VHDL-93 vs VHDL-87? afd VHDL 1 03-23-2007 09:33 AM
Re: When do I always put a "else NULL" statement in my VHDL code? walala VHDL 2 10-11-2003 10:51 PM
About Latches and Registers was (When do I always put a "else NULL"statement in my VHDL code?) Ingmar Seifert VHDL 0 09-14-2003 07:57 PM
Re: When do I always put a "else NULL" statement in my VHDL code? Kelvin VHDL 1 09-13-2003 11:07 AM
Re: When do I always put a "else NULL" statement in my VHDL code? Mike Treseler VHDL 0 09-12-2003 09:41 PM



Advertisments