Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > parametric vector slices

Thread Tools

parametric vector slices

Posts: n/a
Hi everyone,

I'm not sure if the 'subject' is correctly formulated but I'll try anyway.

Assume an array of bits 'a' which has N number of bits. Now assume M < N
where N/M = k is an integer number. I'd like to slice a in k pieces in
such a way that I can assign each slice to another array of bits with M

Something like this:


--not tested
variable a : my_array_of_bits(N-1 downto 0);

type list is array (0 to k) of my_array_of_bits(M-1 downto 0);
variable l : list;

for i in 0 to l'range - 1 loop
l(i) <= a((i+1)*M - 1 downto i*M);
end loop;


Is there any better way to do this?


A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Reply With Quote
Posts: n/a

For vhdl-2008 compliant tools, you can declare a type that is an unconstrained array of unconstrained arrays, so it is possible to write a "slice(input, M)" function that would return such a type. You may want a function that does the reverse too.

Check your tools' documentation to see which 2008 features they support.

Reply With Quote

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
Noah's ArcLength (Parametric Curves) Dexter Java 0 03-26-2008 12:46 PM
A parametric search engine Charles Digital Photography 5 07-06-2007 09:47 PM
Free memory allocate by a STL vector, vector of vector, map of vector C++ 8 02-18-2006 12:48 AM
Parametric covariance in class hierarchies Matthias Kaeppler Java 6 01-23-2006 09:01 AM
[RFC] Parametric Polymorphism Catalin Marinas Python 11 09-27-2005 09:24 AM