VHDL complex memory array code

Guest #4112219
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?
Guest #4112242
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
    )
  );

Reply

A question of your own? This thread is over 11 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.