EmbDev.net

Forum: FPGA, VHDL & Verilog VHDL complex memory array code


von Omar Rashad (Guest)


Rate this post
useful
not useful
Hello

I am writing a simple code for a 2 dimensional complex number (integer) 
array in VHDL. The matrix is basically
[ 1 1 1 1 ,
  1 -1 j -j,
  1 -1 j -j,
  1 1 -1 -1,
  1 -1 -j j]

This is my code
1
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
5
entity IFFT_matrix is
6
  port (address_r, address_c: IN std_logic_vector (1 downto 0);
7
        wr, wi: OUT std_logic_vector (7 downto 0)); 
8
end IFFT_matrix;
9
10
architecture behavior of IFFT_matrix is
11
12
type matrix is array (0 to 3, 0 to 3) of integer range -1 to 1; --range depends on IFFT size
13
constant wr_matrix: matrix:= ((1,1,1,1),(1,-1,0,0),(1,1,-1,-1),(1,-1,0,0));
14
constant wi_matrix: matrix:= ((0,0,0,0),(0,0,1,-1),(0,0,0,0),(0,0,-1,1));
15
16
begin
17
18
wr <= std_logic_vector(to_signed(wr_matrix (to_integer(unsigned(address_r), to_integer(unsigned(address_c)))));
19
wi <= std_logic_vector(to_signed(wi_matrix (to_integer(unsigned(address_r), to_integer(unsigned(address_c)))));
20
21
end behavior;

Compiling with vhdlan gives me this error:

"Parsing design file 'IFFT_matrix.vhd'

Error-[IEEEVHDLSYNTAXERR] Syntax error
IFFT_matrix.vhd, 18

  ...x (to_integer(unsigned(address_r), 
to_integer(unsigned(address_c)))));...
                                                                          ^
  Syntax error detected during VHDL parsing.


Error-[IEEEVHDLSYNTAXERR] Syntax error
IFFT_matrix.vhd, 19

  ...x (to_integer(unsigned(address_r), 
to_integer(unsigned(address_c)))));...
                                                                          ^
  Syntax error detected during VHDL parsing.

"IFFT_matrix.vhd": errors: 2; warnings: 0.
[oalsamma@bifur ~/intel]$ gedit IFFT_matrix.vhd"

I cannot quite figure out what to fix. Can you help please?

von FemtoMaik (Guest)


Rate this post
useful
not useful
check your brackets or use an editor which does this for you :-)

wr <=
  std_logic_vector(
    to_signed(
      wr_matrix(
        to_integer(unsigned(address_r)),
        to_integer(unsigned(address_c))
      ),
      wr'length
    )
  );

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.