Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - error "choice must be discrete range" with CASE

 
Thread Tools Search this Thread
Old 04-25-2005, 12:21 PM   #1
Default error "choice must be discrete range" with CASE


I want to do something, if the signal "address" is in the used address
range. I don't want to list all of this adresses (128!!!) in the case
structure.
Compiling this structure, I'm getting the error "choice must be discrete
range":

SIGNAL address : STD_LOGIC_VECTOR(14 downto 0);
....
CASE address IS
WHEN "000010000000000" TO "000010001111111" =>
....

What is my mistake?
How can I realize this functionality by an other structure?

Thanks, Manfred




Manfred Balik
  Reply With Quote
Old 04-25-2005, 01:52 PM   #2
Mohammed A khader
 
Posts: n/a
Default Re: error "choice must be discrete range" with CASE
Hi Manfred,

The choices in case statement must be of discrete range , that is
case expression ( here address) must be either of Enumeration or
integer type . The other way doing this is given below

SIGNAL address : STD_LOGIC_VECTOR(14 downto 0);
process
variable address_int : integer;
begin

address_int := TO_INTEGER(unsigned(address));
CASE address_int IS
WHEN 1024 to 1279 =>
...........


Use unsigned and signed types. since address is considered as unsigned
number hence prefer to declare it as

SIGNAL address : unsigned(14 downto 0);

Moreover packages numeric_std has many relavent arithmetic and
conversion functions.

-- Mohammed A Khader.



Mohammed A khader
  Reply With Quote
Old 04-26-2005, 06:12 AM   #3
Jerry
 
Posts: n/a
Default Re: error "choice must be discrete range" with CASE
To use the range following a when, a scaler type must be used (natural,
integer). So if you convert the address to an natural type first, then use
a natural range it should work.

signal address_natural : natural range 0 to 16535;


address_natural <= conv_integer(address);

case address_natural is
when 1024 to 1151 =>



"Manfred Balik" <> wrote in message
news:426cd2d2$0$10578$ ...
>I want to do something, if the signal "address" is in the used address
>range. I don't want to list all of this adresses (128!!!) in the case
>structure.
> Compiling this structure, I'm getting the error "choice must be discrete
> range":
>
> SIGNAL address : STD_LOGIC_VECTOR(14 downto 0);
> ...
> CASE address IS
> WHEN "000010000000000" TO "000010001111111" =>
> ....
>
> What is my mistake?
> How can I realize this functionality by an other structure?
>
> Thanks, Manfred
>





Jerry
  Reply With Quote
Old 04-30-2005, 12:18 PM   #4
Brian Drummond
 
Posts: n/a
Default Re: error "choice must be discrete range" with CASE
On Mon, 25 Apr 2005 13:21:54 +0200, "Manfred Balik"
<> wrote:

>I want to do something, if the signal "address" is in the used address
>range. I don't want to list all of this adresses (128!!!) in the case
>structure.
>Compiling this structure, I'm getting the error "choice must be discrete
>range":
>
>SIGNAL address : STD_LOGIC_VECTOR(14 downto 0);
>...
>CASE address IS
> WHEN "000010000000000" TO "000010001111111" =>
> ....
>
>What is my mistake?
>How can I realize this functionality by an other structure?
>


If you have many similar ranges, try something like

CASE address(13 downto 7) IS
WHEN "00001000" =>

If you have different size ranges, you can embed further CASE or IF
clauses in the arms of this one.

- Brian




Brian Drummond
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cooler Master Gladiator 600 Case Admin Front Page News 0 07-10-2009 10:52 AM
ThermalTake DH 102 Home Theater Case Admin Front Page News 0 06-12-2009 08:22 AM
Lian Li Tyr PC-X500 Case Review Admin Front Page News 0 07-11-2008 09:02 PM
Judge: File-swapping tools are legal Citizen Bob DVD Video 140 11-08-2006 06:42 PM
Enermax Phoenix Case @ ThinkComputers.org Silverstrand Front Page News 0 10-20-2006 12:28 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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