Class 23: Counting In Hex And Integer Multi/Div Flashcards

1
Q

The stack grows _____ in RAM. (the address decrease as we push more and more value onto the stack)

A

Downward

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

Hex subtraction
8000 - 0008

A

7FF8

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

_____ are places on CPU where data is stored, typically in 8 bytes

A

Registers

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

Every binary value is an addition in powers of ___

A

2

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

If we are multiplying by some number K, where K is represented by 2^k, shift _____ by k.

A

Left

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

Shifting, adds, and subtracts, generally take ___ clock cycle, many fewer clock cycles than multiplication and division

A

1

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

X = 5;
X7 = 35. / 7 = 0111

N = 2. M = 0

A

X«2 + x«1 + x«0
OR
X«3 - x«0

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

Formual for negative constants

A

(X«m) - (x «n+1)
N= position of leftmost 1
M = position of rightmost 1

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

If the most significant bit in op1 is in the position of op1n, and if operants and the result have w bit representations, how many bits can op1 be shifted left before overflow due to shifting occurs

A

(W-1) - op1n
Ex: w = 4 bits op1n = 2 (0110) then 4-1-2 = -1
We can only shift left once, any more than that causes overflow

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

What is the significance between op2n and the maximum number of bits that op1 is shifted left by the multiplication algorithm

A

Op2n is the maximum number of bits that op1 can be shifted left

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

If op2n ____ w-1-op1n, overflow due to shifting will occur.

A

>

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

Dividing by powers of 2 —> ______

A

Right shifting

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

Dividing by 2^k

A

Right shifting by k (x»k)
Then rounding down (toward zero)

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

Signed integer division

A

Two complement
Sign extends for arithmetic shift (fill with copy of msb)
Rounds down (away from zero for negative results)
-7/2 will yield -4 rather than -3

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

W = 8, op1 = 4, op2 = 3
Does overflow occur?

A

W(8) -1-op1n (4) = 3

Is op2n > w-1-op1n? Yes, 3>3

No overflow

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

Dividing by powers of 2 —>

A

Right shifting

17
Q

Integer divison always _____

18
Q

Signed integer division

A
  • Two’s complement
  • Sign extend for arithmetic shift (fill with copy of msg)
  • Rounds down (away from 0 for negative results)
    -7/2 will yield -4 rather than -3