Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as VHDL by freenode ( 15 years ago )
FUNCTION adder (CONSTANT a : UNSIGNED(15 DOWNTO 0); CONSTANT b : UNSIGNED(11 DOWNTO 0)) RETURN UNSIGNED IS
        VARIABLE result         : UNSIGNED(16 DOWNTO 0) := "00000000000000000";
BEGIN
        result := "0" & a;
        result := result + b;
        IF result(result'HIGH) = '1' THEN -- here is the problem
                RETURN "0000000000000000";
        END IF;
        RETURN result(15 DOWNTO 0);
END FUNCTION;

 

Revise this Paste

Your Name: Code Language: