131 Week 4 - Arithmetic Logic Unit Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Role of the arithmetic logic unit (ALU)

A

Implements arithmetic (add, subtract, shifts etc) and logic operations (and, or, not, xor; comparisons - < = > etc.)

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

What does the ALU provide

A

Registers and status flags

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

Half adder

A

A logic circuit for adding 2 bits and returning a sum bit and carry bit.
XOR for sum and AND for carry.

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

Full adder

A

A logic circuit for adding 3 bits (2 inputs and 1 carry input) and returning a sum bit and carry out bit.

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

Ripple carry adder

A

Full adders can be connected together by linking C out of previous adder and C in of current adder allowing them to add multi bit numbers.

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

Disadvantage of ripple carry adder

A

They are slow because each full adder relies on the C out of the previous adder meaning each adder has to be executed one after another.

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

Carry select adder

A

Connects carry bits of adders similar to a ripple carry adder.
Lower half of the bits are added like a ripple carry adder.
Upper half of the adder is added twice, once assuming the first C in is 0 and another assuming it is 1.
After the lower half of the bits has been added, the correct prediction of the upper half of the bits is selected and an output is returned.

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

Advantages of a carry select adder

A

Because all 3 additions can be executed in parallel, a carry select adder is effectively twice as fast as a ripple carry adder.

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

Status flag

A

Bits organised into a special register called the flags register.
Each flag reflects an aspect of the result of an ALU operation.

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

Zero flag

A

Checks if an output results in 0.
Works by using a NOR gate on the result of an operation:
If any of the results of an ALU operation is 1, the zero flag is 0.
If all results of an ALU operation is 0, the zero flag is 1

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

Negative flag

A

Checks if an output results in a negative number.
Works by checking if the leftmost bit is 1 or 0:
If it is 1, the number is negative.
If it is 0, the number is positive.

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

Overflow flag

A

Checks if an output has resulted in an overflow error.
Works by checking signs of the inputs and the result.
If positive + positive = negative or negative + negative = positive, an overflow error has occurred.

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

Logic circuit for overflow flag

A

C in XOR C out

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

Bit shifting

A

A bit shift left or right works as multiplying or dividing by a power of 2 respectively.

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

4 types of shifts

A

arithmetic shift, logical shift, rotate and rotate through carry

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