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

T

Tricky

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?
 
K

KJ

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
 
A

Andy

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
 
J

Jonathan Bromley

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...
 
T

Tricky

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 :)
 
M

Martin Thompson

KJ said:
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
 
B

Brian Drummond

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
 
J

JimLewis

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
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top