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.
Table of Contents
How to use this article
- 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.
- If you get stuck, open the hint for that level. Just one.
- 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.
- 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:
| Address | Contents |
|---|---|
| 200 | 1B00 |
| 201 | 5B01 |
| 202 | 8204 |
| 203 | 5B01 |
| 204 | 2B02 |
| 205 | F000 |
| B00 | 0030 (red of the pixel) |
| B01 | 0005 (adjustment) |
| B02 | 0000 (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 V and 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 :
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) 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:
c) Column by column:
| Cycle | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| C | 0 | 1 | 1 | 0 | 1 | 0 |
| D | 1 | 0 | 0 | 1 | 1 | 0 |
| Equal? | No | No | No | No | Yes | Yes |
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:
| Cycle | Bit of C | Starts | Ends |
|---|---|---|---|
| 0 | 0 | 0 µs | 0.2 µs |
| 1 | 1 | 0.2 µs | 0.4 µs |
| 2 | 1 | 0.4 µs | 0.6 µs |
| 3 | 0 | 0.6 µs | 0.8 µs |
| 4 | 1 | 0.8 µs | 1.0 µs |
| 5 | 0 | 1.0 µs | 1.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:
| Phase | PC | MAR | MBR | IR | AC |
|---|---|---|---|---|---|
| Fetch 1 | 201 | 200 | 1B00 | 1B00 | — |
| Execute LOAD | 201 | B00 | 0030 | 1B00 | 0030 |
| Fetch 2 | 202 | 201 | 5B01 | 5B01 | 0030 |
| Execute ADD | 202 | B01 | 0005 | 5B01 | 0035 |
| Fetch 3 | 203 | 202 | 8204 | 8204 | 0035 |
| Execute JUMP | 204 | 202 | 8204 | 8204 | 0035 |
| Fetch 4 | 205 | 204 | 2B02 | 2B02 | 0035 |
| Execute STORE | 205 | B02 | 0035 | 2B02 | 0035 |
| Fetch 5 | 206 | 205 | F000 | F000 | 0035 |
Each row shows the registers at the end of the phase. These are the steps of fetch 1 and of the LOAD execution:
| Phase | Step | Here | Why |
|---|---|---|---|
| Fetch | MAR ← PC | MAR = 200 | Memory can only be reached through MAR, and the instruction is where PC points. |
| Fetch | MBR ← M[MAR] | MBR = 1B00 | Everything that comes out of memory goes into MBR. |
| Fetch | IR ← MBR | IR = 1B00 | The control unit decodes the instruction from IR. |
| Fetch | PC ← PC + 1 | PC = 201 | This leaves PC pointing at the next instruction. |
| Execute LOAD | MAR ← address in IR | MAR = B00 | Now memory is visited for the data, not for an instruction. |
| Execute LOAD | MBR ← M[MAR] | MBR = 0030 | The data also comes in through MBR. |
| Execute LOAD | AC ← MBR | AC = 0030 | LOAD 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:
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:
| Instruction | Fetch | Data access | Total |
|---|---|---|---|
| LOAD B00 | 1 | 1 (reads B00) | 2 |
| ADD B01 | 1 | 1 (reads B01) | 2 |
| JUMP 204 | 1 | 0 (only changes PC) | 1 |
| STORE B02 | 1 | 1 (writes to B02) | 2 |
| HALT | 1 | 0 | 1 |
| Total | 5 | 3 | 8 |
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:
| Sample | Brightness | Brightness / 64 | Level | Code |
|---|---|---|---|---|
| 0 | 30 | 0.47 | 0 | 00 |
| 1 | 70 | 1.09 | 1 | 01 |
| 2 | 140 | 2.19 | 2 | 10 |
| 3 | 210 | 3.28 | 3 | 11 |
| 4 | 250 | 3.91 | 3 | 11 |
| 5 | 180 | 2.81 | 2 | 10 |
| 6 | 90 | 1.41 | 1 | 01 |
| 7 | 20 | 0.31 | 0 | 00 |
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) 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.
| Band | Range | Read as | Voltages that fall here |
|---|---|---|---|
| Low | up to 0.8 V | 0 | 0.3 V |
| Forbidden zone | between 0.8 V and 2.0 V | no bit | 1.4 V |
| High | from 2.0 V | 1 | 2.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.
Which of these conditions is not part of the definition of a computer?
- Having a keyboard and a screen
- Processing data with arithmetic and logic operations
- Working under the control of a program stored in it
- 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.
About the Von Neumann architecture:
- Instructions and data are kept in the same memory.
- Each memory word carries a mark saying whether it is an instruction or data.
- Instructions run in sequence, unless a jump instruction breaks it.
- 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.
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.
Put the steps of fetching an instruction in order.
- IR ← MBR
- MBR ← M[MAR]
- MAR ← PC
- PC ← PC + 1
Solution
Correct order:
- MAR ← PC
- MBR ← M[MAR]
- IR ← MBR
- 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.)
What kind of computer is the Wi-Fi router at home?
- Embedded
- Personal
- Server
Solution
Answer: Embedded
The notes give the router precisely as an example of an embedded computer: designed for a specific function.
Which of these phone programs are system software?
- The operating system
- The camera sensor driver
- The gallery app
- 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.
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).
Which situation mainly exploits spatial locality?
- Going through the pixels of a row one after another
- Adding the same counter in every iteration
- 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.
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).
What kind of execution does the MIPS instruction sub $t2, $t0, $t1 have?
- Data processing
- Processor-memory
- Control
- Combination
Solution
Answer: Data processing
An arithmetic operation between registers: data processing. A subtraction with an operand in memory would be a combination.
A clock has a period of 0.5 ns. What is its frequency in GHz? (just the number)
Solution
Answer: 2
Hz = 2 GHz.
A clock runs at 4 MHz. How long is its period in nanoseconds? (just the number)
Solution
Answer: 250
s = 0.25 µs = 250 ns.
Complete the table: one bit per clock period. Write numbers only.
| Bit period | Frequency (MHz) | Bits sent | Total time (µs) |
|---|---|---|---|
| 1 µs | 12 | ||
| 0.25 µs | 8 | ||
| 0.1 µs | 50 |
Solution
| Bit period | Frequency (MHz) | Bits sent | Total time (µs) |
|---|---|---|---|
| 1 µs | 1 | 12 | 12 |
| 0.25 µs | 4 | 8 | 2 |
| 0.1 µs | 10 | 50 | 5 |
Frequency = 1 / period (µs ↔ MHz). Time = bits · period: 12 · 1 = 12; 8 · 0.25 = 2; 50 · 0.1 = 5.
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).
| Phase | PC | MAR | MBR | AC |
|---|---|---|---|---|
| Fetch 1 | — | |||
| Execute LOAD | 011 | |||
| Fetch 2 | 0021 | |||
| Execute ADD | 012 |
Solution
| Phase | PC | MAR | MBR | AC |
|---|---|---|---|---|
| Fetch 1 | 011 | 010 | 10C0 | — |
| Execute LOAD | 011 | 0C0 | 0021 | 0021 |
| Fetch 2 | 012 | 011 | 50C1 | 0021 |
| Execute ADD | 012 | 0C1 | 0004 | 0025 |
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).
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.
In digitisation, «assigning each sample a value from a finite set» is…
- Quantisation
- Sampling
- Coding
Solution
Answer: Quantisation
Sampling (taking samples), quantisation (rounding each to an allowed value) and coding (turning it into binary).
With V and V, write the logic value of each voltage: 0, 1 or X if it falls in the forbidden zone.
| Voltage | Value |
|---|---|
| 0.2 V | |
| 3.1 V | |
| 1.5 V | |
| 2.0 V |
Solution
| Voltage | Value |
|---|---|
| 0.2 V | 0 |
| 3.1 V | 1 |
| 1.5 V | X |
| 2.0 V | 1 |
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.
About pulses:
- A positive pulse starts with a rising edge.
- Rise time is measured between 10 % and 90 % of the amplitude.
- Pulse width is measured between the 10 % points.
- 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.
8 samples are taken and each one is coded with 2 bits (4 levels). How many bits does the signal take up?
- 16
- 8
- 32
- 4
Solution
Answer: 16
Total bits = samples · bits per sample = 8 · 2 = 16. With 2 bits you can tell levels apart.
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
- 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 instruction cycle and Von Neumann’s single memory are behind every step you take in QtSpim: review it in MIPS program structure and data and in MIPS load, arithmetic and logic.
- The jumps that break the sequence are the ones in MIPS subroutines:
jalandjr $rachange PC just like our JUMP. - And when you want to test yourself with the full practical exam, there is the IC1 practical mock exam, which marks itself when you hand it in.
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.
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: ; one bit per period.
I want to…
| I want to… | How | Example |
|---|---|---|
| Go from period to frequency | 250 ns → 4 MHz | |
| Go from frequency to period | 2.5 GHz → 0.4 ns | |
| Time to send N bits | N · bit period | 16 · 0.5 µs = 8 µs |
| Bits of a digitised signal | samples · bits per sample | 8 · 2 = 16 |
| Levels with n bits | 2 bits → 4 levels | |
| Memory accesses of a program | 1 per fetched instruction + 1 per data read or write | 5 + 3 = 8 |
| Decode a word of the example machine | first hex digit = code, the rest = address | 2B02 → STORE B02 |
Prefixes
| Period | Frequency |
|---|---|
| 1 ms | 1 kHz |
| 1 µs | 1 MHz |
| 1 ns | 1 GHz |
Trace template
| Phase | PC | MAR | MBR | IR | AC |
|---|---|---|---|---|---|
| Fetch | PC + 1 | old PC | M[old PC] | = MBR | same |
| Execute LOAD | same | address | M[address] | same | = MBR |
| Execute ADD / SUB | same | address | M[address] | same | AC ± MBR |
| Execute STORE | same | address | = AC | same | same |
| Execute JUMP | address | same | same | same | same |
Symptom / likely cause
| Symptom | Likely cause |
|---|---|
| The trace result looks like an address | You loaded the contents of MAR instead of MBR |
| After a jump one instruction is missing | You also incremented PC when executing the jump |
| A faster processor gets a longer period | You did not invert: |
| The timing diagram has one bit too many or too few | You drew changes mid-period or slipped a column |
| An intermediate voltage comes out as 0 or 1 | You rounded instead of saying «forbidden zone» |
| You get fewer bits than expected | You forgot to multiply by the bits per sample |
Before handing in, ask yourself
- Have I told at every step whether a value is an address or data?
- Do I increment PC only in fetch?
- Do my frequencies and periods go in opposite directions, with the prefix properly paired?
- Have I shown the working for every result, not just the final number?
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)


