Binary Arithmetic Flashcards

1
Q

What is a carry

A

when we run out of digits for storage, a carry will store the last digit

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

what is the amount of bits we are limited to in our arm architecture

A

32

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

What is the largest number we can represent with 32 bits

A

2^32

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

What are the four condition control flags

A

Negative
Overflow
Zero
Carry

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

what does the carry flag let us know

A

that the register does not store the actual answer as it was too big to be stored

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

how do we tell the processor to update the condition code flags

A

using s-bit. eg. ADDS, MOVS,

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

If s bit is set to 0 what does this mean

A

the condition code fags did not need to be set (false)

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

If s bit is set to 1 what does this mean

A

the condition code fags needed to be set (true)

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

how does the processor remember the results of the compare instruction

A

by updating the condition code flags

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

example of everyday modulo arithmetic

A

12 hour clock

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

modulo arithmetic used in binary

A

twos complement

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

how does twos complement work

A

the second half of the binary pattern is used again to represent minus numbers. Which way we see it should be from our interpretation of the numbers as the computer doesn’t know whether we are choosing a signed or unsigned interpretation

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

if the interpretation is negative, what is the most significant bit

A

1

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

if the interpretation is positive, what is the most significant bit

A

0

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

how to represent a minus number

A
  1. get positive version in binary
  2. invert
  3. add 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what does it mean to invert

A

changing all 0s to 1s and all 1s to 0s

17
Q

Why does the method we use for changing a binary number to it’s negative version work

A

inverting the bits is the equivalent of subtracting from minus 1, so that is why we add the 1 on at the end as if we were taking it away from 0

18
Q

what is the operation used for inverting

A

MVN

19
Q

what does MVN stand for

A

move with not

20
Q

what operation is used to get the negative version of a number

A

NEG

21
Q

what does NEG stand for

A

negate

22
Q

what does NEG really do

A

RSB R0, R0 , #0, when number is stored in r0

23
Q

technically, why doesnt the processor need to know the method of subtraction

A

As long as it can do addition and change signs, subtraction can be done

24
Q

What is oveflow

A

when the result of addition or subtraction gives a result that is outside of the signed number system

25
Q

what flag if used for overflow

A

V

26
Q

why is V used for overflow instead of O

A

as to not confuse the zero and overflow flags

27
Q

what flag is used for carry

A

C

28
Q

What are the overflow rules, when will it occur that v=1

A

when the MSB(a)=MSB(b) and MSB(a)=MSB(result)

29
Q

what does MSB stand for

A

most significant bit

30
Q

`What falg is used for 0

A

zero flag

31
Q

when will 0 flag be set to 1

A

when the result is all 0

32
Q

what flag is used for negatives

A

N

33
Q

When will the n flag be set to 1

A

is the result is negative (MSB=1)

34
Q

how many binary digits are behind each hex digit

A

4