A
alb
Guest
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
bits.
Something like this:
<code>
--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;
</code>
Is there any better way to do this?
Al
--
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?
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
bits.
Something like this:
<code>
--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;
</code>
Is there any better way to do this?
Al
--
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?