Introduction to computers — solved exercises with timing diagrams, a trace with a jump, a row of the photo in 2 bits and a practice quiz (and the 2.5 GHz I turned into 2.5 ns)

In the first practice test I did for IC1 there was a very easy question: «A processor runs at 2.5 GHz, what is its period?». I wrote 2.5 ns without thinking and moved on. When it was marked, the lecturer had circled the number with a note: «So a faster processor has a longer period?». It was 0.4 ns. Frequency and period are inverses: if one goes up, the other goes down. Since that day, every time I convert one into the other, I ask myself whether the number moved in the right direction.

These are the exercises for the first paper topic of IC1. You already have the theory (what a computer is, Von Neumann, the instruction cycle, signals and the clock) and the practice with three problems solved step by step. Now it is your turn, with the whiteboard photo as always: a timing diagram, a trace with a jump and a row of the photo digitised with 2 bits. After that, three worked answers with a hidden mistake, the full solutions, a practice quiz and the cheat sheet.

How to use this article

  1. Try each problem on paper, without a calculator (there is none in the exam), with the method from the practice: data, method, calculations in order and a check.
  2. If you get stuck, open the hint for that level. Just one.
  3. Before looking at the solutions, do «What’s wrong here?»: spotting the mistake in someone else’s working is exactly what helps you not make it.
  4. Compare your working with the solution step by step, not just the final result, and finish with the quiz.

Level 1: the clock and two signals

The phone sends the smartwatch two signals at the same time, in positive logic and with one bit per clock period. The bit period is 0.2 µs. The signals are C = 011010 and D = 100110.

I am asking for:

  • a) The clock frequency, in MHz.
  • b) The timing diagram of the clock, C and D.
  • c) The cycles (counting from 0) in which C and D have the same value.
  • d) How long it takes to send the 6 bits.

Expected result (to check yours):

a) 5 MHz
c) cycles 4 and 5
d) 1.2 µs

0.2 µs is a fifth of a microsecond, so the frequency is 5 times 1 MHz. For the timing diagram, draw the 6 clock columns first and write each signal’s bit inside its column.

Level 2: a trace with a jump

A machine like the one in the theory (16-bit words: 4 bits of code and 12 of address; codes 1 LOAD, 2 STORE, 5 ADD, 8 JUMP and F HALT) applies a colour filter to a pixel. Memory holds:

AddressContents
2001B00
2015B01
2028204
2035B01
2042B02
205F000
B000030 (red of the pixel)
B010005 (adjustment)
B020000 (result)

PC starts at 200. I am asking for:

  • a) What each instruction does.
  • b) The trace: PC, MAR, MBR, IR and AC at the end of each phase.
  • c) The final value of B02, in hexadecimal and in decimal.
  • d) The number of memory accesses.

Expected result:

c) B02 = 0035 (53)
d) 8 accesses

A JUMP only changes PC in its execute phase. Ask yourself what PC is right after executing it and which instruction is fetched next. Is the one at 203 ever fetched?

Level 3 (challenge): a row of the photo in 2 bits

This time the photo is in greyscale with 2 bits per sample: brightness (from 0 to 255) is quantised into 4 levels in steps of 64 (0-63 → 00, 64-127 → 01, 128-191 → 10, 192-255 → 11). 8 brightness samples are taken along a row: 30, 70, 140, 210, 250, 180, 90, 20.

  • a) The code of each sample and the full bit sequence.
  • b) How many bits the row takes up.
  • c) If each bit is sent in 0.5 µs, the clock frequency and the sending time.
  • d) The cable uses VL(max)=0.8 V_{L(max)} = 0.8 V and VH(min)=2.0 V_{H(min)} = 2.0 V. When measured, these voltages arrive: 0.3 V, 2.7 V, 1.4 V and 3.1 V. Which bit is each one?

Expected result:

a) 00 01 10 11 11 10 01 00 -> 0001101111100100
b) 16 bits
c) 2 MHz, 8 µs
d) 0, 1, none (forbidden zone), 1

To quantise, divide each brightness by 64 and keep the whole part: 140 / 64 = 2.18… → level 2 → 10. And for d), draw the three bands before placing each voltage.

What’s wrong here?

Three classmates’ answers with one mistake each. Try to find it before reading the explanation.

Fragment 1: the jump that overshot

A classmate did the execution of the JUMP from level 2 like this:

Execute JUMP 204:   PC ← 204
                    PC ← PC + 1 = 205
Next fetch:         MAR ← 205, IR ← F000 (HALT)
Result: B02 = 0000

What’s wrong? They incremented PC during execute. The increment belongs to fetch (it was already done when the JUMP was fetched, that is why PC was 203). The JUMP only sets PC ← 204. By adding one again, the next instruction is HALT, the STORE never runs and the result stays at 0000.

Adding 1 to PC after a jump. Fetch increments; executing a jump replaces. If you also add when jumping, you skip the target instruction.

Fixed: after the JUMP, PC = 204; the STORE is fetched (PC moves to 205), 0035 is written to B02 and then HALT is fetched.

Fragment 2: the faster processor with the longer period

2.5 GHz processor  ->  T = 2.5 ns
5 GHz processor    ->  T = 5 ns

What’s wrong? They did not invert. The 5 GHz processor, which is twice as fast, ends up with twice the period, and that makes no sense. The right thing is T=1/f T = 1/f :

T=12.5⋅109 s=0.4 nsT=15⋅109 s=0.2 ns T = \frac{1}{2.5 \cdot 10^{9}}\ s = 0.4\ \text{ns} \qquad T = \frac{1}{5 \cdot 10^{9}}\ s = 0.2\ \text{ns}

Check the direction. More frequency = shorter period. If both numbers go up together, you forgot to invert.

Fragment 3: the voltage that «looks like» a 0

Levels: V_L(max) = 0.8 V, V_H(min) = 2.0 V
Measured voltage: 1.1 V  ->  bit 0 (it is closer to 0.8 than to 2.0)

What’s wrong? They rounded. 1.1 V is between 0.8 and 2.0, in the forbidden zone: it is neither 0 nor 1. A real circuit may read it either way (or differently each time), and that is why designs make sure they never stay there.

Treating logic levels as values with a midpoint. They are ranges separated by a forbidden band.

Solutions

Level 1

Before any calculation: all four parts hang from a single piece of data, 0.2 µs. Since one bit is sent per clock period, the bit period and the clock period are the same, T = 0.2 µs. Part a) is turning T upside down, b) is drawing 6 columns T wide, c) is reading them one by one and d) is counting how many T the transmission lasts.

a) f=1/T=1/(0.2⋅10−6 s)=5⋅106 f = 1/T = 1/(0.2 \cdot 10^{-6}\ s) = 5 \cdot 10^{6} Hz = 5 MHz. Check: 0.2 µs fits 5 times into 1 µs, and 1 µs is 1 MHz.

b) Six clock periods and, underneath, each bit in its column:

Level 1: timing diagram of C and DClock, C = 011010 and D = 100110; shaded, cycles 4 and 5, where they are equal.clockC011010D100110period
C and D only match in cycles 4 and 5 (counting from 0).

c) Column by column:

Cycle012345
C011010
D100110
Equal?NoNoNoNoYesYes

They match in cycles 4 and 5 (in 4 both are 1; in 5, both are 0).

d) 6 bits · 0.2 µs = 1.2 µs.

Why you multiply: the bits go one after another, with no gaps, and each one takes exactly one period. Cycle by cycle, with signal C:

CycleBit of CStartsEnds
000 µs0.2 µs
110.2 µs0.4 µs
210.4 µs0.6 µs
300.6 µs0.8 µs
410.8 µs1.0 µs
501.0 µs1.2 µs

The last bit ends at 1.2 µs, and that is the transmission time.

Counting 5 periods because the last cycle is called «5». The cycles go from 0 to 5, which is 6 cycles. 5 · 0.2 µs = 1.0 µs is the moment the last bit starts, not the moment the transmission ends.

Why it is done this way: writing the bit inside each column avoids the most common timing-diagram mistake, which is slipping by one column. And the table in part c) turns the drawing into something you can check row by row.

Level 2

a) 1B00 LOAD B00 (AC ← red), 5B01 ADD B01 (AC ← AC + adjustment), 8204 JUMP 204, 5B01 ADD B01 (never executed), 2B02 STORE B02, F000 HALT.

How to read each word: 16 bits are 4 hexadecimal digits. The first digit is the code (4 bits) and the next three are the address (12 bits): 1B00 splits into 1 | B00, and code 1 is LOAD. Decode the whole program before the trace, not on the fly: halfway through the trace it is easy to read 5B01 as a number instead of as «ADD B01», and the mistake drags into every row after it.

b) The trace:

PhasePCMARMBRIRAC
Fetch 12012001B001B00—
Execute LOAD201B0000301B000030
Fetch 22022015B015B010030
Execute ADD202B0100055B010035
Fetch 3203202820482040035
Execute JUMP204202820482040035
Fetch 42052042B022B020035
Execute STORE205B0200352B020035
Fetch 5206205F000F0000035

Each row shows the registers at the end of the phase. These are the steps of fetch 1 and of the LOAD execution:

PhaseStepHereWhy
FetchMAR ← PCMAR = 200Memory can only be reached through MAR, and the instruction is where PC points.
FetchMBR ← M[MAR]MBR = 1B00Everything that comes out of memory goes into MBR.
FetchIR ← MBRIR = 1B00The control unit decodes the instruction from IR.
FetchPC ← PC + 1PC = 201This leaves PC pointing at the next instruction.
Execute LOADMAR ← address in IRMAR = B00Now memory is visited for the data, not for an instruction.
Execute LOADMBR ← M[MAR]MBR = 0030The data also comes in through MBR.
Execute LOADAC ← MBRAC = 0030LOAD just copies the data into the accumulator.

That is why the «Fetch 1» row already has PC = 201 even though the instruction is at 200: the increment is part of the fetch. And executing the JUMP is a single step, PC ← 204, without touching MAR or MBR.

When executing the JUMP, MAR and MBR do not change: there is no trip to memory. Only PC changes. The diagram sums it up:

A jump breaks the sequenceLevel 2 program: JUMP 204 changes the PC and the instruction at 203 is never fetched.2001B00LOAD B0012015B01ADD B0122028204JUMP 20432035B01ADD B01never fetched2042B02STORE B024205F000HALT5PC ← 204execution order
Five instructions executed out of six written: the jump only changes the PC.

c) B02 = 0035 = 3 · 16 + 5 = 53. Check: 48 + 5 = 53 (without the jump, the adjustment would have been added again: 58).

d) 5 fetches + 3 data accesses (LOAD, ADD, STORE) = 8 accesses.

The obvious path is to count two accesses per instruction, but not all of them go for data:

InstructionFetchData accessTotal
LOAD B0011 (reads B00)2
ADD B0111 (reads B01)2
JUMP 20410 (only changes PC)1
STORE B0211 (writes to B02)2
HALT101
Total538

Also counting the ADD at 203. It is in memory, but it is never fetched: the JUMP takes PC from 203 to 204. If you get 10 accesses, you have counted it (1 fetch + 1 data).

I checked it by running the program through the toy machine from the theory (run once):

fetch      PC=201  MAR=200  MBR=1B00  IR=1B00  -> LOAD B00
execute    MAR=B00  MBR=0030  AC=0030  PC=201
fetch      PC=202  MAR=201  MBR=5B01  IR=5B01  -> ADD B01
execute    MAR=B01  MBR=0005  AC=0035  PC=202
fetch      PC=203  MAR=202  MBR=8204  IR=8204  -> JUMP 204
execute    MAR=202  MBR=8204  AC=0035  PC=204
fetch      PC=205  MAR=204  MBR=2B02  IR=2B02  -> STORE B02
execute    MAR=B02  MBR=0035  AC=0035  PC=205
fetch      PC=206  MAR=205  MBR=F000  IR=F000  -> HALT 000
execute    HALT: the CPU stops

Result at B02: 0035 = 53
Memory accesses: 8 (one per fetch and one per LOAD, ADD or STORE; JUMP and HALT touch no data)

Why it is done this way: in the JUMP row, MAR and MBR are copied from the previous row because they do not change; if you leave them blank, whoever marks it does not know whether you forgot them.

Level 3

a) Each brightness divided by 64, whole part, and that level in 2 bits:

SampleBrightnessBrightness / 64LevelCode
0300.47000
1701.09101
21402.19210
32103.28311
42503.91311
51802.81210
6901.41101
7200.31000

Sequence: 0001101111100100.

The sequence is the codes stuck together in sample order: 00 | 01 | 10 | 11 | 11 | 10 | 01 | 00. Count the digits before moving on: there must be 16, which is part b). If you get an odd number, you have dropped a leading 0 (0 instead of 00, or 1 instead of 01).

b) 8 samples · 2 bits = 16 bits.

c) f=1/(0.5⋅10−6 s)=2⋅106 f = 1/(0.5 \cdot 10^{-6}\ s) = 2 \cdot 10^{6} Hz = 2 MHz; time = 16 · 0.5 µs = 8 µs.

d) 0.3 V → 0 (below 0.8); 2.7 V → 1 (above 2.0); 1.4 V → none, forbidden zone; 3.1 V → 1.

The obvious path, checking which value each voltage looks closest to, is exactly the mistake in fragment 3. Draw the three bands first and then place each voltage.

BandRangeRead asVoltages that fall here
Lowup to 0.8 V00.3 V
Forbidden zonebetween 0.8 V and 2.0 Vno bit1.4 V
Highfrom 2.0 V12.7 V and 3.1 V

3.1 V is not left out for being «too high»: the statement only gives the minimum for a 1 (2.0 V), and everything above it reads as 1.

Why it is done this way: dividing by 64 is the way not to pick the wrong band (with 4 levels in 256 values, each band is 256 / 4 = 64 wide). Notice that 210 and 250 give the same code: quantising loses information, and that is why the photo looks better with more bits.

I checked the arithmetic of the three levels with a Python script, run once:

== Practice, problem 2
f = 4000000 Hz
8 bits: 2 µs
3 MB photo: 24000000 bits -> 6.0 s
CPU 2.4 GHz -> T = 0.4166666666666667 ns
A     : ‾‾‾‾____‾‾‾‾‾‾‾‾________‾‾‾‾____
B     : ____‾‾‾‾‾‾‾‾________‾‾‾‾‾‾‾‾____
cycles with A = B = 1: [2, 6]
rising edges A: 3  B: 2

== Exercises, level 1
f = 5000000 Hz;  6 bits: 6/5 µs
C     : ____‾‾‾‾‾‾‾‾____‾‾‾‾____
D     : ‾‾‾‾________‾‾‾‾‾‾‾‾____
cycles where C and D are equal: [4, 5]

== Exercises, level 3
codes: 00 01 10 11 11 10 01 00 -> 0001101111100100 16 bits
f = 2000000 Hz;  16 bits: 8 µs
0.3 V -> 0
2.7 V -> 1
1.4 V -> not allowed
3.1 V -> 1
0.8 V -> 0
2.0 V -> 1

Practice quiz

Twenty questions to review the whole topic: definitions, components, the instruction cycle, the hierarchy, buses, digitisation, logic levels and the clock. It does not count for anything (the IC1 exam is written, not multiple choice): it helps you see what you have clear and what you do not. You can repeat it as many times as you like; every answer comes with its explanation.

Question 1Single choice

Which of these conditions is not part of the definition of a computer?

  1. Having a keyboard and a screen
  2. Processing data with arithmetic and logic operations
  3. Working under the control of a program stored in it
  4. Delivering the result through an output medium
Solution

Answer: Having a keyboard and a screen

The definition asks for accepting data, processing it and delivering a result, autonomously and under the control of a stored program. Keyboard and screen are just specific I/O devices.

Question 2True or false

About the Von Neumann architecture:

  1. Instructions and data are kept in the same memory.
  2. Each memory word carries a mark saying whether it is an instruction or data.
  3. Instructions run in sequence, unless a jump instruction breaks it.
  4. Partial results are kept in a memory separate from the program’s.
Solution
  • T — Instructions and data are kept in the same memory.
  • F — Each memory word carries a mark saying whether it is an instruction or data.
  • T — Instructions run in sequence, unless a jump instruction breaks it.
  • F — Partial results are kept in a memory separate from the program’s.

A single linear binary memory with no explicit distinction between instructions and data (partial and final results go there too). Sequential execution with the possibility of jumping.

Question 3Match

Match each register with what it holds.

PC
IR
MAR
MBR

Definitions:

  • The result of the last comparison
  • The instruction being executed
  • The address of the next instruction
  • The data coming from memory or going to it
  • The address to be read or written
Solution
  • PC → The address of the next instruction
  • IR → The instruction being executed
  • MAR → The address to be read or written
  • MBR → The data coming from memory or going to it

PC and IR control what runs; MAR and MBR are the CPU’s door to memory: MAR = where, MBR = what.

Question 4Order

Put the steps of fetching an instruction in order.

  1. IR ← MBR
  2. MBR ← M[MAR]
  3. MAR ← PC
  4. PC ← PC + 1
Solution

Correct order:

  1. MAR ← PC
  2. MBR ← M[MAR]
  3. IR ← MBR
  4. PC ← PC + 1

First the address PC points to is requested, memory answers in MBR, the instruction moves to IR and PC gets ready for the next one. (The PC increment can happen at the same time as the read; what matters is that it happens before execute.)

Question 5Single choice

What kind of computer is the Wi-Fi router at home?

  1. Embedded
  2. Personal
  3. Server
Solution

Answer: Embedded

The notes give the router precisely as an example of an embedded computer: designed for a specific function.

Question 6Multiple · wrong ticks subtract

Which of these phone programs are system software?

  1. The operating system
  2. The camera sensor driver
  3. The gallery app
  4. A C compiler
Solution

Answer: The operating system · The camera sensor driver

System software = programs essential for the hardware plus utilities to use it. Gallery: user. Compiler: developer.

Question 7Fill in the gaps

Complete the memory hierarchy, from fastest to slowest.

____, then the ____, then ____ memory and, at the end, ____ memory.

Words:

  • main
  • Registers
  • cache
  • internal
  • virtual
  • secondary
Solution

Registers, then the cache, then main memory and, at the end, secondary memory.

At the top, the fastest, dearest and smallest (registers, inside the CPU); at the bottom, the slowest, cheapest and biggest (disks and flash memory).

Question 8Single choice

Which situation mainly exploits spatial locality?

  1. Going through the pixels of a row one after another
  2. Adding the same counter in every iteration
  3. Reading a single isolated item from the gallery once
Solution

Answer: Going through the pixels of a row one after another

Spatial locality: after using some data, nearby data is used soon. Temporal: the same data is used again soon.

Question 9Match

Match each group of bus lines with what it carries.

Address lines
Data lines
Control lines

Definitions:

  • What to do and when: read, write, clock
  • What: the data or the instruction
  • The battery voltage
  • Where: which position is to be read or written
Solution
  • Address lines → Where: which position is to be read or written
  • Data lines → What: the data or the instruction
  • Control lines → What to do and when: read, write, clock

A bus is a set of conductors; its three groups are address, data and control (one slide of the notes says «memory»: it is a typo).

Question 10Single choice

What kind of execution does the MIPS instruction sub $t2, $t0, $t1 have?

  1. Data processing
  2. Processor-memory
  3. Control
  4. Combination
Solution

Answer: Data processing

An arithmetic operation between registers: data processing. A subtraction with an operand in memory would be a combination.

Question 11Short answer

A clock has a period of 0.5 ns. What is its frequency in GHz? (just the number)

Solution

Answer: 2

f=1/T=1/(0.5⋅10−9)=2⋅109 f = 1/T = 1/(0.5 \cdot 10^{-9}) = 2 \cdot 10^{9} Hz = 2 GHz.

Question 12Short answer

A clock runs at 4 MHz. How long is its period in nanoseconds? (just the number)

Solution

Answer: 250

T=1/(4⋅106)=0.25⋅10−6 T = 1/(4 \cdot 10^{6}) = 0.25 \cdot 10^{-6} s = 0.25 µs = 250 ns.

Question 13Calculation

Complete the table: one bit per clock period. Write numbers only.

Bit periodFrequency (MHz)Bits sentTotal time (µs)
1 µs12
0.25 µs8
0.1 µs50
Solution
Bit periodFrequency (MHz)Bits sentTotal time (µs)
1 µs11212
0.25 µs482
0.1 µs10505

Frequency = 1 / period (µs ↔ MHz). Time = bits · period: 12 · 1 = 12; 8 · 0.25 = 2; 50 · 0.1 = 5.

Question 14Calculation

Trace: address 010 holds 10C0 (LOAD 0C0) and 011 holds 50C1 (ADD 0C1). 0C0 holds 0021 and 0C1, 0004. PC starts at 010. Fill in the value at the end of each phase (in hexadecimal, with the same number of digits as in the statement).

PhasePCMARMBRAC
Fetch 1—
Execute LOAD011
Fetch 20021
Execute ADD012
Solution
PhasePCMARMBRAC
Fetch 101101010C0—
Execute LOAD0110C000210021
Fetch 201201150C10021
Execute ADD0120C100040025

In fetch, MAR takes PC and PC goes up by one. In execute, MAR takes the operand address (low part of IR) and MBR, the data. 0021 + 0004 = 0025 (33 + 4 = 37).

Question 15Short answer

A program executes LOAD 0A0, JUMP 0F0 and, at 0F0, HALT. How many memory accesses does it make in total? (just the number)

Solution

Answer: 4

Three fetches (one per instruction) and one data access (the LOAD). The jump and HALT neither read nor write data: 3 + 1 = 4.

Question 16Single choice

In digitisation, «assigning each sample a value from a finite set» is…

  1. Quantisation
  2. Sampling
  3. Coding
Solution

Answer: Quantisation

Sampling (taking samples), quantisation (rounding each to an allowed value) and coding (turning it into binary).

Question 17Calculation

With VL(max)=0.8 V_{L(max)} = 0.8 V and VH(min)=2.0 V_{H(min)} = 2.0 V, write the logic value of each voltage: 0, 1 or X if it falls in the forbidden zone.

VoltageValue
0.2 V
3.1 V
1.5 V
2.0 V
Solution
VoltageValue
0.2 V0
3.1 V1
1.5 VX
2.0 V1

Up to 0.8 V is the low level (0); from 2.0 V, the high level (1); in between, the forbidden zone. 2.0 V exactly is the minimum of the high level.

Question 18True or false

About pulses:

  1. A positive pulse starts with a rising edge.
  2. Rise time is measured between 10 % and 90 % of the amplitude.
  3. Pulse width is measured between the 10 % points.
  4. A non-periodic pulse train has a fixed frequency.
Solution
  • T — A positive pulse starts with a rising edge.
  • T — Rise time is measured between 10 % and 90 % of the amplitude.
  • F — Pulse width is measured between the 10 % points.
  • F — A non-periodic pulse train has a fixed frequency.

Width is measured between the two 50 % points. Only periodic trains have a fixed period and frequency.

Question 19Single choice

8 samples are taken and each one is coded with 2 bits (4 levels). How many bits does the signal take up?

  1. 16
  2. 8
  3. 32
  4. 4
Solution

Answer: 16

Total bits = samples · bits per sample = 8 · 2 = 16. With 2 bits you can tell 22=4 2^2 = 4 levels apart.

Question 20Fill in the gaps

The hello world going down floors.

Python, Java and C all end up asking the operating system for the ____ call; in MIPS it is requested with ____, and in memory each instruction is a ____-bit word.

Words:

  • jump
  • syscall
  • write
  • print
  • 16
  • 32
Solution

Python, Java and C all end up asking the operating system for the write call; in MIPS it is requested with syscall, and in memory each instruction is a 32-bit word.

We checked it with strace: the three languages end in write(1, …). In MIPS, the system call is syscall and each instruction takes 32 bits (for example, 0x24020004).

What next?

This topic is the base for all of IC1. If you want to see these ideas at work:

The next paper topic is number systems: binary, octal and hexadecimal, with the colours of a photo, so you can read addresses and data like the ones we have used here at a glance.

IC1 exam coming up?The theory and MIPS packs with new solved exams, their cheat sheets, blank exams and .s solutions, for free.See the pack

Cheat sheet: introduction to computers

The essentials in 30 seconds

  • Computer: input → processing → output, under the control of a stored program.
  • Von Neumann: a single memory with instructions and data, sequential execution and jumps.
  • 5 components: control unit + datapath (CPU), memory, input and output.
  • Hierarchy: registers → cache → main → secondary. It works because of locality.
  • Bus: address (where), data (what) and control (what to do and when).
  • Fetch: MAR ← PC, MBR ← M[MAR], IR ← MBR, PC ← PC + 1.
  • Digitise: sampling, quantisation and coding.
  • Clock: f=1/T f = 1/T ; one bit per period.

I want to…

I want to…HowExample
Go from period to frequencyf=1/T f = 1/T 250 ns → 4 MHz
Go from frequency to periodT=1/f T = 1/f 2.5 GHz → 0.4 ns
Time to send N bitsN · bit period16 · 0.5 µs = 8 µs
Bits of a digitised signalsamples · bits per sample8 · 2 = 16
Levels with n bits2n 2^n 2 bits → 4 levels
Memory accesses of a program1 per fetched instruction + 1 per data read or write5 + 3 = 8
Decode a word of the example machinefirst hex digit = code, the rest = address2B02 → STORE B02

Prefixes

PeriodFrequency
1 ms1 kHz
1 µs1 MHz
1 ns1 GHz

Trace template

PhasePCMARMBRIRAC
FetchPC + 1old PCM[old PC]= MBRsame
Execute LOADsameaddressM[address]same= MBR
Execute ADD / SUBsameaddressM[address]sameAC ± MBR
Execute STOREsameaddress= ACsamesame
Execute JUMPaddresssamesamesamesame

Symptom / likely cause

SymptomLikely cause
The trace result looks like an addressYou loaded the contents of MAR instead of MBR
After a jump one instruction is missingYou also incremented PC when executing the jump
A faster processor gets a longer periodYou did not invert: T=1/f T = 1/f
The timing diagram has one bit too many or too fewYou drew changes mid-period or slipped a column
An intermediate voltage comes out as 0 or 1You rounded instead of saying «forbidden zone»
You get fewer bits than expectedYou forgot to multiply by the bits per sample

Before handing in, ask yourself

  1. Have I told at every step whether a value is an address or data?
  2. Do I increment PC only in fetch?
  3. Do my frequencies and periods go in opposite directions, with the prefix properly paired?
  4. Have I shown the working for every result, not just the final number?
Keep goingAll Computers articles

Did this article help you? Here is how you can support SergioLearns →

Ready for the exam?IC1 practical mock exam — MIPS in QtSpim with other data, subroutines and keyboard input (and why part 1 decides almost everything)