Case statements with double conditions? And an IF question.

Joined
Nov 26, 2011
Messages
1
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top