Just to add a bit of extra information to Martin's answer, you need to be careful about detecting the overflow with 2's complement arithmetic.
For example, if you have 3-bit signed values represented in two's complement format and you want to detect an overflow, you need to sign extend into the extra bit and then look to see if the extra bit is different from the most significant wanted bit:
For example, if you want to calculate a = b + c:
--Declare the signals
signal overflow : std_logic;
signal a : signed(2 downto 0);
signal b : signed(2 downto 0);
signal c : signed(2 downto 0);
-- Declare some additional signals with one more MSB than the original signals
signal a_extended : std_logic(3 downto 0);
signal b_extended : std_logic(3 downto 0);
signal c_extended : std_logic(3 downto 0);
-- Sign extend the MSB
b_extended <= b(2) & b;
c_extended <= c(2) & c;
-- Perform the addition
a_extended <= b_extended + c_extended;
-- Detect the overflow case
overflow <= '1' when a_extended(3) /= a_extended(2) else '0';
-- Calculate the answer
-- Limit to 100 (-4) or 011 (+3) in the case of overflow
process(a_extended)
begin
if a_extended(3) /= a_extended(2) then
if a_extended(3) = '1' then
a <= "100";
else
a <= "011";
end if;
else
a <= a_extended(2 downto 0);
end if;
end process;