Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Can anyone think of a workaround - Ideally I want to pass an accesstype into an entity (not for synthesis)

Reply
Thread Tools

Can anyone think of a workaround - Ideally I want to pass an accesstype into an entity (not for synthesis)

 
 
Tricky
Guest
Posts: n/a
 
      04-08-2011
Im building a model of a memory interface. The entity mimics the
interface of the normal memory interface with multiple request,
address, ack and data valid lines, one set per channel. Internally I
have a protected type that handles the memory modelling (dynamically
creating memory locations as they are accessed so I dont have a
monstrous 256Mbyte array declared) and another protected that handles
the read queue.

As this is modelling a memory in a video system, I want to be able to
dump whole images (ie bypassing the whole interface) into memory, for
example if Im only testing the other bits of the design on the read
side of the interface. I have everything I need for reading/writing
bitmaps to specific array types, but I just need to get these arrays
into this entity.

Heres the pinch - I really dont want to specify the size of the image,
as this may well handle multiple video standards on hardware, so I
need the image sizes to vary accordingly. Id love to be able to pass
in an access type and watch the transactions on it - but of course
access types can only be variables - therefore not suitable for ports
on an entity. Can anyone think of any other way I could get these
arrays into the interface without padding?

The only thing I can think of is sticking image sizes as generics and
declaring the "image" port to this size, but I would prefer more
flexibility.

So - am I just pushing too hard? How long before someone pipes up that
I should try System Verilog?
 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      04-08-2011
On Apr 8, 11:12*am, Tricky <(E-Mail Removed)> wrote:
> Im building a model of a memory interface. The entity mimics the
> interface of the normal memory interface with multiple request,
> address, ack and data valid lines, one set per channel. Internally I
> have a protected type that handles the memory modelling (dynamically
> creating memory locations as they are accessed so I dont have a
> monstrous 256Mbyte array declared) and another protected that handles
> the read queue.
>
> As this is modelling a memory in a video system, I want to be able to
> dump whole images (ie bypassing the whole interface) into memory, for
> example if Im only testing the other bits of the design on the read
> side of the interface. I have everything I need for reading/writing
> bitmaps to specific array types, but I just need to get these arrays
> into this entity.
>
> Heres the pinch - I really dont want to specify the size of the image,
> as this may well handle multiple video standards on hardware, so I
> need the image sizes to vary accordingly. Id love to be able to pass
> in an access type and watch the transactions on it - but of course
> access types can only be variables - therefore not suitable for ports
> on an entity. Can anyone think of any other way I could get these
> arrays into the interface without padding?
>


Dump the data to a file. Use a string to pass the file name into the
memory model. If the file name needs to be able to be changed during
the simulation (i.e. if it must be a 'signal' rather than a 'generic')
than the only limitation will be that the string name will need to be
a fixed size. Even that limitation can be less onerous if you simply
use a loooooong string size, null terminate the string and then have
the memory model construct the file name by looking for the null
termination.

Even better, if you're using standard bitmap file formats like .BMP
for the exchange than you can create read/write BMP file procedures
which you will no doubt use somewhere down the road and not be tied to
this particular memory model instance.

Kevin Jennings
 
Reply With Quote
 
 
 
 
Andy
Guest
Posts: n/a
 
      04-08-2011
On Apr 8, 10:12*am, Tricky <(E-Mail Removed)> wrote:
> Im building a model of a memory interface. The entity mimics the
> interface of the normal memory interface with multiple request,
> address, ack and data valid lines, one set per channel. Internally I
> have a protected type that handles the memory modelling (dynamically
> creating memory locations as they are accessed so I dont have a
> monstrous 256Mbyte array declared) and another protected that handles
> the read queue.
>
> As this is modelling a memory in a video system, I want to be able to
> dump whole images (ie bypassing the whole interface) into memory, for
> example if Im only testing the other bits of the design on the read
> side of the interface. I have everything I need for reading/writing
> bitmaps to specific array types, but I just need to get these arrays
> into this entity.
>
> Heres the pinch - I really dont want to specify the size of the image,
> as this may well handle multiple video standards on hardware, so I
> need the image sizes to vary accordingly. Id love to be able to pass
> in an access type and watch the transactions on it - but of course
> access types can only be variables - therefore not suitable for ports
> on an entity. Can anyone think of any other way I could get these
> arrays into the interface without padding?
>
> The only thing I can think of is sticking image sizes as generics and
> declaring the "image" port to this size, but I would prefer more
> flexibility.
>
> So - am I just pushing too hard? How long before someone pipes up that
> I should try System Verilog?


How about flattening your image into a single vector, and pass it in
on an unconstrained array (e.g. SLV) port? Add generics (static) or
other ports (dynamic) for pixel/row/column size to tell the model how
to extract the image from the linear vector.

Andy
 
Reply With Quote
 
Jonathan Bromley
Guest
Posts: n/a
 
      04-08-2011
On Fri, 8 Apr 2011 08:12:52 -0700 (PDT), Tricky wrote:

> Id love to be able to pass
>in an access type and watch the transactions on it - but of course
>access types can only be variables - therefore not suitable for ports
>on an entity. Can anyone think of any other way I could get these
>arrays into the interface without padding?


In the past when I've needed to do this kind of thing,
one approach has been to create a package with a pool
of objects (shared variables) in it, and then have
entity instances register themselves with the package
by calling appropriate functions in it. An instance
can supply its own instance name to such a call as
a string including 'PATH_NAME, allowing the package
to work out which instance placed the call. It's
a bit upside-down and clumsy, but can sometimes
provide the kind of functional communication you
seem to be wanting. You likely need some sort of
side-channel into the instances, in the form of
a regular port of boolean or some enumerated
type, to allow you to signal interesting events
from one instance to another; the instances can
then use the package pool as a shared communication
medium, and the idea of each instance registering
itself with the package by means of its string
instance name stops things being outrageously
global.

It's a while since I did any of this, so the
details are a bit sketchy in my mind. But it looks
as though I may soon be needing to dust off these
tricks once again...
--
Jonathan Bromley
 
Reply With Quote
 
Tricky
Guest
Posts: n/a
 
      04-09-2011
On Apr 8, 8:31*pm, KJ <(E-Mail Removed)> wrote:
> On Apr 8, 11:12*am, Tricky <(E-Mail Removed)> wrote:
>
>
>
> > Im building a model of a memory interface. The entity mimics the
> > interface of the normal memory interface with multiple request,
> > address, ack and data valid lines, one set per channel. Internally I
> > have a protected type that handles the memory modelling (dynamically
> > creating memory locations as they are accessed so I dont have a
> > monstrous 256Mbyte array declared) and another protected that handles
> > the read queue.

>
> > As this is modelling a memory in a video system, I want to be able to
> > dump whole images (ie bypassing the whole interface) into memory, for
> > example if Im only testing the other bits of the design on the read
> > side of the interface. I have everything I need for reading/writing
> > bitmaps to specific array types, but I just need to get these arrays
> > into this entity.

>
> > Heres the pinch - I really dont want to specify the size of the image,
> > as this may well handle multiple video standards on hardware, so I
> > need the image sizes to vary accordingly. Id love to be able to pass
> > in an access type and watch the transactions on it - but of course
> > access types can only be variables - therefore not suitable for ports
> > on an entity. Can anyone think of any other way I could get these
> > arrays into the interface without padding?

>
> Dump the data to a file. *Use a string to pass the file name into the
> memory model. *If the file name needs to be able to be changed during
> the simulation (i.e. if it must be a 'signal' rather than a 'generic')
> than the only limitation will be that the string name will need to be
> a fixed size. *Even that limitation can be less onerous if you simply
> use a loooooong string size, null terminate the string and then have
> the memory model construct the file name by looking for the null
> termination.
>
> Even better, if you're using standard bitmap file formats like .BMP
> for the exchange than you can create read/write BMP file procedures
> which you will no doubt use somewhere down the road and not be tied to
> this particular memory model instance.
>
> Kevin Jennings


Thanks all of you for the ideas.

Kevins is definatly the most practical for me. Ive had a library full
of bitmap reading, writing and colour space converting for about 3
years, so the string thing is easiest (already have a string pad
function and string tokenising protected type, so I can easily pass in
multiple images in a single generic from the top level testbench) -
normally I throw images around in their own array type once read,
which is probably why I didnt think of it myself.

Im going to make a record type with start address and image path, and
sit on that port waiting for a transaction.

Cheers guys
 
Reply With Quote
 
Martin Thompson
Guest
Posts: n/a
 
      04-11-2011
KJ <(E-Mail Removed)> writes:

> Dump the data to a file. Use a string to pass the file name into the
> memory model. If the file name needs to be able to be changed during
> the simulation (i.e. if it must be a 'signal' rather than a 'generic')
> than the only limitation will be that the string name will need to be
> a fixed size. Even that limitation can be less onerous if you simply
> use a loooooong string size, null terminate the string and then have
> the memory model construct the file name by looking for the null
> termination.
>
> Even better, if you're using standard bitmap file formats like .BMP
> for the exchange than you can create read/write BMP file procedures
> which you will no doubt use somewhere down the road and not be tied to
> this particular memory model instance.


Seconded.

For other readers (as I know both KJ and Tricky know this) when I do this, I
use ASCII-PGM files, as I've found accessing binary files (like BMP) to be
non-portable across simulators. If this doesn't matter to you, by all means
use BMP

Cheers,
Martin

--
http://www.velocityreviews.com/forums/(E-Mail Removed)
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.co.uk/capabilities...ronic-hardware
 
Reply With Quote
 
Brian Drummond
Guest
Posts: n/a
 
      04-11-2011
On Mon, 11 Apr 2011 11:14:12 +0100, Martin Thompson wrote:

> KJ <(E-Mail Removed)> writes:
>
>> Dump the data to a file. Use a string to pass the file name into the
>> memory model. If the file name needs to be able to be changed during
>> the simulation (i.e. if it must be a 'signal' rather than a 'generic')
>> than the only limitation will be that the string name will need to be a
>> fixed size. Even that limitation can be less onerous if you simply use
>> a loooooong string size, null terminate the string and then have the
>> memory model construct the file name by looking for the null
>> termination.
>>
>> Even better, if you're using standard bitmap file formats like .BMP for
>> the exchange than you can create read/write BMP file procedures which
>> you will no doubt use somewhere down the road and not be tied to this
>> particular memory model instance.

>
> Seconded.
>
> For other readers (as I know both KJ and Tricky know this) when I do
> this, I use ASCII-PGM files, as I've found accessing binary files (like
> BMP) to be non-portable across simulators. If this doesn't matter to
> you, by all means use BMP
>


My approach has been to perform binary I/O through an unofficial
"portability layer".
Modelsim and Xilinx ISIM (10.3) are the two I have experience of.

ISIM insists on reading a short undocumented* header before the actual
data. To satisfy this, I have simple scripts to separate header and file
(using "head" and "tail) from ISIM output files, and to "cat" a header
onto any binary file before I read it into ISIM.

The other difference is endian-ness; I set a boolean flag ("is_isim")
which controls end-swapping in both input/output routines.

(* Xilinx refused to provide any documentation on the header despite a
Webcase specifically asking for it)

- Brian
 
Reply With Quote
 
JimLewis
Guest
Posts: n/a
 
      04-25-2011
On Apr 8, 8:12*am, Tricky <(E-Mail Removed)> wrote:
> Im building a model of a memory interface. The entity mimics the
> interface of the normal memory interface with multiple request,
> address, ack and data valid lines, one set per channel. Internally I
> have a protected type that handles the memory modelling (dynamically
> creating memory locations as they are accessed so I dont have a
> monstrous 256Mbyte array declared) and another protected that handles
> the read queue.
>
> As this is modelling a memory in a video system, I want to be able to
> dump whole images (ie bypassing the whole interface) into memory, for
> example if Im only testing the other bits of the design on the read
> side of the interface. I have everything I need for reading/writing
> bitmaps to specific array types, but I just need to get these arrays
> into this entity.
>

In the past, I have used a separate transaction type of interface to
handle this. It was real basic - send a memory word at a time.
However, in VHDL-2008, you should be able to access the
shared variable of the memory with an external name and use the
methods provided by your protected type. Have not tried this
application of external names, but I intend to soon.

Best,
Jim
 
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
How to relate a SQL based entity with an Object based entity in Entity Framework markla ASP .Net 1 10-06-2008 09:42 AM
VS2003 -> VS2005 with little or ideally no code changes microdevsolutions@yahoo.com.au ASP .Net 1 08-16-2006 02:27 AM
VS2003 -> VS2005 with little or ideally no code changes microdevsolutions@yahoo.com.au ASP .Net 0 08-16-2006 12:07 AM
Ideally, someone with lots of .NET - Omaha, Nebrsaka-Full Time Salary/ Compensation Range: $70 to 75K plus benefits Balu ASP .Net 1 02-25-2006 01:16 AM
Ideally, someone with lots of .NET - Omaha, Nebrsaka-Full Time Salary/ Compensation Range: $70 to 75K plus benefits Balu ASP .Net 1 02-24-2006 07:39 PM



Advertisments