Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Case statements with double conditions? And an IF question.

Reply
Thread Tools

Case statements with double conditions? And an IF question.

 
 
traxfern traxfern is offline
Junior Member
Join Date: Nov 2011
Posts: 1
 
      11-26-2011
Hey guys this my first time posting here. I'm a beginner at VHDL hoping to have some questions clarified.

I just had a curious question regarding case statements how would I go about setting a two conditional case statement?

process(cond1, cond2)
begin
case (cond1, cond2) is
when (cond1 = xx1) and (cond2 = xx2) => ??? would this work?
etc
.
.
.



Also a second question, say I have a very long IF statement. That checks for one variable for multiple conditions. Is there an efficient way to extend the IF statements to check a second variable without reusing the condition statements again?

For example:

if ( (DrawX = row1) and (DrawY = col2)) then --row1 2 points
G_state <= s1;
break;
elsif ( (DrawX = row1) and (DrawY = col7)) then
G_state <= s2;
break;
elsif ( (DrawX = row2) and (DrawY = col1)) then --row2 8 points
G_state <= s3;
break;
elsif ( (DrawX = row2) and (DrawY = col2)) then
G_state <= s4;
break;

.
.
.

And so on, this goes on for a while. So what I want to do is exchange DrawX with another variable to check say DrawX2. And I don't want to have to rehash the long winded if statements.

thanks
 
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 statements and case statements questions John Crichton Ruby 6 07-12-2010 06:17 PM
Prepare Statements VS Statements Vince Java 12 01-21-2008 01:18 PM
component statements within architecture statements Neil Zanella VHDL 8 10-20-2006 09:05 AM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
if statements with or w/o else statements Harry George Python 6 02-23-2004 06:48 PM



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