comp arch Flashcards

1
Q

advantage and disadvantage of more data type

A

benefit is code is smaller and faster or more optimised.

disadvantage is this is more work for the microarchitect

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

advantages and disadvantages of complex instructions and data types

A

advantage: denser encoding -> smaller code size -> better memory footprint of instructions, saves off chip bandwidth, fewer cache misses
simpler compiler

disadvantages compiler has less opportunity to optimize. larger chunks of work. more complex hardware

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

what is the 5 stage pipeline

A

IF ID EX MEM WB

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

what isa does apple ues?

A

ARM except for on the watch OS

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

data path and control path in multi cycle and single cycle machines?

A

single cycle:
control signal are generated in the same clock cycle as the one during which the data signals are operated on.
everything related to an instruction happens in one clock cycle

multi cycle:
control cycles needed in the next cycle can be generated in the current cycle
latency of control processing can be overlapped with latency of datapath operation (more parallelism)

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

advantages and disadvantages of a multi clock cycle design

A

advanatges:
*higher clock freq as we are only limited by time of longest step in a stage
*simpler instructions take only a few clock cycles
* we can reuse expensive hardware across multiple cycles

disadv:
* hardware overhead for storing intermediate results in registers
*sequential logic overhead paid many times for each instruction

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

what is the motivation to go from single cycle to multi cycle?

A
  1. In a single-cycle processor, each instruction must complete within one cycle, which typically requires making the cycle long enough to accommodate the slowest instruction.
  2. resources can be shared. like ALU for address addition and ALU for add operation
  3. complex instructions possible as they don’t limit simple instructions
  4. Cycle Time Reduction: Multi-cycle processors break down the execution of an instruction into several shorter steps, each completing in one cycle.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are causes of pipeline stalls?

A

data dependence
control dependence

resource dependence/contention

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

how to handle resource contention?

A

duplicate the resources.

detect the pipeline stages that want resources and give to the one ahead so that the pipeline can keep moving

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

What optim can you do since reg operations are fast

A

since register operations are super fast you can do operation in front of the pipeline in the first half and do the operation behind in the second half

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

what are the types of data dependence

A
  1. flow dependence: a consumer instruction is reading a data a prior instruction has written to (ReadAfterWrite dependency)
    r3<-r1 or r2
    r5<- r3 or r4
    This is a true dependence as there is data flow
  2. Anti dependence : Write after read dependence (WAR). not a true dependence
    r3<- r1 op r2
    r1 <- r4 op r5
  3. output dependence: Write after Write (WAW dependence)
    r3<- r1 op r2
    — r5 <- r3 op r4
    r3 <- r6 op r7
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is interlocking?

A

detection of dependence between instructions in a pipelined processor to guarantee correct execution

you can do interlocking in software or hardware

MIPS - microprocessor without interlocking pipeline stages.

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

what is scoreboarding?

A

Scoreboarding:
Each register in register file has a valid bit associated with it.
An instruction that is writing to the register resets the valid bit
an instruction in the decode stage checks if its source and destination registers are valid

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

what are approaches to dependence detection?

A

scoreboarding and conbinational dependence check logic

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

what is combinational dependence check logic?

A

you compare at decode stage if the register you’re going to read or write is being written to by any of the stages ahead using comparator and then stall if there is a dependence

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

what is data forwarding?

A

if a value an instruction needs is not ready because it hasn’t been written by an incomplete instruction in the pipeline but it has been computed then it can be forwarded directly without waiting for writing into registers

17
Q

Reasons for pipeline stalls

A

Resource contention

Data/ Control dependence

Long latency operations

18
Q

when might it be difficult to do data forwarding?

A

if you have to forward data from MEM stage which is often the bottleneck this might increase cycle time and so you might not want to do that

19
Q

what is control dependence?

A

when you have branch or conditional jump and stuff you don’t know what the pc is for next instruction so you would have to stall

20
Q

how do you resolve control dependence?

A

branch prediction

21
Q

variable length execution due to multiplication with what inputs? what does this means about hardware vs software optimizations

A

if you’re multiplying by 0 you could be done super fast and only hardware knows this during runtime and can process this to benefit

22
Q

what is fine grained multithreading

A

you overlap stages from multiple threads to get faster processing as you can now get more flexibiility with stalls

23
Q

how does multi cycle execution stages affect pipelining

A

it results in wb for all instructions after the multistage execute to stall till multistage execute is complete

24
Q

how do you solve multicycle execute causing issues in pipelining?

A

you use

25
Q

if you have a multi cycle execute which is independent to instructions after it can you complete those instructions before multicycle execute finishes?

A

no as this violates von nuemann arch and also is a problem if you have an exception in the multi cycle instruction like say you have a divide by 0 error and you have to stop program, then the system expects the program to have end there and future instructions to not have executed.

hence you can’t do this. maybe the machine wants to do a try catch or maybe it will end program and expects a different state. S0 cannot violate von nuemann arch

26
Q

what are interrupts?

A

something which results in the program to stop or change. Like exceptions this becomes a reason why you can’t violate von nuemann and need reorder buffers

27
Q

what are reorder buffers?

A

after an instruction completes you write into a reorder buffer and you write to register (WB) only after an instruction before it has finished.

it is implemented as a circular queue

28
Q

how are WAR and WAW dependencies handled?

A

by renaming to reorder buffer register names

29
Q

why out of order execution and how?

A

so that independent instructions aren’t bothered by stalled prior instructions.

how is by creating a dataflow graph so that you execute when inputs are ready

30
Q

what changes in modern pipeline with out of order execution

A

reservation stations after IF and ID,

reorder buffer after EX,

if and id in order, ex out of order and wb in order after that

31
Q

what is superscalar execution?

A

you do IF, ID, EX, MEM, WB for N instructions to same cycle

32
Q

tag bits, index bits, bytes in block

A

8 bit address -> 2 3 3 split

3 bytes in block means 1 block has 8 bytes

3 index bits mean 8 blocks can be stored in cache

2 tag bits are matched with tag position in cache to check for hit or miss

33
Q

translation lookaside buffer

A

used to map virtual memory address to main memory address

34
Q
A