25-Comp-A3 Computer Architecture · December 2018
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
3-hour, open-book exam. The NOTES state that FIVE (5) questions constitute a complete paper and the first five as answered will be marked; all SIX are answered here for completeness (a study resource). Reference texts: Patterson & Hennessy, Computer Organization and Design, 6th ed.
Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.
Given. (a) 512K-word (219-word), word-addressable space; a 64-bit instruction format OP(7)|Destination(19)|Source(19)|nextPC(19); 127 of the 128 possible 7-bit opcodes already assigned; the new design must decode all 127 first-implementation instructions unchanged AND still use 64 bits/instruction. (b) 5 instructions, 32-bit (4-byte) encoding each, 2 of the 5 are memory reads of 4 bytes each. (c) polling as an I/O-communication technique.
Find. (a) whether more instructions can be added at all; whether exactly one more can be added; whether 10 more can be added; whether new instructions can use registers. (b) minimum bytes read from memory to run the program once. (c) the pros and cons of polling versus the alternative (interrupt-driven I/O).
Approach. (a) count the spare opcode slots directly from the 7-bit field, then reason about a two-level (escape-opcode) scheme for growth beyond that count. (b) separate instruction-fetch traffic from data-read traffic and sum only what is actually read. (c) weigh the CPU cost of periodic polling against the responsiveness/CPU-cost tradeoff of interrupts.
Destination(19)|Source(19)|nextPC(19) layout, so nothing about the 127 existing decodes changes and the instruction is still exactly 64 bits. How about 10 more? Not with the flat opcode field alone (only one code point is free), but yes with an extended-opcode (escape) scheme: assign that one free 7-bit code as an escape, and let the remaining $64-7=57$ bits of an escape-tagged instruction be reinterpreted freely as a brand-new field layout with its own secondary opcode — e.g. a 4-bit secondary opcode already yields $2^4=16\ge10$ new instructions, comfortably more than 10, all still packed into 64 bits and without touching any of the 127 original decodes (they never carry the escape opcode, so the decoder still routes them exactly as before). Can it introduce instructions that use registers? Yes, via the same escape: because the escape's 57 remaining bits are not constrained to reproduce the 19-bit memory-address operand format, they can instead be divided into a secondary opcode plus a handful of small register-specifier fields (a modest register file needs only a few bits per specifier), something the original flat format has no room for. Yes to all four: exactly one more instruction fits directly in the spare opcode; ten or more (and register-using instructions) require a two-level escape-opcode scheme built on that single spare code, not a widening of the flat 7-bit field.| Part | Result |
|---|---|
| (a) | One more instruction fits directly (1 spare opcode); 10+ more and register-using instructions need a 2-level escape-opcode scheme built on that spare code |
| (b) | $\boxed{28}$ bytes (20 fetch + 8 data-read) |
| (c) | Polling: simple & deterministic, but wastes CPU cycles and scales poorly with device count/event rarity vs. interrupts |