Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > record of a record to std_logic_vector

Reply
Thread Tools

record of a record to std_logic_vector

 
 
THurkmans
Guest
Posts: n/a
 
      08-26-2009
Hello,

I've made a design in which I have a few blocks which I want to
synthesize. My simulation is working, and now I'm trying to do a post-
synthesis simulation per block by replacing each block with its
synthesized version.

What I didn't expect from my synthesis tool was that it would mess up
my entities in which I use records. I have created a small records to
pass my memories to my block:

type ram_image_type is record
enable : std_logic;
write_enable : std_logic;
address : std_logic_vector(17 downto 0);
inoutput : std_logic_vector(7 downto 0);
end record;

type memories_inout_type is record
image0 : ram_image_type;
image1 : ram_image_type;
image2 : ram_image_type;
end record;

I've found posts which create to_vec and from_vec, and align the
vectors such that they can be used in one std_logic_vector, but those
only assume one record. How can I create a to_std_logic_vector for the
memories_inout_type record?
 
Reply With Quote
 
 
 
 
Andy
Guest
Posts: n/a
 
      08-26-2009
On Aug 26, 4:19*am, THurkmans <(E-Mail Removed)> wrote:
> Hello,
>
> I've made a design in which I have a few blocks which I want to
> synthesize. My simulation is working, and now I'm trying to do a post-
> synthesis simulation per block by replacing each block with its
> synthesized version.
>
> What I didn't expect from my synthesis tool was that it would mess up
> my entities in which I use records. I have created a small records to
> pass my memories to my block:
>
> type ram_image_type is record
> * * * * enable : std_logic;
> * * * * write_enable : std_logic;
> * * * * address : std_logic_vector(17 downto 0);
> * * * * inoutput : std_logic_vector(7 downto 0);
> end record;
>
> type memories_inout_type is record
> * * * * image0 : ram_image_type;
> * * * * image1 : ram_image_type;
> * * * * image2 : ram_image_type;
> end record;
>
> I've found posts which create to_vec and from_vec, and align the
> vectors such that they can be used in one std_logic_vector, but those
> only assume one record. How can I create a to_std_logic_vector for the
> memories_inout_type record?


Maybe create a function which calls the little "record_to_slv"
function for each sub-record, concatenating the results?

BTW, anytime you have a record which contains three (or 'N') identical
items, it should probably be an array, not a record. Arrays allow you
to index the elements using loops, variables/signals, etc.

Andy
 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      08-26-2009
On Aug 26, 5:19*am, THurkmans <(E-Mail Removed)> wrote:

>
> I've found posts which create to_vec and from_vec, and align the
> vectors such that they can be used in one std_logic_vector, but those
> only assume one record. How can I create a to_std_logic_vector for the
> memories_inout_type record?


By first creating to_vec and from_vec functions that work with
'ram_image_type'. Then the to_vec and from_vec for
'memories_inout_type' would call the to_vec and from_vec for each of
the elements of the record. One possible way is...

function to_vec(R: memories_inout_type) is
begin
return(to_vec(R.image0) & to_vec(R.image1) & to_vec(R.image2));
end function to_vec;

To do the 'from_vec' function you'd have to know the size of the
vector that is returned from the 'from_vec' function that works with
'ram_image_type' so that you can strip out the appropriate set of bits
so that you can then call from_vec with it.

Kevin Jennings
 
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
Array of std_logic_vector Willem Oosthuizen VHDL 3 02-26-2010 12:27 AM
inout std_logic_vector to array of std_logic_vector of generic length conversion... Thomas Rouam VHDL 6 11-09-2007 11:49 AM
Record, Enumeration & std_logic_vector Jan Kindt VHDL 5 09-12-2003 10:25 AM
std_logic_vector port doesn't work after synthesis. Mike VHDL 3 07-09-2003 09:10 PM
STD_LOGIC_VECTOR vs. UNSIGNED vs. SIGNED Jeremy Pyle VHDL 3 06-28-2003 10:47 PM



Advertisments