Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to show this vector?

Status
Not open for further replies.

milan.km

Member level 3
Joined
Sep 14, 2015
Messages
55
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
435
hi
assume that I have 192 data(unsigned(7 downto 0), and I want to put them 64 of them into one vector with andices?
"a0" will be 0 to 63
"a1" will be 64 to 127
"a2" will be 128 to 191
because I want to write a for loop for a I want them to have their indices 0 to 2.
is there any way I could do this in vhdl?
srry for the english syntax error,english is not my native language.
 

will u please help me how could I write it?
 

thanks for answering
I meant like this :
2015-10-10 08.52.26.jpg
I searched but I found just 1D1D arrays and 2D arrays. but I want two indices for rows,I am not sure it is possible in vhdl
 

the diagram you're showing is a 3d array and is perfectly doable in VHDL.


Code VHDL - [expand]
1
2
3
4
type a_element_t is array(0 to 63) of unsigned(7 downto 0);
type a_t is array(0 to 2) of a_element_t;
 
signal a : a_t;



did you really mean this.

PS. This isnt a true 3d array - its a 1D array of 1D arrays of 1D arrays.
 

the diagram you're showing is a 3d array and is perfectly doable in VHDL.


Code VHDL - [expand]
1
2
3
4
type a_element_t is array(0 to 63) of unsigned(7 downto 0);
type a_t is array(0 to 2) of a_element_t;
 
signal a : a_t;



did you really mean this.

PS. This isnt a true 3d array - its a 1D array of 1D arrays of 1D arrays.
thanks for the answering.
yes I meant this.
would u plz help me how should I assign values to them,I wrote the following code, but it have some problems :
Code:
    for i in 0 to 2 loop
      for j in 0 to 63 loop
        a_var(i) := memory(63*i+j);  --error
      end loop;
    end loop;
thanks
 

Assuming you copied my declaration, the problem is that you're trying to treat a 3d array as if it were a 1D array.
What is "memory" and how is it declared? why are you trying to copy a whole chunk of it as if this were software?

why not post the whole code, not a snippet.
 

Assuming you copied my declaration, the problem is that you're trying to treat a 3d array as if it were a 1D array.
What is "memory" and how is it declared? why are you trying to copy a whole chunk of it as if this were software?

why not post the whole code, not a snippet.
thanks for the answering TrickyDicky
here is the memory declaration :
Code:
type siz5 is array (0 to 192) of unsigned(7 downto 0);  --type of vector containing 5 img

signal memory : siz5 :=(others => "00000000");


here is the code :
Code:
process(clk,wr_ena)
variable addr : integer range 0 to s5 := 0;
variable a_var : a_tp := (others => (others => "00000000"));
variable i,j : integer ;
begin
IF (clk'event AND clk = '1') THEN
  if (wr_ena ='1') then
    memory(addr) <= p_in;
    addr :=addr+1;
    if (addr = s5) then
      wr_ena <= '0';
    end if;
  else 
    for i in 0 to 11 loop
      for j in 0 to (s4-1) loop
        a := memory(s4*i+j);
      end loop;
    end loop;
  end if;
end if;
end process;
i have all the 3*64 unsigned values in memory and now i want to put each 64 of them in the on of parts of a.
yes, i dont know how to threat with 3d vectors and how to show the values of it.
 

Ok, apart from the missing declarations in your new code snippet (a, s4, s5) I really dont know what this code is trying to acheive. When wr_ena is '0', you're trying to copy the entire memory contents to some variable? This is not possible in hardware.

assuming a is supposed to be a_var, the problem is you're trying to assign the entire memory in a single assign, I think you meant:

Code:
for i in a'range loop
  for j in a(i)'range loop
    a(i)(j) := memory(i*a'length + j);
  end loop;
end loop;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top