Systems Architecture Flashcards

1
Q

Does ARM assembly support a RISC or CISC instruction set?

A

RISC

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

What is the purpose of the CPSR?

A

To record anomalous arithmetic outputs

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

What are the flags for the CPSR?

A

N bit for negatives
Z bit for zero results
C bit for a carry
V bit for negatives

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

Which registers can the programmers us?

A

R0-R7

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

Which register should contain the output of a function?

A

R0

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

What is an unaligned transfer?

A

Reading 4 bytes across more than one 4 byte region

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

What does the stack store?

A

Variables and function arguments

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

What does the heap store?

A

Data allocation during runtime

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

What does the global data area store?

A

Global variables

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

What does BSS store?

A

Uninitliased global variables

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

What does the text segment store?

A

Machine code instructions

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

Define pipelining

A

A method to improve efficiency where multiple fetch-decode-execute cycles are run at the same time with each using a different component

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

Define program relative addressing

A

An addressing mode where an isntruction specifies an address relative to the current program counter

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

What is the effective address?

A

The PC + an offset

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

What does a compare instruction do?

A

Updates and evaluates the value of the bits in the CPSR and then discards them

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

What should we always ensure when returning from a function?

A

LEAVE NO TRACE

17
Q

What is the first convention for writing good functions?

A

We should only use r0-r3 to pass parameters to functions

18
Q

What do you do if you have more than 4 parameters to pass to a function?

A

Allocate memory from the heap to a pointer and then store those pointers in r0-r3

19
Q

What does the link register store?

A

The return address

20
Q

What should we do to the stack pointer when we call a function to ensure we have enough memory?

A

Decrement the value of the stack pointer so that the stack grows into the unused memory space

21
Q

What is the second convention for writing good functions?

A

We must preserve the contents of registers

22
Q

What does it mean to preserve registers?

A

Registers must be restored after a procedure call and if we avoid using these regsiters than we avoid register spilling

23
Q

What is register spilling?

A

The contents of registers spilling into main memory

24
Q

What is the third convention for writing good functions?

A

Push contents of registers to the stack before your function and pop them afterwards to restore them

25
Q

How do we ensure that assembly instructions stay in place during compilation?

A

Compiling with no optimisation

26
Q

Which command allows inline assembly and for assembly code to be embedded into c?

27
Q

What is a clobbered register?

A

A CPU register that is overwritten by the assembly code but not used as an explicit output operand in the GCC inline assembly syntax

28
Q

Why are clobbered register important?

A

We need to explicitly tell the compiler that the contents of the register has changed otherwise it may assume the value remains the same and use it as such

29
Q

What does the preprocessor do?

A

Deal with macros such as directives and replaces macros throughout the program
Outputs what is known as pure C code

30
Q

What does the compiler do?

A

Transforms C into assembly code
Dependent on machine architecture

31
Q

What does the assembler do?

A

Outputs machine code

32
Q

What does the linker do?

A

Combines several object files together

33
Q

What is the difference between dynamic and static linking?

A

Static linking embeds the additional functions into your program where as dynamic linking links your program with the file containing the other functions whilst keeping the two files separate

34
Q

What is an exception?

A

Any unexpected change in the flow control

35
Q

What is a synchronous exception?

A

Caused by an instruction in the running program and includes things like arithmetic exceptions, invalid memory addresses

36
Q

What is an asynchronous exception?

A

Caused by an IO device requesting the CPU and is known as a hardware interrupt

37
Q

What does the CPU do when it receives an interrupt?

A

It will create an exception interrupt which is a special function called by the CPU. It will save the current state of the CPU and then change the code execution to the exception handler to deal with the interrupt. It does this by using a vector table that contains a branch instruction to the exception handler