Cannot find function "TO_INTEGER" for these actuals

T

Travis

Hi all, I'm compiling the following VHDL to make a simple ROM, and I'm getting these errors:
# Error: COMP96_0305: SUBONE_MODULE_VHDL.vhd : (93, 23): Cannot find function "TO_INTEGER" for these actuals.
# Error: COMP96_0138: SUBONE_MODULE_VHDL.vhd : (93, 23): The index types in the reference to the array object are incompatible with its range type.

I'm using Active-HDL 9.2. This was based off an example I got online, but I had to switch to the NUMERIC_STD IEEE library because I want to synthesize this.

Thanks!

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;


entity SUBONE_MODULE_VHDL is
port(
addr : in STD_LOGIC_VECTOR(4 downto 0);
clk : in STD_LOGIC;
dout : out STD_LOGIC_VECTOR(4 downto 0)
);
end SUBONE_MODULE_VHDL;

--}} End of automatically maintained section

architecture SUBONE_MODULE_VHDL of SUBONE_MODULE_VHDL is

-- enter your statements here --

type ROM_Array is array (0 to 31)
of std_logic_vector(4 downto 0);


constant Content: ROM_Array := (
0 => "10011", -- Suppose ROM has
1 => "00000", -- prestored value
2 => "00001", -- like this table
3 => "00010", --
4 => "00011", --
5 => "00100", --
6 => "00101", --
7 => "00110", --
8 => "00111", --
9 => "01000", --
10 => "01001", --
11 => "01010", --
12 => "01011", --
13 => "01100", --
14 => "01101", --
15 => "01110", --
16 => "01111", --
17 => "01110", --
18 => "01110", --
19 => "01110", --
20 => "01110", --
21 => "00000", --
22 => "00001", --
23 => "00010", --
24 => "00011", --
25 => "00100", --
26 => "00101", --
27 => "00110", --
28 => "00111", --
29 => "01000", --
30 => "01001", --
31 => "01010", --
OTHERS => "00000"
);

begin
process(clk, addr)
variable addr : integer := 0;
begin
if( clk'event and clk = '1' ) then
dout <= Content(TO_INTEGER(addr));
end if;
end process;


end SUBONE_MODULE_VHDL;
 
K

KJ

You have...

dout <= Content(TO_INTEGER(addr));

should be...

dout <= Content(TO_INTEGER(unsigned(addr)));

The reason is that addr is defined to be a std_logic_vector. Std_logic_vector has no numeric interpretation it is just an arbitrary collection of bits. By casting it as 'unsigned' you are saying to interpret it as an unsigned numeric quantity which can then be converted to an integer value.

Kevin Jennings
 
A

Andy

Travis,

You also need to remove the unused variable declaration for addr in the process. It is hiding the addr port.

Andy
 
T

Travis

Hi Andy,

I just tried Kevin's solution, noticed the error, got bummed, noticed your solution, and now all is fixed. Thank you both!

Andy & Kevin, if I could ask, it appears I was interpreting what "variable addr : integer;" was doing. I thought it was providing context for use of "addr" within the process block, but this is apparently incorrect. Do you have a good reference or pointer for these types of things?

Thanks again!
 
K

kevin.neilson

Another option is to make the input 'unsigned', which is a better type in this context.
 
A

Andy

Variables are storage objects that are usually local to processes or subprograms where they are declared. They are assigned using ":=" instead of "<=". Their value updates immediately upon execution of the assignment statement, instead of waiting until the process suspends, like signal values do.

Most VHDL texts cover variables, but most will tell you not to use them forRTL (or at least not for registers in RTL), which is unfortunate, since variables are quite powerful for both combinatorial and register logic, once you know how to use them.

Andy
 
A

Andy

What Kevin said (make addr unsigned).

Or, if your tools support vhdl-2008, you can use the new package ieee.numeric_std_unsigned.all, and use to_integer(addr) without converting (or changing) addr to unsigned.

Andy
 
T

Travis

Xilinx ISE won't be supporting VHDL 2008 at all, apparently they're reserving that for the Vivado tools, which is truly sad because it looks like VHDL2008 is a meaningful update.
 
K

kevin.neilson

And who knows how much 2008 Vivado really supports. Probably not much. Use Synplify, if possible. The VHDL 2008 additions are indispensable. One thing I could not do without is the fixed-point package.
 
T

Travis

I will examine the Synopsys tools; I'm converting a design that is largely schematic based in Active-HDL (that has components that date back to Active-CAD) to VHDL, and there are numerous headaches.
 
K

kevin.neilson

I've had to do the same thing, but years ago. I assumed nobody was using schematics anymore. I do see a lot of HDL that looks like schematic netlists.
 
T

Travis

Schematics are great from a top down perspective, "The block does this", etc, but the design I'm converting has AND, OR, inverters, Virtex specific buffers, etc sprinkled throughout it.

We're using Active-HDL, and we have uncovered SO many problems with the tool it is ridiculous. Apparently so few people do it this way they're dropping support for updated Xilinx schematic input in Active-HDL 9.3.
 
R

rickman

Xilinx ISE won't be supporting VHDL 2008 at all, apparently they're reserving that for the Vivado tools, which is truly sad because it looks like VHDL2008 is a meaningful update.

That is pretty amazing! I can't believe Xilinx is ignoring VHDL 2008.
I am coding in VHDL 2008 and expect my tools to support that.

I don't have any trouble with the Lattice tools including the Active-HDL
simulator. I was working with the iceCube tool for the iCE40 parts, but
haven't done anything with VHDL 2008 in the main line devices. I may
try it with the current design I'm working on. I need to get a new
laptop and will install the newer tools on it and give VHDL 2008 a run
under Diamond.
 
A

Anssi Saari

rickman said:
That is pretty amazing! I can't believe Xilinx is ignoring VHDL
2008. I am coding in VHDL 2008 and expect my tools to support that.

I'd also expect Xilinx to support at least the fixed point stuff in ISE.
Didn't everyone add that almost overnight?
 
K

kevin.neilson

Theoretically, the fixed point library shouldn't require any special synthesizer support but I wouldn't be surprised if ISE didn't like it for some reason. I definitely wouldn't try it with unconstrained i/o. And, as with integer math functions, I wouldn't expect it to map to DSP48s very well.
 
A

Andy

Unconstrained IO fixed point should work fine, since the bound object is static and therefore it's index range is static too. Just be real careful with bit string literals! (e.g. don't use bit string literals for fixed/floating point).

Fixed point arithmetic is implemented using numeric_std operators, so it should do fine for anything

IIRC, some synthesis tools had problems with fixed point because they did not support negative indices on arrays (slv/signed/unsigned have natural index ranges). There are '93 compatible versions of the fixed point package available, they just don't support package generics for saturate/rollover or round/truncate and number of guard bits for division. You have to change the constants in the '93 package.

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top