Week 8 Flashcards

1
Q

Draw out truth tables for And, Or or Xor

A

See 8.1 at 5 min

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

What is a bitwise boolean operation?

A

A bitwise boolean operation is applied separately to every bit of a binary codeword.

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

What do shift left (shiftl) and shift right (shiftr) do?

A

If we have Ra, Rb, Rc: shiftl shifts Rb left by Rc places and stores in Ra. We add zeroes to the end of Ra for the spaces that we’ve shifted and on the other side, the bits are shifted out and dropped off.

Similarly for shiftr, except for the other side.

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

What kind of number will MUL, DIV, CMPGT, CMPLT work with?

A

Two’s complement

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

What kind of number will ADD, SUB work with?

A

Unsigned or two’s complement

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

What kind of number will CMPEQ work with?

A

Any codewords, including non-numeric ones

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

What happens in R15 when we DIV?

A

The remainder will go into R15. It will override what is already in R15.

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

What is an instruction cycle?

A

An instruction cycle is what it takes to completely process an instruction (fetch it, then execute it!)

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

What is the memory cycle?

A

The time involved in reading or writing a single word from/to a single memory location. Memory cycle will take a fixed amount of time.

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

How many memory cycles does an RRR instruction use?

A

1 (to fetch the operation word)

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

How many memory cycles does a JUMP take?

A

To fetch it, it has two words of machine code.

So two memory cycles

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

What does the control unit maintain?

A

Information about the current and next instruction.

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

What two registers will you find always in a CPU?

A

1) instruction register: contains the operation word of the instruction being executed
2) Program counter: contains the address of the next instruction to be executed.

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

What are the two machine specific control registers in Sigma 16?

A

1) The Address Register: contains the effective address specified in an RX or X instruction. It is used to hold initially any base address that’s contained in an indexing mode.
2) The Data Register holds temporary data.

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

Does the number of memory cycles required to fetch the whole instruction affect the time?

A

Yes, the more memory cycles, the slower the instruction takes to execute/run.
Memory cycles are much slower than internal operations.

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

What questions do we need to ask when examining the machine code instructions on a new CPU?

A

1) how many memory cycles are needed to fetch the whole instruction?
2) How many cycles are needed to fetch or store data?
3) How many independent memory locations can the instruction access?

17
Q

Why can’t we have multiple types of instructions in a CPU?

A

Many complex instructions mean a long operation word and a complex control unit.
A complex control unit with many instruction types is slower than a simple one with few types

18
Q

What is RISC?

A

A reduced instruction set computer.

19
Q

What is CISC?

A

Conventional machines with complex instructions.

20
Q

What is a virtual machine?

A

it’s a software model of a machine that may or may not exist as hardware.

21
Q

What is a hypervisor used for?

A

It’s a software that is often run on the host to create and manage new guests that can be complete copies of real machines.

22
Q

Why are virtual machines useful?

A

They allow a certain amount of protection. It allows us to do certain experiments that might be dangerous to do on our own comp.
Confine sensitive activities.

23
Q

What happens if a VM crashes?

A

The host will usually be fine and so will the hypervisor.

24
Q

What is a subroutine?

A

The low level structure (assembly level structure) that support HLL functions. Rather than repeating instructions in memory, we can split the repeated instruction into a subroutine and say JUMP when the subroutine should be called and then once this is run, it returns back to the instruction.

25
Q

What is the return address?

A

After the subroutine is called, we must return to the return address.

26
Q

How do we know where to jump back to after running a subroutine?

A

Use Jump and Link (JAL). JAL stores the return address in Rf, if we have:
JAL Rf, work[R0]

27
Q

Can you have subroutines inside subroutines?

A

Yes, these are called nested subroutine calls

28
Q

Where should we store many nested subroutine calls?

A

In memory

29
Q

What is a stack?

A

Stack is setup and maintained by a programmer.
Unlike an array, a stack can grow and shrink (dynamic).
Occupies consecutive memory locations.
The first address is the stack bottom, the last one is the stack top (grows upwards in memory).

30
Q

Where are the address of the stack bottom and stack top originally set to?

A

The bottom address. At this point the stack is empty. After a subroutine call, store return address on stack and increment the stack pointer (usually points to one above the stack top)

31
Q

what kind of data structure is a stack (fifo, lifo)?

A

LIFO (last in first out)

32
Q

What is storing an item at the stack top called?

A

a PUSH operation

33
Q

What is retrieving an item from the stack top called?

A

POP or PULL operation. The item popped is always the last one pushed

34
Q

How does the stack work in Sigma 16?

A
  • it’s programmer maintained.
  • special push and pop instructions
  • the stack grows upwards in Sigma 16, but in many CPUs it grows downwards.
35
Q

What is a stack overflow?

A

When the stack size reaches its maximum