AR# 4377

FPGA Express - Which libraries are needed for std_logic_vector addition/subtraction?

Description

Keywords: VHDL, libraries, std_logic_vector, addition, subtraction, FPGA Express

Urgency: Standard

General Description:
When I try to add/subtract with std_logic_vectors, the following error will be reported if the correct libraries are not used:

Error L23/C0 : #0 Error: <file>.vhd line <x>
Type mismatch on left and/or right operand of binary operator. (VSS-523)

Which libraries are needed for std_logic_vector addition/subtraction?

Solution

1

For signed logic_vectors, use the following libraries:

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_signed.all;

2

For unsigned logic_vectors, use the following libraries:

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
AR# 4377
Date 08/11/2003
Status Archive
Type General Article