Briefly describe the main function of the ALU and how it carries out those functions.
Performs operations (arithmatic, logic, binary)
carries out using control signals from the control unit
What are flags? Where and how are they stored?
Flags = Single Bit status indicators that indicate a condition or status
flags are stored in the status/ flag register within the ALU
Briefly explain the function of the following flags and how the ALU works out their
value:
a. C flag
b. N flag
c. V flag
d. Z flag
a: Carry flag - if there is an extra bit, C = 1 (carry is true).
b: negative flag - N = 0 (answer is positive)
c: overflow flag - V = (1 XOR 1) = 0 {number is in valid range}
z: zero flag - set to 1 if ALU operation result is 0
Interpret each of the following binary numbers as (i) unsigned integers and (ii) signed 2-s complement integers
a. 0101 1100
b. 1100 1010
a. 0101 1100
signed = +92
unsigned = 92
b. 1100 1010
signed = -54
unsigned = 202
Explain what AND-masking and OR-masking are and how this is applied.
And-masking: To selectively “clear” specific bits of a data word
Or-masking: OR instructions can be used to selectively “set” specific bits of a data word
Briefly explain why the multiplication function in an ALU would require a 16-bit register to store the result of two 8-bit numbers.
largest number you can represent with an 8 bit unsigned is 255 so you would need double that for 2 8 bit numbers.
name each and their function:
a. SHL
b. SHR
a: shift left. moves each bit one destination to the left. good for multiplication
b: shift right: moves each bit 1 place to the right. good for division.