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.

[SOLVED] object cannot be indexed because it has natural type rather than array type

Status
Not open for further replies.

rafimiet

Member level 5
Member level 5
Joined
May 21, 2015
Messages
94
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,364
I am getting the error:
Error(13692): VHDL error at generic_multiplier.vhd(66): object cannot be indexed because it has natural type rather than array type
The code is as follows:
Code:
[/QUOTE]
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

library vvc_lib;
use vvc_lib.pkg_TrCoeffMatrix.all;

entity generic_multiplier is
generic (
    g_data_width : natural := 512; -- 64 bytes (32 (16bit) coefficients)
    g_coeff_width : natural := 16;
    g_bl_size       : natural := 4
    );
port (
    i_data_row     : in  std_ulogic_vector(g_data_width-1 downto 0); -- (M--> L)SB <= (|Pix_N|...|Pix_2|Pix1|) in memory
    o_data_row     : out std_ulogic_vector(2*g_bl_size*g_data_width-1 downto 0)
);
end entity generic_multiplier;

architecture rtl of generic_multiplier is
    subtype t_dim1 is signed;
    type t_dim1_vector is array (natural range <>) of t_dim1;
    type t_dim2_vector is array (natural range <>) of t_dim1_vector;
    -- type t_dim2_vector is array (0 to 3, 0 to 7) of std_ulogic_vector(7 downto 0);
    signal s_data_in : t_dim2_vector (0 to g_bl_size-1)(0 to g_bl_size-1)(g_coeff_width-1 downto 0);
    signal s_data_out : signed(2*g_bl_size*g_data_width-1 downto 0) := (others => '0');

begin
    -- Reshape input data -- No need to change upto 4x4 block
    gen00: for i in 0 to g_bl_size-1 generate
        gen01: for j in 0 to g_bl_size-1 generate
            s_data_in(i)(j) <= signed(i_data_row(g_coeff_width*(i*g_bl_size+j+1)-1 downto g_coeff_width*(i*g_bl_size+j)));
        end generate gen01;
    end generate gen00;

    -- Matrix Multiplication
    gen02:  for i in 0 to g_bl_size-1 generate
        gen03: for j in 0 to g_bl_size-1 generate
            gen04: for k in 0 to g_bl_size-1 generate
                s_data_out(2*g_coeff_width((i+j)*g_bl_size+k+1)-1 downto 2*g_coeff_width((i+j)*g_bl_size+k)) <= s_data_in(i)(k) * c_dct2_b4(k)(j);
            end generate gen04;
        end generate gen03;
    end generate gen02;

    -- Output
    o_data_row(g_bl_size*g_bl_size*g_bl_size*2*g_coeff_width-1 downto 0) <= std_ulogic_vector(s_data_out(g_bl_size*g_bl_size*g_bl_size*2*g_coeff_width-1 downto 0));
    o_data_row(s_data_out'length-1 downto g_bl_size*g_bl_size*g_bl_size*2*g_coeff_width) <= (others => '0');
end architecture rtl;
[QUOTE]
I get the error in the line:
Rich (BB code):
s_data_out(2*g_coeff_width((i+j)*g_bl_size+k+1)-1 downto 2*g_coeff_width((i+j)*g_bl_size+k)) <= s_data_in(i)(k) * c_dct2_b4(k)(j);
            end generate gen04;
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
50,996
Helped
14,633
Reputation
29,542
Reaction score
13,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,765
Sounds plausible. I presume the error is referring to the term g_coeff_width(x) which makes no sense for a natural value. Either it's a typo or some misunderstanding.
 
Last edited:

    rafimiet

    Points: 2
    Helpful Answer Positive Rating

Akanimo

Advanced Member level 3
Advanced Member level 3
Joined
Aug 30, 2016
Messages
799
Helped
136
Reputation
272
Reaction score
146
Trophy points
43
Activity points
5,513
Hi,

The parameter g_coeff_width is a constant (generic) with a natural type. By writing g_coeff_width((i+j)*g_bl_size+k+1), you are trying to index it. That cannot be done. I believe this is the problem.
 

    rafimiet

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top