- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm having a problem when I try to take just one part of an array, for example:
I have a 512x512 array, and want just the first 8x8 samples. I'm having the following error: "slice of object cannot be specified for object that has an array type of more than one dimension" Here's part of the code: Type array_t IS ARRAY (0 to 7, 0 to 7) OF STD_LOGIC_VECTOR(0 to 7); Type array_t2 IS ARRAY (0 to 511, 0 to 511) OF STD_LOGIC_VECTOR(0 to 7); SIGNAL input: array_t SIGNAL output: array_t2 input<=output(0 to 7, 0 to 7); Thank you!!Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you cannot do that with a 2d array, you can only access one entry at a time.
for this, you would need a loop (ps. I think you means to assign output, not input!)
for i in input'range(1) loop
for j in input'range(2) loop
output(i,j) <= input(i,j);
end loop;
end loop;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Tricky. You are always saving my life.
As soon as possible I will teste and reply. Thanks again!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- you cannot do that with a 2d array, you can only access one entry at a time. --- Quote End --- Respectively a row slice at once. Keep in mind, that a 2D array isn't but a mapping scheme to represent data structures, that are 1D arrays by nature.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It didn't worked, I get an error:
"indexed name returns a value whose type does not match "array_t", the type of the target expression." Type array_t IS ARRAY (0 to 7, 0 to 7) OF STD_LOGIC_VECTOR(0 to 7); Type array_t2 IS ARRAY (0 to 511, 0 to 511) OF STD_LOGIC_VECTOR(0 to 7); SIGNAL output: array_t SIGNAL input: array_t2 process(clk) begin for i in 0 to 7 loop for j in 0 to 7 loop output<=input(i, j); end loop; end loop; end process; Thank You!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you need to change it to
output(i, j) <= input(i,j);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh...Ok,
Thanks!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code worked fine if I want to do something using the same index:
output(0, 0) <= input(0, 0); but how about output(0, 0) <= input(8, 8); output(0, 1) <= input(8, 9); How can be done that? Thank You!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have tried this before and didn't worked. But the error was somewhere else.
This works. output(i, j) <= input(i, j+8);
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page