Assignment 28 (Assigned November 8)
-
ALUs generates condition codes to help control unit in a microprocessor
to guide the flow of a program. For example, if a program wants to compare
two numbers and then perform the next operation depending on if number
A is greater than or equal to B or number B is greater than A. The ALU
can be used to subtract B from A and store the sign of the result (we are
not interested in the actual result). Similarly, in an another instance
we may be interested in comparing A and B to determine if A is equal
to B or not, we can subtract A from B and check if result is zero or not.
There are four condition code typically used: CARRY (to indicate if a carry
is generated from MSB), SIGN (MSB itself), ZERO (to indicate if all bits
are zero from ALU), and OVFL (to indicate if the operation resulted in
arithmetic overflow). CARRY, SIGN, and OVFL make sense only for ADD or
SUB operations. Is there a relationship between CARRY, SIGN and OVFL if
we are adding or subtracting 2's complement numbers.
-
Table 11.3 in the book gives 16 arithmetic and 16 logical functions performed
by an ALU circuit. Four bits F3-F0 specify the function and M specifies
arithmetic or logical operation required. C is carry input to ALU. What
will be the output if A=0011, B=0101, F3-F0 = 0101, C=0 (C'=1) and M=0.
-
Suppose you have to waste one cycle in the following data path (you may
have to do it if, for example, input is not ready). This is equivalent
of a NOOP (No operation) instruction. Provide a set of control signals
to waste one cycle.