Is it possible to split a range definition?

M

Michael

Is it possible to create a subtype with a range that is split over two
different areas?

for example:

SUBTYPE hex IS character RANGE('0' to '9' & 'A' to 'F');
 
M

Michael

fabbl said:


Do you think I would be posting here if I hadn't already tried it?

I've looked through The Designers Guide, searched around the net, and a
number of FAQ's, still, I haven't found anything that says how to do it.
I also haven't found anything that leaves me with the impression that
it can't be done either.

Does anyone out there have any useful feedback?
 
J

Jonathan Bromley

No, VHDL doesn't offer disjoint ranges.

Pascal and Modula-xxx offer sets, which get you some of what
I suspect you want. Too bad they didn't make it into VHDL.

'e' (Verisity's verification language) has disjoint ranges for
subtypes. Vera may have such a thing too, but I don't know.

For some purposes it's cool to create a set lookalike in VHDL...

type t_charset is array(character) of boolean;

and then you can mess around creating sets from aggregates:

constant hex_digit: t_charset := (
'0' to '9' => TRUE,
'A' to 'F' => TRUE,
others => FALSE );

With a bit more work you could overload "and", "or" and
other operators to mimic the usual set operations.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:[email protected]
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top