I'm trying to do a summer in VHDL, but when I try simulate, appear an error.
The code:
library IEEE;
use IEEE.Std_Logic_1164.all;
entity aritmetico is
port (A: in std_logic_vector(2 downto 0);
B: in std_logic_vector(2 downto 0);
Control: in std_logic_vector(1 downto 0);
Out_hex: out std_logic_vector(6 downto 0);
Out_bin: out std_logic_vector(3 downto 0)
);
end aritmetico;
architecture circ of aritmetico is
signal F,G,F1,F2,F3,F4: std_logic_vector(3 downto 0);
component sum is
port (A: in std_logic_vector(3 downto 0);
B: in std_logic_vector(3 downto 0);
F: out std_logic_vector(3 downto 0) );
end component;
component decoder is
port (C: in std_logic_vector(3 downto 0);
F: out std_logic_vector(6 downto 0)
);
end component;
component mux4_1 is
port (F1,F2,F3,F4: in std_logic_vector(3 downto 0);
sel: in std_logic_vector(1 downto 0);
F: out std_logic_vector(3 downto 0)
);
end component;
begin
F1<= ‘0’ & A;
F2<= A & ‘0’;
F3<= ‘0’& B;
F4<= B & ‘0’;
sum: Sum port map(F1,F,G);
decod: decoder port map (G, Out_hex);
multip: mux4_1 port map(F1,F2,F3,F4,Control,F);
G <= Out_bin;
end circ;
How can I solve this?
Best Answer
You can find and fix the syntax errors. They are usually quite simple.
In this case, you may need a better VHDL compiler to help you diagnose them ...
ghdl ( https://github.com/ghdl/ghdl documented at https://ghdl.readthedocs.io/en/latest/) reports
presumably at
F1<= ‘0’
which should beF1<= '0'
This sort of thing happens quite often if you copy/paste code from the PDF version of a textbook, and can be quite difficult to spot. Some type setter, unaware of the strict nature of VHDL syntax, decides to make the text look pretty...
There appear to be other errors too, but all in good time...