Say if a computer with an ALU, containing the following operations,

ADD, SUB, DIV, MUL, SHL, SHR, NOT, OR, XOR AND

How can the ALU perform the conditional statement for the branch?

Say, let A be register1

And let B be register2

And let C be tempRegister

(A - B) --> C //perform ALU's SUB, and store result of A - B in C

The next part is where I am stuck, and I am stuck on how will the ALU perform this, as i can only use the provided operations above, I think?

If (C == 0) //if C is zero (A and B are equal)

//set program counter to the offset

Thanks in advance for anyone who took their time to read this!

This post has been edited by **GunnerInc**: 02 June 2012 - 01:11 PM

Reason for edit:: Disabled emoticons so code displays properly