jerryt
Junior Member level 3
Hi, I am fairly new to VHDL. I have a project for school where I need to multiply constants and send the result to an output. Before I write the in depth code I wanted to verify the VHDL multiply operator with a simple example. I assign two constants integer values and then multiply these two constants and store the result in output C.
I tried to compile my code but I see the following error:
# ** Error: D:/Profiles/w30239/My Documents/Miscallaneous/ECE 584/Project/Example Code/MultExample.vhd(20): Type error resolving infix expression "*" as type ieee.std_logic_1164.STD_LOGIC.
# ** Error: D:/Profiles/w30239/My Documents/Miscallaneous/ECE 584/Project/Example Code/MultExample.vhd(22): VHDL Compiler exiting
I can't figure out how to resolve the error. My code is below. How do I fix this compiler error?
Thanks for everyone's help!
----------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity MultExample is
Port (C : OUT std_logic);
end MultExample;
architecture Behavioral of MultExample is
constant A: integer:= 4;
constant B: integer:= 2;
begin
C <= A*B;
end Behavioral;
----------------------------------------------------------
I tried to compile my code but I see the following error:
# ** Error: D:/Profiles/w30239/My Documents/Miscallaneous/ECE 584/Project/Example Code/MultExample.vhd(20): Type error resolving infix expression "*" as type ieee.std_logic_1164.STD_LOGIC.
# ** Error: D:/Profiles/w30239/My Documents/Miscallaneous/ECE 584/Project/Example Code/MultExample.vhd(22): VHDL Compiler exiting
I can't figure out how to resolve the error. My code is below. How do I fix this compiler error?
Thanks for everyone's help!
----------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity MultExample is
Port (C : OUT std_logic);
end MultExample;
architecture Behavioral of MultExample is
constant A: integer:= 4;
constant B: integer:= 2;
begin
C <= A*B;
end Behavioral;
----------------------------------------------------------