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.

array type range constraint

Status
Not open for further replies.

Binome

Full Member level 3
Joined
Nov 16, 2009
Messages
152
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Location
Lyon, France
Activity points
2,405
Hi,
here's a part of my code:
Code:
  wit_process: process(rst_n, s_done)
    variable wit_addr : std_logic_vector(7 downto 0) := (others => '0');
    variable ind : unsigned range 0 to 7 := 0;
  begin
    if rst_n = '0' then
      wit <= (others => (others => '0'));
      s_wit_addr <= (others => '0');
      wit_addr := (others => '0');
    else 
      for h in 1 to logl loop
        for w in 0 to leaves_nbr-1 loop
          for i in wit(w)'length-(h+1) to wit(w)'length-1 loop
            wit_addr(i) := '0';
          end loop;
          for i in 1 to wit(w)'length-(h+1)-1 loop
            ind := to_unsigned(w, wit(w)'length)
            wit_addr(i) := std_logic_vector(ind)(i+h+1);
          end loop;
          wit_addr(0) := not(std_logic_vector(to_unsigned(w, witness(w)'length))(h+1));
          
          s_wit_addr <= wit_addr;
        end loop;
      end loop;
    end if;
  end process;
I hope you can understand the meaning of it. When compiling with Modelsim the error is "Range constraints cannot be applied to array types." for line 3 and I don't know what to do with that.
Can someone help me?
 

The unsigned type is an array type, not an integer type. range constraints can only be used with integer types.
You meant to write:

variable ind : unsigned(2 downto 0);
 

Thank you. Making the ind variable an integer solved the problem.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top