Lecture 2 Flashcards

Programming models

1
Q

What is the instruction cycle?

A

The procedure of processing an instruction by the microprocessor

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

What does a programming model define?

A
  1. What instructions are avaılable
  2. How instructions access their operands
  3. How instructions are described in the processors assembly language

N.B. Processors with different programming models can offer similar sets of operations but may require VERY different approaches to programming

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

What is a data transfer instruction?

A

Operations that move data from one place to another. They DON’T modify data, just copies it to destination

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

What is a data operation instruction?

A

Instructions that modify the data values and store the result

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

What is a program control instruction?

A

Jump or branch instructions used to go into another part of the program. Jumps can be absolute or conditional (If else)

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

What are the different data transfer instructions?

A

Load data
Store data
Move data
Input data
Output data

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

What does Input data do?

A

Instructions that input data from the input device into the microprocessor (e.g. what key was pressed)

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

What does output data do?

A

Microprocessor copies data from one of its internal registers to and output device (e.g. show what key has been pressed)

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

What does load data do?

A

Copy data from memory intro microprocessors registers

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

What does store data do?

A

Similar to load data but data is copied in to opposite direction. Data is saved from internal microprocessor registers into the memory

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

What does move data do?

A

Move data from one microprocessor register to another

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

Explain how instructions use the stack

A

Instructions get their operands from the stack and write their results back to the stack

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

What are some advantages of stack based architecture?

A

Program code takes little memory
- No need to specify the address of the operands in memory or registers
- Push is one exception because it needs to specify the operand

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

What are stack based processors better suited for? Postfix or infix?

A

Postfix, writing programs for stack-based architectures is not easy

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

What is infix notation

A

a+b

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

What is postfix notation?

A

ab+

17
Q

What is needed for an expression to be easy to implement in a stack-based architecture?

A

Convert it into postfix notation

18
Q

What is a specific to a general purpose register architecture?

A
  • The instructions read and writes to random access register file
  • the register file allows the access of any register in any order by specifying the register ID
19
Q

What is the main difference between stack based and general purpose register?

A
  • Repeatedly reading a register will produce the same result and will not modify the state of the register file (which it will in stack-based)
  • Programs can choose which values should be stored in the register file at any given time, allowing them to cache most accessed data (in stack, once the data has been used, it’s gone)
20
Q

What does a GPR (general purpose register) need to specify?

A
  • The register that hold their input operands
  • And the register that will hold the result

ADD r1, r2, r3

21
Q

What performance metric is the difference between GPR and stack-based?

A

GPR architectures have better performance but at the expense of needing more storage space for the programs

22
Q

What is the difference between programming GPR architecture processor compared to stack-based?

A

There are fewer restrictions on the order in which the operations can be executed
- On a stack-based, instructions should execute in the order that would leave the operands for the next instructions on the top of the stack
- On GPR, any order that place the operands for the next instruction in the register file BEFORE that instruction executes is valid
- Operations that access different registers can be reordered without making the program invalid.

23
Q

Compare Stack based and GPR architectures

A

Stack-based:
- Instructions take fewer bits to encode
- Reduced amount of memory taken up by programs
- Manages the use of register automatically
- Instruction set does not change if size of register file has changed
Still good for certain embedded systems
GPR:
With evolution of technology, the amount of space taken up by a program is less important
- Compilers for GPR achieve better performance with a given number of GPRs than those on stack-based architectures with same numbers of register. The compiler can choose which values to keep (Cache) in register file at any time
Used in modern computers

24
Q
A