Week 4 Flashcards

1
Q

What do machine code instructions contain?

A
  • Some operation (op-code) such as add, jump etc.

- Necessary auxiliary info (where to get the operands, store results, where to jump to)

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

Where are instructions held?

A

In memory (as consecutive addresses) as one or more words.

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

What is the op-code?

A

It’s part of the operation word. It tells the control unit (CU) which operation this is e.g. ADD, MULTIPLY etc

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

How do we prevent instructions from becoming too long?

A

Restrictions may be imposed on where a particular instruction can be accessed.

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

What are addressing modes in the CPU design?

A

They specify where an operand for an instruction is to be found or a result should be stored. There are 5 common examples:

1) immediate, e.g. ADD 2
2) Absolute, e.g. gives the numeric address of the memory location involved
3) Register indirect, e.g. tells the control unit to go to the register you specify and fully from memory the value correlating to the address
4) Indexed addressing, e.g. take the base address (memory address) and add to the number in the register.

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

What 3 things does Sigma 16 consist of?

A

It consists of:

  • 16 registers (R0…R15 where R0 is always 0)
  • the Program Counter
  • 16-bit memory locations (16-bit memory locations with addresses 0000_16 to ffff_16)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where are operands located?

A

In any memory location or register file register.

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

What is the effective address?

A

Where the operand is stored (either in memory location or reg file reg).

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

What is Sigma-16?

A

Virtual CPU (runs as software, not hardware), everything is 16-bits.

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

What is the op-field in Sigma 16?

A

The most significant 4-bits of the operation word (which is 16-bits long) is called the op-field.

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

What addressing modes are used in Sigma-16?

A

Register addressing and indexed addressing

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

What are the three Sigma 16 instruction formats?

A

RRR (Register Register Register)
RX
X

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

how many op codes are there in RRR instruction format?

A
14:
\+ - x %
compare less than
compare equals
compare greater than
bitwise boolean: inv, and, or, xor
logic shifts: shift left, shift right
trap
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Are all numbers in RRR 16 bit twos-complement or unsigned?

A

2’s complement

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

Which addressing mode does RRR instruction use?

A

register addressing

e.g. ADD R_x,R_y,R_z

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

What is assembly language?

A

A list of assembly language statements (gets translated into machine code instruction) and occasionally assembler directives (does not get translated to MC, it’s rarely used). It’s simply an instruction to the assembly program to do something.

17
Q

How are assembly language statements constructed?

A

Label Mnemonic Operands ;Comment

  • Label is chosen by the programmer. If there’s no label, make a space.
  • Mnemonic: short name for the instruction
  • Comment: optional, starts with ;
  • for an RRR, the operand field always lists the 3 registers Rd,Ra,Rb (no spaces).
18
Q

How do we denote a hexadecimal number, e.g. 100_16?

A

$100

19
Q

What does the DATA directive (type of assembler directive) do?

A

Allows data to be preset in specific memory.

e.g.
x DATA $3000 ;Comment
Gives the label x to the next available memory location and initialises it to $3000.

It’s now possible for other instructions to use the label x as a variable.

20
Q

How many RX Instructions are there?

A

It has 6 instructions.

21
Q

How are RX instructions composed?

A

op code, d, a and b.
d and a are needed to specify registers.
b is not. We put a value in the b field (1,2,3) to differentiate between the RX instructions. This is the extension of the op-code.
op code is F (1111)

22
Q

What are the six RX instructions?

A
LEA Load effective address - loads constants into the register file
LOAD - copies data from memory
STORE
JUMP False
JUMP True
Jump and link
23
Q

What do the RX parameters stand for?

A

X - memory address/effective address

R - register

24
Q

What is a destination register

A

d field

25
Q

How are RX instructions comprised?

A

LOAD Rd,x[Ra]

Load instruction where the content of Ra is added to x and copies the data into Rd.

26
Q

what op-field value does an X format instruction have?

A

E base 16 (i.e. 1110)

27
Q

What is the main difference between the OW in RX and X format?

A

RX needs two operation words

X only needs one operation word (no destination register needed).

28
Q

What is the one X instruction?

A

JUMP

29
Q

What’s the difference between Load and LEA?

A

Load loads the CONTENT inside the address to register R1, e.g.
LOAD R1, 1024[R0] ; loads the content of register 1024 to register R1

LEA loads the register with a constant. e.g.
LEA R1, 1024[R0] ; loads the value 1024 into register R1

30
Q

What does cmplt R1,R2,R3 do?

A

Sets R1 as 1 (i.e. true) if R2

31
Q

What does JUMPF R1,x[R2] do?

A

If R1 is 0, we jump to R2+x. Otherwise do nothing.

32
Q

What’s the definition of source code?

A

Code that is written by humans (e.g. Java or assembly language) and has not yet been converted to machine code (by a compiler or assembler).

33
Q

What’s the definition of object programs?

A

Programs that have been turned into machine code. This can be thought of the output of a compiler or assembler. It’s a list of binary words.

34
Q

What do the assembler and compiler do?

A

They generate necessary content for all memory locations required for program or data.

35
Q

What is a memory image?

A

It’s a list of binary words and their associated addresses, which can be stored on disk and loaded into primary memory when the object program is to be run.

It will be loaded potentially in blocks, in an increasing list of addresses.

36
Q

What is the start address?

A

It’s the first instruction that’s supposed to be executed when the program is run. The start address will be loaded into the program counter.