On Thursday 05 June 2008 22:01:15 Tristan Gingold wrote:
> On Thu, Jun 05, 2008 at 12:13:19PM +0200, [EMAIL PROTECTED] wrote:
> > > this is slightly too vague.  I tried a few cases and all were
> > > sucessfull. What is the type of xyz ?
> >
> > The type was a subtype to integer.
> >
> > The reason is I like to use 'high 'low 'range etc... rather to hardcode
> > limits in the software. That allows to change the limits ( or take
> > values from a generic ) without reviewing the code, and to set all
> > parameters on the begining of the architecture.
>
> Yes, this is a very common use of for generate.
> Can you send me a reproducer ?  That would be very useful.

I don't know if this is what the OP meant, but here is an example of 
where 'high and 'low work, but 'range doesn't. What I'm not clear on, is if 
this is a bug in GHDL or is standard behavior.

entity bug is
end entity;

architecture works of bug is
  subtype t1 is integer range 1 to 2;
begin

  gen : for i in t1'low to t1'high generate
    assert false report integer'image(i) severity note;
  end generate;

end architecture;

$ ghdl -a bug.vhdl
$ ghdl -m bug
elaborate bug
$ ./bug
test.vhdl:9:5:@0ms:(assertion note): 1
test.vhdl:9:5:@0ms:(assertion note): 2


On the other hand:

entity bug is
end entity;

architecture does_not_work of bug is
  subtype t1 is integer range 1 to 2;
begin

  gen : for i in t1'range generate
    assert false report integer'image(i) severity note;
  end generate;

end architecture;

$ ghdl -a bug.vhdl
bug.vhdl:8:21: prefix of range attribute must be an array type or object
bug.vhdl:8:3: range must be a static discrete range
bug.vhdl:9:39: can't match 'i' with type integer
/usr/lib/ghdl/bin/ghdl: compilation error


Again, I don't know if this a bug or a standard VHDL "feature", but this may 
be what the OP meant.

-- 
Wesley J. Landaker <[EMAIL PROTECTED]> <xmpp:[EMAIL PROTECTED]>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Ghdl-discuss mailing list
Ghdl-discuss@gna.org
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to