Case Statement difficult

Joined
Oct 22, 2006
Messages
1
Reaction score
0
I am writing a program for a 4bit ALU and I am trying to get the add with carry porition right. The specific case looks like

when "0001" => output <= ('0' & ALUin_a) + ( '0' & ALUin_b ) + cin;
ALU_out <= output((width-1) downto 0);
set <= output(width); reset <= not(output(width));

The problem is that I have coded a set reset latch to retain the cout bit and use the value of it in the cin. The latch is done in a seperate process as such:

Latch : process (set, reset)
begin
if (set = '1' and reset = '0') then
Cout <= '1'; cin <= '1';
elsif (set = '0' and reset = '1') then
Cout <= '0'; cin <= '0';
end if;
end process Latch;

The case statement seems to be executing the 3 statements concurrently and that is making the Cin what ever is the carry for the current add operation not the previous. How can I change this so the cin that is being used is from the previous add? Any help is appreciated :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top