Lite / Engineering Complex Systems / Term 3 worksheet
Worksheet: Engineering Complex Systems, term 3
Name: Date:
Week 19: From a wave to a list of numbers
1. Which signal is discrete in time but NOT quantised?
- A microphone voltage on a wire
- A list of exact real-number samples held in a spreadsheet
- The 12-bit codes from an ADC
- A thermometer's mercury height
2. A signal is sampled at fs = 1 kHz from t = 0. At what time, in seconds, is sample x[250] taken?
Answer: s
3. x(t) = 3·cos(2π·2·t) is sampled at fs = 12 Hz, so x[n] = x(n/12). Find x[5] (to 2 decimal places).
Answer:
4. What is the energy E = Σ x[n]² of the sequence x = [2, −3, 1, 0, 1]?
Answer:
5. Code computes x[n] = sin(2π·5·n) for n = 0, 1, 2… and every value is (almost) zero. What went wrong?
- sin is broken for whole numbers
- It used n where it needed t = n/fs, so it sampled once per second, exactly on whole cycles of a 5 Hz wave
- The amplitude is too small
- It needs more samples
6. A voltage is v(t) = 3 + 5·sin(2π·100·t) volts. What is its RMS value, in volts (to 2 decimal places)?
Answer: V
Week 19: Amplitude, frequency, phase
1. Which property of a sinusoid does the phase φ change?
- How tall it is
- How many cycles per second it makes
- Where in its cycle it is at t = 0
- Its average power
2. A motor shaft vibrates at f = 25 Hz. What is its angular frequency ω, in rad/s (to 1 decimal place)?
Answer: rad/s
3. UK mains is 230 V RMS. What is its peak voltage, in volts (nearest volt)?
Answer: V
4. A signal is x(t) = 1 + 6·sin(2π·440·t). What is its average power (mean of x², as for a 1 Ω load)?
Answer:
5. 3·sin(2π·5t) + 4·cos(2π·5t) is…
- A sinusoid at 5 Hz with amplitude 5
- A sinusoid at 10 Hz
- Not a sinusoid at all
- A sinusoid at 5 Hz with amplitude 7
Week 19: Rounding to the nearest step
1. An ideal 10-bit ADC spans 0 to 3.3 V. What is its step Δ, in millivolts (to 2 decimal places)?
Answer: mV
2. Adding one bit to an ideal ADC…
- Halves Δ and adds about 6 dB of SNR
- Halves Δ and doubles the SNR in dB
- Adds 1 dB
- Only matters for slow signals
3. Using SNR ≈ 6.02·N + 1.76 dB, what is the best signal-to-quantisation-noise ratio of an ideal 10-bit ADC for a full-scale sine wave, in dB?
Answer: dB
4. A full-scale sine on an ideal 12-bit ADC gives 74 dB SNR. The same ADC sees a sine at one tenth of full scale. About what SNR, in dB?
Answer: dB
5. When does 'quantisation error behaves like even, random noise' break down?
- For a loud, busy music signal
- For a very slow signal that changes by less than one step
- Never
- When N is large
Week 20: How fast is fast enough?
1. An audio system samples at 48 kHz. What is its Nyquist frequency, in kHz?
Answer: kHz
2. A signal's highest frequency is 300 Hz. Which sample rate is the smallest of these that works?
- 300 Hz
- 600 Hz
- 601 Hz
- 450 Hz
3. A 330 Hz sinusoid is sampled at fs = 250 Hz. At what frequency (between 0 and fs/2) does it appear in the samples, in hertz?
Answer: Hz
4. A 20 Hz sinusoid is sampled at exactly 20 Hz. What do the samples show?
- A 20 Hz wave
- A 10 Hz wave
- A constant: every sample lands at the same point of the cycle
- Random values
5. A control loop's fastest dynamics are at 8 Hz and the rule of thumb is to sample 20 times faster. What sample rate, in Hz?
Answer: Hz
Week 20: Predicting the impostor
1. A 900 Hz whistle is sampled at 1 kHz. What alias frequency, in Hz, appears?
Answer: Hz
2. Sampled at fs = 100 Hz, which frequency gives exactly the same samples as a 20 Hz cosine?
- 40 Hz
- 80 Hz
- 120 Hz
- Both 80 Hz and 120 Hz
3. A 330 Hz sinusoid is sampled at fs = 250 Hz. At what frequency (between 0 and fs/2) does it appear in the samples, in hertz?
Answer: Hz
4. A wheel turns 23 times a second and is filmed at 24 frames per second. How many times per second does it appear to turn (use a negative number for backwards)?
Answer: rev/s
5. A 1730 Hz tone is sampled at 500 Hz. What alias, in Hz?
Answer: Hz
Week 20: Stopping aliases before they start
1. An RC low-pass has R = 1.6 kΩ and C = 100 nF. What is fc = 1/(2πRC), in Hz (nearest 5 Hz)?
Answer: Hz
2. Why can't a digital filter after the ADC remove aliases?
- Digital filters are too slow
- After sampling, an alias is indistinguishable from a real signal at that frequency
- Digital filters only work on audio
- It can, if it has enough taps
3. A first-order RC low-pass has fc = 2 kHz. Using |H| = 1/√(1 + (f/fc)²), what is its gain at 20 kHz (3 decimal places)?
Answer:
4. Why does oversampling make the analog anti-aliasing filter easier to design?
- It increases the number of bits
- It pushes fs/2 far above the wanted band, so a gentle roll-off has room to work
- It removes all noise
- It lets you skip the filter entirely
5. A 1210 Hz sinusoid is sampled at fs = 1000 Hz. At what frequency (between 0 and fs/2) does it appear in the samples, in hertz?
Answer: Hz
Week 21: Seeing a signal's ingredients
1. You change only the phase of one component. What changes?
- The height of its spectrum bar
- The waveform's shape in time
- The total power
- The component's frequency
2. x(t) = 2·sin(2π·50t) + 1·sin(2π·150t). What is its average power?
Answer:
3. 3·sin(2π·5t) + 4·sin(2π·5t + 90°) is a single 5 Hz sinusoid. What is its amplitude?
Answer:
4. A signal is x(t) = 1 + 6·sin(2π·440·t). What is its average power (mean of x², as for a 1 Ω load)?
Answer:
5. Where does a constant offset appear in a spectrum?
- At the highest frequency
- Nowhere
- At 0 Hz
- Spread evenly over all frequencies
Week 21: A square wave made of curves
1. What is the amplitude of the fundamental of a ±1 square wave (3 decimal places)?
Answer:
2. What is the amplitude of the 4th harmonic of a symmetric square wave?
- 4A/(4π)
- Zero
- Half the 2nd harmonic
- The same as the 3rd
3. A square wave swings between +2 and −2 at f₀ = 200 Hz. What is the amplitude of its harmonic number n = 5 (the component at 1000 Hz)? Give 3 decimal places.
Answer:
4. What percentage of a square wave's power is in its fundamental alone (8/π² as a percentage, 1 decimal place)?
Answer: %
5. You add more and more harmonics. What happens to the overshoot near each jump?
- It shrinks to zero
- It stays about 9 % of the jump but gets narrower
- It grows without limit
- It moves to the middle of the flat parts
Week 21: The DFT: asking 'how much of this wave?'
1. In an N-point DFT, what does bin k measure?
- The kth sample
- How much the signal matches a wave with k cycles in the window
- The signal's energy up to sample k
- The kth harmonic of the sample rate
2. x = [1, 0, −1, 0]. What is |X[1]| of its 4-point DFT?
Answer:
3. x[n] = [-1, 1, 1, 1] for n = 0…3. Compute |X[1]|, the magnitude of the 4-point DFT X[k] = Σ x[n]·e^(−j2πkn/4). Give 2 decimal places.
Answer:
4. A 1024-point DFT is taken of a signal sampled at 8 kHz. What frequency, in Hz, does bin k = 64 represent?
Answer: Hz
5. You need to tell 100 Hz and 102 Hz apart. What helps most?
- A higher sample rate with the same N
- A longer recording (larger N at the same fs)
- Fewer bits
- Taking the DFT twice
Week 22: The moving average, seen in frequency
1. A moving average with M = 10 runs at fs = 500 Hz. What is the lowest frequency it removes completely, in Hz?
Answer: Hz
2. A 2-point moving average y[n] = (x[n] + … + x[n−1])/2 filters x = [8, 2, 1, 8, 9, 0, 9] (n = 0…6). What is y[1]?
Answer:
3. How many samples of delay does a 9-point moving average add?
Answer: samples
4. An M = 4 point moving average runs at fs = 8000 Hz. Using |H(f)| = |sin(πMf/fs) / (M·sin(πf/fs))|, what is its gain at f = 2000 Hz? Give 3 decimal places.
Answer:
5. Noise on a sensor is random with standard deviation 4 mV. Roughly what is it after a 16-point moving average?
- 4 mV
- 1 mV
- 0.25 mV
- 2 mV
Week 22: A filter with memory: first-order IIR
1. y[n] = 0.5x[n] + 0.5y[n−1], y[−1] = 0, and x[n] = 4 for n ≥ 0. What is y[1]?
Answer:
2. For a constant input X, the first-order IIR low-pass settles at…
- αX
- (1 − α)X
- X
- 0
3. y[n] = 0.2·x[n] + 0.8·y[n−1], with y[−1] = 0. The input is a step: x[n] = 5 for n ≥ 0. What is y[3]? Give 3 decimal places.
Answer:
4. Using n ≈ −1/ln(1 − α), about how many samples is the time constant for α = 0.1 (1 decimal place)?
Answer: samples
5. A gyroscope reading has a slow, steady bias of 0.3 °/s. Which output removes it?
- The IIR low-pass y
- x − y (the high-pass)
- x itself
- 2y
Week 22: Transforms: why engineers change the question
1. Filtering in time corresponds to what in frequency?
- Adding the filter's response
- Multiplying the spectrum by the filter's response
- Dividing by the sample rate
- Nothing simple
2. Which job needs a high-pass filter?
- Smoothing a jittery thermometer
- Removing a slowly drifting offset from a microphone signal
- Anti-aliasing before an ADC
- Averaging a battery voltage
3. A first-order IIR low-pass has α = 0.2. Using α/(2 − α), what is its gain at the Nyquist frequency (3 decimal places)?
Answer:
4. An M = 4 point moving average runs at fs = 8000 Hz. Using |H(f)| = |sin(πMf/fs) / (M·sin(πf/fs))|, what is its gain at f = 2000 Hz? Give 3 decimal places.
Answer:
5. y[n] = 0.5·x[n] + 0.5·y[n−1], with y[−1] = 0. The input is a step: x[n] = 2 for n ≥ 0. What is y[0]? Give 3 decimal places.
Answer:
6. What does the Laplace transform mainly do for an engineer?
- Speed up sampling
- Turn differential equations into algebra and reveal stability through poles
- Compress audio files
- Replace the DFT in digital filters
Week 23: Doped silicon and the p–n junction
1. Doping silicon with boron (3 outer electrons) makes…
- n-type: extra electrons
- p-type: holes that act as positive carriers
- an insulator
- a metal
2. A silicon diode (0.7 V drop) is forward biased in series with a 1 kΩ resistor across 5 V. What current flows, in mA?
Answer: mA
3. A diode is reverse biased. What happens to the depletion region?
- It disappears
- It widens, so almost no current flows
- It becomes a conductor
- It moves to the n side only
4. What controls a MOSFET's channel?
- Current into the gate
- The voltage on the insulated gate
- The temperature of the drain
- The diode drop
5. You want 10 mA through a diode (0.7 V drop) from a 3.7 V cell. What series resistance, in ohms?
Answer: Ω
Week 23: Building gates from switches
1. A pMOS transistor conducts when its gate is…
- 1 (high)
- 0 (low)
- floating
- always
2. A static CMOS gate with inputs A and B is built from two nMOS in series in the pull-down network and two pMOS in parallel in the pull-up network. Write its output Y for AB = 00, 01, 10, 11 as a 4-bit binary number (Y for 00 is the leftmost bit) and give that number in decimal.
Answer:
3. How many transistors are in a static CMOS 3-input NAND gate?
Answer: transistors
4. A student wires both networks of a gate so that, for input 11, both conduct. What happens?
- The output is a perfect 1
- A direct path from VDD to ground: large current, undefined output
- Nothing: CMOS can't draw current
- The gate becomes a NOR
5. A static CMOS gate with inputs A and B is built from a NOR stage (parallel nMOS, series pMOS) followed by a CMOS inverter. Write its output Y for AB = 00, 01, 10, 11 as a 4-bit binary number (Y for 00 is the leftmost bit) and give that number in decimal.
Answer:
Week 23: Where a chip's power goes
1. α = 0.1, C = 1 nF, V = 1.0 V, f = 1 GHz. What is P = αCV²f, in watts?
Answer: W
2. Halving V (with α, C, f unchanged) changes dynamic power by a factor of…
- 1/2
- 1/4
- 1/8
- 2
3. A CMOS block switches C = 2 nF of total capacitance with activity factor α = 0.1, at V = 1.2 V and f = 200 MHz. Using P = αCV²f, what is its dynamic power, in watts (to 3 decimal places)?
Answer: W
4. Clock gating switches off the clock to idle blocks. Which term does it reduce?
- V
- C of the transistors
- α, the activity factor
- Leakage only
5. How much energy, in picojoules, does one full charge-and-discharge cycle of a 10 fF node at 1 V cost (CV²)?
Answer: pJ
Week 24: Specifying a state machine
1. In a Moore machine the output depends on…
- Only the current input
- Only the current state
- The state and the current input
- The clock frequency
2. A Moore machine outputs 1 for one clock whenever the last 2 input bits were 11 (overlaps allowed). Input, first bit first: 011001011100. How many clocks have output 1?
Answer:
3. A 101 detector has just output 1. The next input is 0. Where should it go?
- Back to the start, forgetting everything
- To the state meaning 'seen 10'
- Stay in the match state
- To the state meaning 'seen 1'
4. A state machine has 6 states. How many flip-flops does a binary state encoding need?
Answer: flip-flops
5. A Moore machine outputs 1 for one clock whenever the last 3 input bits were 110 (overlaps allowed). Input, first bit first: 110011111111. How many clocks have output 1?
Answer:
Week 24: A state machine in hardware
1. Which part of a hardware FSM holds the current state?
- The output logic
- The next-state logic
- The state register (flip-flops)
- The clock
2. A controller has 9 states with binary encoding. How many flip-flops?
Answer: flip-flops
3. The same 9-state controller uses one-hot encoding. How many flip-flops?
Answer: flip-flops
4. A Moore machine outputs 1 for one clock whenever the last 3 input bits were 101 (overlaps allowed). Input, first bit first: 000101110111. How many clocks have output 1?
Answer:
5. Why does the state register load only on the clock edge?
- To save power
- So the state changes only after the next-state logic has settled, avoiding races
- Because gates can't drive flip-flops otherwise
- To make the circuit slower on purpose
Week 24: A state machine in software
1. Why avoid long blocking delays inside a state machine's loop?
- They use too much memory
- Nothing else, including inputs, is checked while the delay runs
- They make the code longer
- Delays are illegal in C
2. A super-loop pass takes at most 5 ms. What is the worst-case time, in ms, from an event to the start of the pass that acts on it?
Answer: ms
3. Which is a strength of a hardware FSM over a software one?
- Easier to change after deployment
- Reacts within one clock cycle and doesn't depend on a program running correctly
- Can log events to a file
- Cheaper to update
4. A Moore machine outputs 1 for one clock whenever the last 3 input bits were 101 (overlaps allowed). Input, first bit first: 000101110111. How many clocks have output 1?
Answer:
5. A junction controller passes a safety audit 'no conflicting greens in any reachable state'. Why check every reachable state, not just a normal cycle?
- To make the report longer
- Because rare paths (button presses, emergency pre-emption) reach states the normal cycle never shows
- Because the clock might stop
- It is not necessary
Week 25: The contract between code and silicon
1. Which of these is NOT part of an ISA?
- The list of instructions
- The number of programmer-visible registers
- How many clock cycles the cache takes on a miss
- How instructions are encoded in bits
2. Two processors implement the same ISA. One is three times faster. What can you say?
- They must have identical circuits
- The same program gives the same results on both; only timing differs
- Programs must be rewritten for the faster one
- The faster one must have more instructions
3. An ISA has a 6-bit opcode field. At most how many different operations can it encode?
Answer: operations
4. TV-16 instructions are 16 bits: opcode = bits 15–12, rd = bits 11–9, rs = bits 8–6, imm = bits 5–0. The word is 0x67B2. What is the rs field, in decimal?
Answer:
5. On the 4-bit Nibble machine, A = 9 and M1 = 8. After ADD 1, what does A hold?
Answer:
Week 25: Instructions are just numbers
1. Encode TV-16 'LDI R2, 5' (opcode 1, rd 2, rs 0, imm 5) and give the word in decimal.
Answer:
2. What is the 8-bit Nibble machine code for STORE 7 (STORE has opcode 3), in decimal?
Answer:
3. TV-16 instructions are 16 bits: opcode = bits 15–12, rd = bits 11–9, rs = bits 8–6, imm = bits 5–0. The word is 0x5738. What is the rs field, in decimal?
Answer:
4. TV-16's immediate field is 6 bits, unsigned. What is the largest constant LDI can load in one instruction?
Answer:
5. A designer wants 16 registers instead of 8 in TV-16, keeping 16-bit words and two register fields. What must shrink?
- Nothing
- The opcode or immediate fields lose 2 bits in total
- The word must become 15 bits
- The registers must become smaller
6. TV-16 instructions are 16 bits: opcode = bits 15–12, rd = bits 11–9, rs = bits 8–6, imm = bits 5–0. The word is 0xD6BB. What is the rs field, in decimal?
Answer:
Week 25: Tracing a program, counting cycles
1. A straight-line program executes 6 instructions on a machine that takes 3 cycles per instruction. How many cycles?
Answer: cycles
2. In the Nibble machine, which instruction does NOT change the Z flag?
- LOAD
- ADD
- STORE
- All of them change it
3. Using cycles = 9m + 6 for the count-down program, how many cycles does it take from M0 = 7?
Answer: cycles
4. A program spends 2 cycles on setup, then runs a loop 15 times with 8 cycles per pass. A new instruction cuts the loop body to 6 cycles. What is the speed-up (old cycles ÷ new cycles), to 2 decimal places?
Answer:
5. Two 8-bit registers start at A = 0, B = 4. On every clock edge both transfers happen at once: A ← B and B ← (A + B) mod 256. What does B hold after 6 clock cycles?
Answer:
Week 26: Thinking in register transfers
1. Why does A ← B, B ← A in one cycle swap correctly in hardware?
- The hardware secretly uses a temporary register
- Both registers sample their inputs at the same edge, from the old values
- A updates first, then B
- It doesn't; it gives A = B
2. An 8-bit register R starts at 210. Each clock edge performs R ← (R + 7) mod 256. What does R hold after 3 cycles?
Answer:
3. A = 1, B = 1. Each cycle: A ← B, B ← A + B. What is B after 4 cycles?
Answer:
4. Which block lets a register choose between keeping its value and loading a new one?
- An ALU
- A multiplexer (or a load-enable built from one)
- A decoder
- A clock divider
5. Two 8-bit registers start at A = 0, B = 4. On every clock edge both transfers happen at once: A ← B and B ← (A + B) mod 256. What does B hold after 6 clock cycles?
Answer:
Week 26: The control unit is a state machine
1. In the stepper's model, what does the decode step change?
- A
- The flags
- PC ← PC + 1
- Memory
2. Which control signal is asserted for every instruction in the model?
- alu_add
- ram_write
- ir_load
- flags_load
3. A microcoded machine has 16 opcodes, 4 steps per instruction and a 12-bit control word. How many bits of microcode ROM?
Answer: bits
4. An 8-bit register R starts at 238. Each clock edge performs R ← (R + 25) mod 256. What does R hold after 4 cycles?
Answer:
5. During JNZ's execute step with Z = 1, what happens?
- PC ← arg
- Nothing changes: PC already points at the next line
- A ← 0
- The machine halts
Week 26: How fast can the clock tick?
1. t_clk→Q = 0.2 ns, logic = 1.0 ns, t_setup = 0.1 ns. What is f_max, in MHz (nearest whole number)?
Answer: MHz
2. What sets the maximum clock frequency of a synchronous design?
- The shortest register-to-register path
- The longest register-to-register path (the critical path)
- The number of registers
- The supply voltage only
3. A register-to-register path has clock-to-Q delay 0.15 ns, 12 gates of 0.1 ns each on its longest path, and setup time 0.1 ns. What is the maximum clock frequency, in MHz (to 1 decimal place)?
Answer: MHz
4. Adding a pipeline register halfway along the critical path usually…
- Halves the clock frequency
- Allows a faster clock but makes each operation take one more cycle
- Removes the need for a clock
- Has no effect
5. A register-to-register path has clock-to-Q delay 0.3 ns, 11 gates of 0.05 ns each on its longest path, and setup time 0.1 ns. What is the maximum clock frequency, in MHz (to 1 decimal place)?
Answer: MHz
Week 27: Project: program the processor
1. Step counts are 25 for y = 3 and 41 for y = 5. Assuming N = b·y + s, what is b?
Answer: instructions
2. The Nibble machine multiplies 5 × 4 in 4-bit arithmetic. What value ends up in the answer cell?
Answer:
3. Why state a loop invariant before writing the program?
- It makes the program run faster
- It gives a reason the result is right when the loop ends, not just a hope
- The assembler requires it
- It replaces testing
4. A program spends 2 cycles on setup, then runs a loop 15 times with 8 cycles per pass. A new instruction cuts the loop body to 6 cycles. What is the speed-up (old cycles ÷ new cycles), to 2 decimal places?
Answer:
5. Two 8-bit registers start at A = 0, B = 4. On every clock edge both transfers happen at once: A ← B and B ← (A + B) mod 256. What does B hold after 6 clock cycles?
Answer:
Week 27: Project: then speed it up
1. Setup 1 instruction, loop of 7 instructions run 10 times. A change cuts the loop to 4. Speed-up (2 decimal places)?
Answer: ×
2. As the loop count grows very large, the speed-up from shrinking the body from b to b' approaches…
- 1
- b/b'
- b − b'
- The setup cost
3. A program spends 2 cycles on setup, then runs a loop 8 times with 8 cycles per pass. A new instruction cuts the loop body to 5 cycles. What is the speed-up (old cycles ÷ new cycles), to 2 decimal places?
Answer:
4. A change makes 60 % of a program's run time 3 times faster. Using Amdahl's law, what is the overall speed-up (2 decimal places)?
Answer: ×
5. A design halves cycle count but makes the clock period 1.5 times longer. Net effect?
- 2× faster
- 1.33× faster
- 1.5× slower
- No change
Week 27: Signals meet hardware: the cycle budget
1. A 16 MHz microcontroller samples at 8 kHz. How many clock cycles are available per sample?
Answer: cycles
2. A 8 MHz processor needs 400 clock cycles to filter one sample. Ignoring everything else, what is the highest sample rate it can keep up with, in kHz?
Answer: kHz
3. A system is at 95 % load. Which change reduces load WITHOUT reducing the frequencies you can capture?
- Halve the sample rate
- Replace a long FIR filter with a first-order IIR that meets the smoothing requirement
- Use fewer ADC bits
- Lower the clock frequency
4. A 48 MHz processor filters a 48 kHz signal, using 400 cycles per sample. What percentage of its cycles does the filter use?
Answer: %
5. An ideal 16-bit ADC spans 0 to 2.5 V. What is its quantisation step Δ = V / 2^N, in millivolts?
Answer: mV
6. A 13920 Hz sinusoid is sampled at fs = 8000 Hz. At what frequency (between 0 and fs/2) does it appear in the samples, in hertz?
Answer: Hz