Binary Arithmetic Flashcards

1
Q

What is the range for Modulus Arithmetic?

A

0 to M-1 Where M is the modulus

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

Calculation results must fit into a fixed-size register If n is the size in bits, then M = __?

A

M = 2^n E.g. M is 16 for a 4-bit register

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

Unsigned integers range from _ to _

A

0 to 15 (0000 to 1111)

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

9 + 8 with arithmetic instructions

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

Which flag do adds and subs set?

What can it be used for?

A

The Carry flag

Can be used to do extended precision arithmetic

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

Rules for adding single bits

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

What are the rules implemented by a full adder circuit?

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

How is subtraction carried out?
Which part of the CPU does the subtracting?

A

It is done in the ALU by negating the subtrahend (what is subtracted) and adding it

It reuses the addition circuitry, thus minimizing hardware complexity

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

Which flags do the signed branch instructions use?

A

N, Z, V flags

N = (Xd<63> == 1)

Z = (Xd == 0)

V = ((Xn<63> & -Xm<63> & -Xd<63>) | (-Xn<63> & Xm<63> & Xd<63>))

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

Which instruction sets the flags using these rules?

A

subs (alias of cmp)

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

When does overflow occur?

A

When the sign bits for Xn, Xm, and Xd are:

1,0,0
or
0,1,1

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

Signed Number Branching Conditions example

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

What does one interpret the data as in unsigned arithmetic?

A

unsigned integers

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

When adding, which flag indicates overflow?

A

a carry out (C= 1)

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

Unsigned Number Branching Conditions Table

A

Must use these condition codes in conditional branches when comparing integers

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

What are the two sub-steps in a step for multiplication?

A

A conditional addition

An arithmetic shift right

17
Q

How many bits does the product require? And why?

A

Twice as many as those for source registers because the result is put into 2 concatenated registers

18
Q

If the original multiplier is negative, which step is needed?

A

Subtract the multiplicand from the high-order part of the result (i.e. from the product register)

19
Q

4-bit example of multiplication

A
20
Q

How is division carried out?

A

Can be done using an iterated procedure similar to manual long division

21
Q

When is extended precision arithmetic used?

How is it archived?

A

Is used when you need more than 64 bits of precision

Archived using 2 or more registers to represent a number e.g. 192-bit unit uses 3 registers x19 x20 x21

22
Q

What is the procedure to adding extended precision numbers together?

A
23
Q

Which instructions use the C flag when adding?

A

The adc and adcs instructions

24
Q
A