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.

0 definitions of operator "+" match here [ERROR]

Status
Not open for further replies.

Cousin

Newbie level 1
Joined
May 10, 2017
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
34
Help please, error is located where it is commented "[ERROR]"....I TRIED USING UNSIGNED, AND THE LIBRARIES ARE CORRECT. IM NOT SURE WHAT ELSE TO DO


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
library UNISIM;
use UNISIM.VComponents.all;
 
entity segmentdriver is
  Port (
 
  display_A : in std_logic_vector(3 downto 0);
  display_B : in std_logic_vector(3 downto 0);
  display_C : in std_logic_vector(3 downto 0);
  display_D : in std_logic_vector(3 downto 0);
  segA : out std_logic;
  segB : out std_logic;
  segC : out std_logic;
  segD : out std_logic;
  segE : out std_logic;
  segF : out std_logic;
  segG : out std_logic;
  select_Display_A : out std_logic;
  select_Display_B : out std_logic;
  select_Display_C : out std_logic;
  select_Display_D : out std_logic;
  clk : in std_logic
 
   );
end segmentdriver;
 
architecture Behavioral of segmentdriver is
 
--component declaration
 
COMPONENT segmentdecoder
Port(
 
Digit : in std_logic_vector(3 downto 0);
segment_A : out std_logic;
segment_B : out std_logic;
segment_C : out std_logic;
segment_D : out std_logic;
segment_E : out std_logic;
segment_F : out std_logic;
segment_G : out std_logic
);
end COMPONENT;
 
COMPONENT clock_divider
Port(
 
clk : in std_logic;
enable : in std_logic;
reset : in std_logic;
data_clk : out std_logic_vector(15 downto 0) 
 
);
 
end COMPONENT;
 
Signal temp_data : std_logic_vector(3 downto 0);
Signal clock_word : std_logic_vector(15 downto 0);
Signal slow_clock : std_logic;
 
begin
 
-- component instantiation
 
uut: segmentdecoder Port Map(
 
Digit => temp_data,
segment_A => segA,
segment_B => segB,
segment_C => segC,
segment_D => segD,
segment_E => segE,
segment_F => segF,
segment_G => segG
);
 
uut1: clock_divider PORT Map(
clk => clk,
enable => '1',
reset => '0',
data_clk => clock_word
);
 
slow_clock <= clock_word(15);
 
Process (slow_clock)
 
variable display_selection : std_logic_vector(1 downto 0);
 
Begin
 
if slow_clock'event and slow_clock = '1' then
 
case display_selection is 
 
when "00" => temp_data <= display_A;
 
select_Display_A <= '0';
select_Display_B <= '1';
select_Display_C <= '1';
select_Display_D <= '1';
 
display_selection := display_selection + '1'; -- 0 definitions of operator "+" match here [ERROR]
 
when
"01" => temp_data <= display_B;
 
select_Display_A <= '1';
select_Display_B <= '0';
select_Display_C <= '1';
select_Display_D <= '1';
 
display_selection := display_selection + '1'; -- 0 definitions of operator "+" match here [ERROR]
 
when 
"10" => temp_data <= display_C;
 
select_Display_A <= '1';
select_Display_B <= '1';
select_Display_C <= '0';
select_Display_D <= '1';
 
display_selection := display_selection + '1'; -- 0 definitions of operator "+" match here [ERROR]
 
when
others => temp_data <= display_D;
select_Display_A <= '1';
select_Display_B <= '1';
select_Display_C <= '1';
select_Display_D <= '0';
 
display_selection := display_selection + '1'; -- 0 definitions of operator "+" match here [ERROR]
 
end case;
end if;
end process;
 
end Behavioral;

 

Yes, thats because of two problems
1. display_selection is a std_logic_vector, and there are no standard definitions for + in vhdl 1993 (there is in 2008 if you include numeric_std_unsigned). Redeclare display_selection as unsigned
2. there is no definition for unsigned + std_logic, only unsigned + integer and unsigned + unsigned. So you either need:

display_selection + 1; -- unsigned + integer

or

display_selection + to_unsigned(1, 1); -- converts integer 1 to unsigned with 1 bit length - unsigned + unsigned.
 

An advice from the other beginner: look into numeric_std source:
https://www.csee.umbc.edu/portal/help/VHDL/packages/numeric_std.vhd
and see what operations are defined there, what are the input types and what type is returned. For example:

function "+" ( L,R: SIGNED) return SIGNED;
-- Result subtype: SIGNED(MAX(L'LENGTH, R'LENGTH)-1 downto 0).
-- Result: Adds two SIGNED vectors that may be of different lengths.

As you see the "+" operator is defined for two signed vectors and returned type is signed as well.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top