Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Why cant protected types be elements in an array?

Reply
Thread Tools

Why cant protected types be elements in an array?

 
 
Tricky
Guest
Posts: n/a
 
      08-03-2009
I just stumbled accross this, and wondered why they cannot be elements
in an array? I thought I could get around this by making an array of
pointers to a protected type, but it appears you're not allowed to
make pointers to them either.

Is there a good reason for this?
 
Reply With Quote
 
 
 
 
Paul Uiterlinden
Guest
Posts: n/a
 
      08-03-2009
Tricky wrote:

> I just stumbled accross this, and wondered why they cannot be elements
> in an array? I thought I could get around this by making an array of
> pointers to a protected type, but it appears you're not allowed to
> make pointers to them either.


Ah yes, I too stumbled across this very recently. I had created a fifo
(behavioral code) and then wanted to create a one dimensional array of
fifos. I was quite surprised I could not do that. I have solved it to
dynamically allocate the array internally in the protected type.

> Is there a good reason for this?


I have no idea. The only thing I do know is that it severly recsticts the
use of (the otherwise very nice) protected types.

--
Paul Uiterlinden
www.aimvalley.nl
e-mail addres: remove the not.
 
Reply With Quote
 
 
 
 
JimLewis
Guest
Posts: n/a
 
      08-04-2009
On Aug 3, 8:18*am, Tricky <(E-Mail Removed)> wrote:
> I just stumbled accross this, and wondered why they cannot be elements
> in an array? I thought I could get around this by making an array of
> pointers to a protected type, but it appears you're not allowed to
> make pointers to them either.
>
> Is there a good reason for this?


Relatively speaking protected types are a new feature.

Are you willing to post more details on what you
are trying to do?

The array of FIFOs that Paul would like to do sounds interesting.

I would also like to be able to initialize data structures
within the protected type - kind of like a constructor for
classes - but I was thinking I wanted something more like
a generic as a more general mechanism.

Long term, I would like to see protected types turn into
classes - however to do things like this we need user
support in voicing the feature request.

Best,
Jim

 
Reply With Quote
 
Tricky
Guest
Posts: n/a
 
      08-04-2009
On Aug 4, 6:27*am, JimLewis <(E-Mail Removed)> wrote:
> On Aug 3, 8:18*am, Tricky <(E-Mail Removed)> wrote:
>
> > I just stumbled accross this, and wondered why they cannot be elements
> > in an array? I thought I could get around this by making an array of
> > pointers to a protected type, but it appears you're not allowed to
> > make pointers to them either.

>
> > Is there a good reason for this?

>
> Relatively speaking protected types are a new feature.
>
> Are you willing to post more details on what you
> are trying to do?
>
> The array of FIFOs that Paul would like to do sounds interesting.
>
> I would also like to be able to initialize data structures
> within the protected type - kind of like a constructor for
> classes - but I was thinking I wanted something more like
> a generic as a more general mechanism.
>
> Long term, I would like to see protected types turn into
> classes - however to do things like this we need user
> support in voicing the feature request.
>
> Best,
> Jim


I suppose it boils down to how much code you like to write.

The only situation I can think where an array would be useful could
probably be worked around with generate loops, but then you're going
to have seperate processes running where you could just use one
process containing a for loop.

eg:


process
type pattern_gen_array_t is array(0 to N-1) of pattern_gen_t;

variable pattern_gens : pattern_gen_array_t;
begin

wait until rising_edge(clk);
for i in pattern_gens'range loop
pattern_gens(i).get_next_pixel( sigs => stim(i));
end loop;

end process;

instead of:

pattern_gens_gen : for i in 0 to N-1 generate


process
variable pattern_gen : pattern_gen_t;
begin

wait until rising_edge(clk);
pattern_gen.get_next_pixel(sigs => stim(i));

end process;

end generate pattern_gens_gen;


Actually, I can see the 2nd method as alot more useful when you are
reacting to output's from a UUT as you could separate out all of the
elements in an output array, rather than reacting to the entire array
each time one 1 of them changes.


So nothing Im really frustrated I cant do - I was just a bit surprised
when I found I couldnt do method 1.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why cant protected type methods have a parameter thats an access type? Tricky VHDL 1 02-10-2012 08:38 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Difference between "Protected WithEvents myClassName" And "Protected myClassName" ? Andreas Klemt ASP .Net 2 07-05-2003 12:51 AM



Advertisments