I'm implementing a simple adder with carry out in VHDL on a BASYS2 board.
This is the code below:
entity adder is port ( a, b : in std_logic_vector(3 downto 0); sum : out std_logic_vector(3 downto 0); cout : out std_logic; kopce : in std_logic; ledica : buffer std_logic ); end adder; architecture sobirac of adder is signal tmp : signed(4 downto 0); begin process(kopce) begin if(rising_edge(kopce)) then ledica <= (not ledica); tmp <= signed(("0" & a)) + signed(("0" & b)); --sum <= std_logic_vector(tmp(3 downto 0)); sum(3) <= std_logic(tmp(3)); sum(2) <= std_logic(tmp(2)); sum(1) <= std_logic(tmp(1)); sum(0) <= std_logic(tmp(0)); cout <= tmp(4); end if; end process; end sobirac;
The "problem" is that I need to push the button two times in order for it to generate an output which I'm displaying on the onboard LEDs, why does it behave like this ? If I remove the process statement, and make it concurrent, it works in the instant I give it an input (2x4 switches).