Computer architecture Created 2026-10-31 Updated 2026-11-05
Computer architecture studies the organization and behaviour of computers, connecting the operations visible to software with the hardware that executes them. An instruction set architecture specifies the machine-level contract, including instructions, accessible processor registers and addressing behaviour. A microarchitecture is a particular implementation of that contract, including execution units, instruction pipelining and memory caches.[ref]
Instruction Set Architecture in the Arm documentation. FAQ, distinction between instruction set architecture and microarchitecture
Two CPUs can implement the same instruction set architecture while taking different times to run the same computer program. One might overlap independent instructions or use a larger memory cache; neither choice changes what an addition instruction is required to compute. A useful performance model writes execution time as instruction count times average cycles per instruction divided by clock frequency. The factors interact: a design that raises clock frequency can also change cycles per instruction. This separates a program's required behaviour from the engineering choices that determine its cost.
Instruction set architecture 2026-10-24
The programmer-visible machine instruction repertoire and its semantics, including accessible processor registers and permitted operand forms. Different processors can implement the same instruction set architecture using different internal designs.
Kevin C. Webb Created 2026-10-13 Updated 2026-11-05
Kevin C. Webb coauthored Dive into Systems by Suzanne J. Matthews and others, which connects computer programs to their machine-level implementation. Its progression through programming languages, instruction set architectures, computer memory and parallel computing explains how the representation and execution of a computer program affect its running time. The authors maintain an open online version with concrete examples.[ref]
Dive into Systems by Suzanne J. Matthews and others. author list and textbook overview
Portrait of Kevin C. Webb
. External portrait hosted by Swarthmore College Department of Computer Science. Source. Microarchitecture 2026-11-05
A microarchitecture is a particular hardware organization implementing an instruction set architecture. It specifies mechanisms such as instruction decoding, execution units, pipelines, caches and branch prediction. Two processors can expose the same instruction-set contract while making different choices about those mechanisms.
For example, both processors may correctly execute a load followed by an integer addition. One can overlap independent instructions and obtain the load from a nearby cache, while the other waits for a longer memory access. The architectural result agrees, but cycle counts differ. Speculative work must be discarded or committed in a way that preserves the required visible behavior. This distinction explains why compatibility with one instruction set does not imply equal performance, power consumption or physical implementation.[ref]
Past exam of the computer science course of the University of Oxford 2015 Compilers 2 c Solution 2026-10-31
Continue the instruction convention above. The current stack frame is now
s's. Its static chain passes through r to p; q is declared directly inside p, so the new q activation must receive a static link to that same p stack frame. Let T be the offset of p's parameter t.Define
CALL q,1 to expect, above the pre-existing evaluation stack, the static link for q followed by its one argument. It consumes these, creates q's stack frame with its dynamic link pointing to the current s activation, and leaves one return value when q returns. This explicit convention avoids dependence on a particular real instruction set architecture.PUSHFP ; s
LOAD SL ; r
LOAD SL ; p, the required static parent of q
DUP ; preserve p for CALL while also using it to read t
LOAD T ; replace the duplicate p address by p.t
CALL q,1 ; q(p.t), with static parent p and dynamic caller s
RETVAL ; return q's result from s to rImmediately before
CALL, the evaluation stack ends in p-frame, 3. Two static link traversals find both the argument's environment and the environment to pass to q. In terms of the hidden argument and ordinary argument, An implementation that places the hidden static link after the ordinary argument could use a different ordering of these same operations. Past exam of the computer science course of the University of Oxford 2015 Compilers 3 d Solution 2026-10-31
The target's register-offset addressing already performs the addition of the array base and a scaled index as part of each load or store. Materializing a maximal common address expression into a processor register introduces an explicit
ADD that this addressing mode could have supplied. Here the extra address temporary variables save no arithmetic that the memory instructions need to perform separately.Instead keep the scaled indices, share the loaded old value of
a[i], and fold the base addition into each memory operand:MOV rb, #A
LD ri, [fp + I]
LSL rj, ri, #2
LD rv, [rb + rj]
LSL rk, rv, #2
LD rt, [rb + rk]
ST rv, [rb + rk]
ST rt, [rb + rj]rj remains the original index's byte offset, rv is its old element, and rk remains the second element's byte offset. Both stores use those saved offsets. Folding address additions into the memory instructions removes two instructions, reducing ten to eight, or eleven to nine if the local load requires the alternative sequence described in part (c). ThereforeThis illustrates why common subexpression elimination must interact with instruction selection: a larger repeated tree is not automatically a better value to materialize. A useful refinement retains common scaled-index trees, or propagates the address addition trees back into their memory uses. The calculation establishes an instruction-count improvement under the stated instruction set architecture; scheduling and actual timing depend on further machine details.
Decompose the 32-bit pattern of into bytes:Let be its ten-bit encoding, so . The following custom-ISA assembly language sequence implements the requested sum:
addi t,s,x0
addi t,t,x1
addi t,t,x2
addi t,t,x3The symbols
x0 through x3 stand for the encoded ten-bit fields, not for the expanded 32-bit values. After line , the destination contains modulo . HenceIf , each instruction correctly uses the preceding partial sum. Zero-byte additions can be omitted except that, when , an initial instruction must still copy the original source if all earlier omitted bytes are zero. An assembler can initialize t with add t,s,0 instead and then emit only nonzero lanes. If , the intended register effect is discarded.For a MIPS instruction
lw t,k(s), first construct in a scratch processor register , using the four-lane sequence above with destination , and then issueload t,(u)For
sw t,k(s), construct the same address in and issuestore t,(u)Choose , or preserve a live scratch processor register according to the calling convention. In particular the store sequence must retain the original data in , even when . Both expansions need at most five custom instructions and have the same address and memory-word effects as the corresponding MIPS instructions, assuming aligned valid memory and 32-bit modular address arithmetic. When , the memory instruction alone suffices. These are listings for the examination's custom instruction set architecture, not native MIPS encodings; exact exception and pipeline behavior is outside the specified datapath.
A zero-address instruction has no explicit operand addresses, so its operands and result location must be implicit in the instruction set architecture. A stack machine supplies these naturally: operations remove their inputs from the top of an operand stack and push the result. A fixed-processor register design is logically possible, so “almost certainly” is appropriately weaker than a proof that only a stack machine could work.
Write the stack from bottom to top, with its top on the right. Let stand for any unchanged prefix. Suitable effects areThus
add pops two operands and pushes one sum, reducing stack occupancy by one. The special const c instruction pushes its immediate constant and increases occupancy by one. Only const needs an explicit value in its encoding.Fix
sub to mean . If the depth-minimizing order evaluates the right operand before the left operand , the stack ends in , so ordinary sub would compute the wrong sign. Two possible instruction set architecture extensions are:- Add
swap, with . After computing and then , useswap; subto obtain . One general zero-address instruction handles every noncommutative binary operation and is useful elsewhere, but each reversed evaluation needs an extra instruction and extra execution time. It can be implemented without an additional operand stack slot. - Add reverse-operand variants, such as
rsubwith , and analogously reverse division and other required operations. After computing and then , a singlersubobtains . This avoids the extra executedswap, but requires more opcodes and decoder support, usually one reverse form for each affected operation.
Suzanne J. Matthews Created 2026-10-13 Updated 2026-11-05
Suzanne J. Matthews coauthored Dive into Systems by Suzanne J. Matthews and others, which connects computer programs to their machine-level implementation. Its progression through programming languages, instruction set architectures, computer memory and parallel computing explains how the representation and execution of a computer program affect its running time. The authors maintain an open online version with concrete examples.[ref]
Dive into Systems by Suzanne J. Matthews and others. author list and textbook overview
Portrait of Suzanne J. Matthews
. External portrait hosted by Suzanne J. Matthews’s official academic website. Source. Tia Newhall Created 2026-10-13 Updated 2026-11-05
Tia Newhall coauthored Dive into Systems by Suzanne J. Matthews and others, which connects computer programs to their machine-level implementation. Its progression through programming languages, instruction set architectures, computer memory and parallel computing explains how the representation and execution of a computer program affect its running time. The authors maintain an open online version with concrete examples.[ref]
Dive into Systems by Suzanne J. Matthews and others. author list and textbook overview
Portrait of Tia Newhall
. External portrait hosted by Swarthmore College. Source. x86 Created 2026-10-13 Updated 2026-11-05
x86 is a family of instruction set architectures whose members include the 32-bit IA-32 architecture and its 64-bit extensions. An instruction set architecture specifies operations, visible processor registers and programmer-visible behaviour; different CPUs can implement it with different internal organizations. The distinction matters when a computer program is correct at the architectural level but has performance that depends on a particular CPU. The Intel manuals separately describe instruction semantics, application programming and system facilities such as virtual memory and processor privilege levels.[ref]


