Case statement syntax

F

Fred

Not sure the best way to do this. Using Xilinx ISE 7.1. This is all in a
"clocked" if statement.

I was intending to use a case statement where there might be some "don't
care" bits in the "when" range.

case expression(2 downto 0)
when "0xx"
perform this
when "100"
perform that
etc

How can I concatenate a number of when expressions.

case expression(2 downto 0)
when "000"
perform this
when "001"
perform that
when "010"
perform this
when "011"
perform that

etc

Where "perform this" may be a long series of expressions.

Is there a better way of doing it?
 
J

Jim Lewis

Fred,
Use a '|' to separate case choices.
For your first example:

case expr(2 downto 0) is
when "000" | "001" | "010" | "011" =>
perform this
when "100" =>
perform that

In VHDL-2006 there is a _proposal_ for a case statement
with a don't care, however, that will not do you any good
on the short term.

Cheers,
Jim

I was intending to use a case statement where there might be some "don't
care" bits in the "when" range.

case expression(2 downto 0)
when "0xx"
perform this
when "100"
perform that
etc

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

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

Fred

Jim Lewis said:
Fred,
Use a '|' to separate case choices.
For your first example:

case expr(2 downto 0) is
when "000" | "001" | "010" | "011" =>

In VHDL-2006 there is a _proposal_ for a case statement
with a don't care, however, that will not do you any good
on the short term.

Cheers,
Jim

Bit late I know but - many 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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top