Chapter 2: Status Flags Flashcards

1
Q

What are staus flags?

A

Status flags are special bits that are contained in the Status Register and contain information about the previous process in the ALU. These flags are also available to subsequent instructions.

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

What is the zero flag?

A

The Zero flag, denoted Z, has a value of 1 (i.e. true) if the result of the previous calculation is zero. It is the NOR of every bit in the result

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

What is the carry flag?

A

The Carry flag, denoted C, has a value of 1 if the result cannot be fit into the number of allowable bits

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

An example use of the carry flag?

A

For example, if you try to add two unsigned integers 125 + 178 with only 8-bit data words, you have 01101101+10110010 and the result is 100101111 which is now 9-bits rather than 8. The 9th bit is called the carry bit. This is useful if you want to add two large numbers that each require 2 words of data to store them.

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

Other uses of the carry flag?

A

The carry flag also acts as a borrow flag during subtraction operations. Unfortunately there are different ways that this can be implemented, with some architectures using one convention, and others using a second. Therefore, it is important to know the rules of the architecture to get this right.

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

What is the Overflow?

A

The overflow is similar to the carry flag when using signed integers, where the leading bit represents the sign. Remember that using 2’s complement notation 8-bits represent the numbers from -128 to 127. If the result of an addition leads to a number greater than 127, then the overflow flag is set (i.e. changed to 1). If this happens, the result will be incorrect.

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

Example of an overflow?

A

For example, consider adding the two numbers 65+87, corresponding to 01000001 + 01010111, the result is 10011000. In this case the magnitude of the number has spilled out of the first 7 bits into the 8th sign bit. As a signed integer the result is -104, and is clearly not the result that was required. An overflow has occurred which has to be taken into account when using this result.

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

How to tell if there is going to be an overflow?

A

Whether there is an overflow can be calculated by XORing the top two carry bits from an addition/ subtraction.

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

What is the Negative(sign)?

A

The Negative or Sign flag indicates whether the result of the last operation was negative or positive. It is just a copy of the sign bit and has no meaning for an unsigned number.

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

What is the Half(Digit) carry?

A

The Half carry flag is set to 1 if there is a carry (or borrow) from the first 4 bits to the second 4 bits during an addition.

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

When is the Half(Digit) carry useful?

A

when using Binary Coded Decimals (BCD).This encoding system represents the digits 0-9 with 4 bits (note that there are 16 combinations of 4 bits but only 10 digits – hence there is some redundancy). Arithmetic is more complicated in this system, and at times the value of 6 must be added onto the result of an addition – one of these occasions being if the half-carry flag is set

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

Half(Digit) Carry example?

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

What is parity?

A

Parity describes whether the number of 1’s in a binary number is odd or even (whether a value of 1 corresponds to an even or odd number of bits set depends on the convention used in the microprocessor). It is useful for detecting or correcting errors in a communication system.

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