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.

C , VERILOG, VHDL.

C , VERILOG, VHDL.

Share this group

Quick Overview

Category
Uncategorized
Language
Total members
287
Total events
0
Total discussions
32
Total views
57K
Total albums
0

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Problem with TO_INTEGER in VHDL

Status
Not open for further replies.

karenmuller

Newbie
Newbie level 1
Joined
May 6, 2021
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;

ENTITY mult4 IS
PORT (
a, b : IN std_logic_vector(3 DOWNTO 0);
cout : OUT std_logic_vector(7 DOWNTO 0)
);
END mult4;

ARCHITECTURE behave OF mult4 IS
SIGNAL result : std_logic_vector(7 DOWNTO 0);
BEGIN
arith_process : PROCESS (a, b)
VARIABLE p : INTEGER RANGE 0 TO 255;

BEGIN
p := TO_INTEGER ('0' & a) * TO_INTEGER('0' & b);
result <= TO_STDLOGICVECTOR(p, 8);
END PROCESS arith_process;
cout <= result;
END behave;

I'm having a problem with TO_INTEGER, I tried to fix it but none worked, I'm new to VHDL and I'm not finding the solution.

Error (10405): VHDL error at mult4.vhd(19): can't determine type of object at or near identifier "TO_INTEGER" -- found 0 possible types
 

barry

Advanced Member level 7
Advanced Member level 7
Joined
Mar 31, 2005
Messages
6,062
Helped
1,178
Reputation
2,368
Reaction score
1,339
Trophy points
1,393
Location
California, USA
Activity points
32,974
to_integer takes UNSIGNED as an argument, not SLV. Simply cast your SLV to UNSIGNED.
 

Status
Not open for further replies.
Top