module 4: basic computations in computers Flashcards

(7 cards)

1
Q

Briefly describe the main function of the ALU and how it carries out those functions.

A

Performs operations (arithmatic, logic, binary)

carries out using control signals from the control unit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are flags? Where and how are they stored?

A

Flags = Single Bit status indicators that indicate a condition or status

flags are stored in the status/ flag register within the ALU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

a. 0101 1100
signed = +92
unsigned = 92

b. 1100 1010
signed = -54
unsigned = 202

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain what AND-masking and OR-masking are and how this is applied.

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Briefly explain why the multiplication function in an ALU would require a 16-bit register to store the result of two 8-bit numbers.

A

largest number you can represent with an 8 bit unsigned is 255 so you would need double that for 2 8 bit numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

name each and their function:

a. SHL
b. SHR

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly