Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > case statement

Reply
Thread Tools

case statement

 
 
kapil_kaushik
Guest
Posts: n/a
 
      06-18-2004
can we use a case statement inside another case or if statement???


 
Reply With Quote
 
 
 
 
Just an Illusion
Guest
Posts: n/a
 
      06-18-2004
Officially yes (ieee 1076 Annexe A, sequential_statement, if_statement,
case_statement_alternative, sequence_of_statement, and 1076.6),

But now your code can become a little bit confusing if you have too lot
of imbrication.

Do you have a problem with them ?

Rgrds,
JaI

kapil_kaushik wrote:

>can we use a case statement inside another case or if statement???
>
>
>
>


 
Reply With Quote
 
 
 
 
JJ
Guest
Posts: n/a
 
      06-18-2004
you can nest sequential statements. If your code is for rtl it can create
sh*tloads of logic so do this sparingly.



"kapil_kaushik" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) lkaboutprogramming.com...
> can we use a case statement inside another case or if statement???
>
>



 
Reply With Quote
 
DrB
Guest
Posts: n/a
 
      06-19-2004
I would opine that it is the natural way to code state machines and
suchlike:
- outer case to lay out the current states, as choices
- inner case (within the choices) to select the next state / outputs
- obviously within a process, clocked and gated by an appropriate clock and
(optional) clock enable

If the definition of next state / output is best expressed by (further)
nested case statements then do so. Equally, if prioritised choices are
appropriate use if constructs. Computers are good at reducing human
readable logic to concise boolean equations - as long as the logic is
synchronous.

Additionally, if the outputs are registered the use of variables for
NextState enables the output logic to use them as inputs, simplifying the
logic which expresses NextOutput. Using a cascade of case statements;
firstly to define NextState, secondly to define NextOutput.

The only serious constraints on complexity are:
- what your simulator and synthesiser will stand
-- Model Sim, Leonardo and Synplicity will accomodate the foregoing, others
tools may stall
- what your FPGA / CPLD will accomodate
-- which reduces to a speed / size trade, do you want it in Tc or in three
gates

HtH

DrB

"kapil_kaushik" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) lkaboutprogramming.com...
> can we use a case statement inside another case or if statement???
>
>



 
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
if statement that, when false, skips first statement in its block, executes second? Jay McGavren Java 11 01-16-2006 05:49 PM
How do I do a conditional statement in a constant statement? tkvhdl@gmail.com VHDL 3 12-16-2005 06:13 PM
Which of switch statement and if-else statement takes less time to execute? swaroophr@gmail.com C Programming 21 08-02-2005 09:24 AM
exec "statement" VS. exec "statement in globals(), locals() Ted Python 1 07-22-2004 08:51 AM
exec "statement" VS. exec "statement" in globals(), locals() tedsuzman Python 2 07-21-2004 08:41 PM



Advertisments