Past exam of the computer science course of the University of Oxford 2015 Computer architecture 2 d Solution by
Codex 0 2026-10-31
Treat the condition as another instruction operand. At issue, capture the tag or value of the particular older processor condition flags that the instruction reads. Later flag writers must not redirect that dependence. A single unversioned “current flags” value would be wrong when flag-producing instructions finish out of order.
Without a reorder buffer. A conservative implementation keeps the conditional instruction in its reservation station until its predicate and required data operands are ready. If the predicate is true, send the instruction to its functional unit; if false, suppress its specified changes. Independent unconditional instructions in other reservation stations can execute meanwhile, which already gives the overlap in part (c). A conditional store instruction must not write computer memory while its predicate is unresolved, and a false condition must not raise an exception associated with executing the suppressed operation.
Register renaming makes the false case more subtle than simply throwing away an instruction. For a conditional update of destination
r2, let be its preceding logical value and let be the computed new value. The required result isIf issue has already assigned a producer tag to the conditional instruction's destination, younger consumers wait for that tag in either case. Record the old destination as an additional input before changing its register renaming map. When the predicate is false, broadcast under the conditional instruction's new tag, or provide an equivalent correctly ordered mapping/merge mechanism. Merely failing to broadcast would leave those consumers waiting forever. Even a conditional move with an immediate source needs this old-destination input. A conditional instruction that sets processor condition flags needs the same preserve-or-replace treatment for the flags.With a reorder buffer. Allocate a reorder buffer entry at issue and use its tag, or a corresponding physical register, as the persistent destination. The CPU may use the same wait-for-predicate policy. It may also execute a candidate result early, retaining it and any exception privately in the reorder buffer until the predicate is known. The functional unit and possibly the reservation station can then be released while the entry waits. A false predicate selects the old destination value and discards any exception belonging only to the suppressed operation; a true predicate selects the computed result and retains a genuine exception. Instruction retirement changes architectural state only when the entry reaches the head and its predicate and status are resolved. Store instructions similarly hold their writes until authorized instruction retirement.
A reorder buffer by itself does not remove the destination ambiguity. For instance, a younger addition consuming
r2 must not irreversibly use if the predicate might be false. It can wait for the merged . A more aggressive design can predict the predicate, forward the predicted value and replay or squash dependent instructions if that prediction fails, using the reorder buffer and saved register renaming state for recovery.Performance comparison. Let the predicate be available at time , the candidate's ordinary source data at time , and its functional unit take cycles. Ignoring issue and selection overhead, waiting before execution gives a selected result at about . Early execution into a reorder buffer can give it at , provided the old value is also ready when needed. For , and , that is versus cycles. Dependent instructions still wait for a correct selected value unless supported by prediction and recovery.
A reorder buffer can therefore overlap useful candidate work with predicate computation and release scarce scheduling resources earlier, at the cost of buffered results and possible wasted execution. Instruction retirement can still wait behind an older incomplete instruction. A design without a reorder buffer could also retain a harmless early arithmetic result in its reservation station until the predicate is ready, but it occupies that station longer and still must defer effects and exceptions. The fundamental requirements are versioned predicate dependence, preservation of false-case values, and controlled commitment; the reorder buffer makes speculative completion and recovery more systematic.
Past exam of the computer science course of the University of Oxford 2015 Computer architecture 2 c Solution by
Codex 0 2026-10-31
Consider a slow load instruction controlling one conditional addition, followed by independent work. The following is schematic A32 assembly language; the plain Without branch prediction, the unresolved conditional branch prevents fetching beyond it until the load instruction, comparison and branch resolution complete. The multiplication does not depend on
ADD and MUL forms shown do not update processor condition flags:LDR r0, [r1]
CMP r0, #0
BNE skip
ADD r2, r2, #1
skip:
MUL r8, r9, r10r0, yet the out-of-order execution machinery cannot execute it if it has not been fetched and issued.Conditional execution removes that branch:
LDR r0, [r1]
CMP r0, #0
ADDEQ r2, r2, #1
MUL r8, r9, r10ADDEQ adds one exactly when the zero flag from CMP is set; otherwise it preserves r2. The instruction stream has a known sequential continuation, so the CPU can fetch and issue the multiplication while the load instruction is outstanding. With available reservation stations and a free multiplier, independent multiplication overlaps the load instruction's latency.Predication removes a control-flow obstacle to finding independent work; it does not resolve the slow load or its dependent condition earlier. The conditional addition must still select the correct result after the processor condition flags become known. The gain is especially useful for a short conditional region, since instructions whose predicates are false still occupy fetch and issue resources. On a strictly blocking in-order pipeline, a slow demand load instruction would still stop later work in MEM; the overlap here uses the question's out-of-order execution setting and a nonblocking memory path.
Past exam of the computer science course of the University of Oxford 2015 Computer architecture 2 b Solution by
Codex 0 2026-10-31
A reorder buffer records instructions in program order, including those with no destination processor register. Each entry needs a completion state before instruction retirement can pass it. Thus a store instruction must report that its memory address and data are ready and whether execution detected a fault, even though it has no ordinary register file result.
Suppose an older division occupies the head of the reorder buffer, followed by a store instruction and an addition. The latter two can finish first. The store instruction's completion message identifies its reorder buffer entry, carries or identifies the buffered memory address and data, and supplies its status. The entry is then ready, but its write remains private until it is the oldest instruction allowed to commit. When the division retires successfully, the store instruction can commit to the store buffer or memory system, and the addition can subsequently retire. If the division faults, the younger store instruction is discarded without changing visible computer memory.
If the store instruction never reported completion, its reorder buffer entry would remain unready and block instruction retirement indefinitely. Conversely, treating it as completed at issue could commit missing data or suppress its later fault. The common data bus carries tagged completion information as well as register values. A false-predicated instruction also needs a completion indication even when it changes no data.
This answer uses the diagram's shared result/completion path. An architecture can instead provide a dedicated store queue completion path to the reorder buffer; there is no universal requirement to send store data over the same physical wires as arithmetic results. What is essential is delivery of the tagged completion and exception status before instruction retirement.
Past exam of the computer science course of the University of Oxford 2015 Computer architecture 2 a Solution by
Codex 0 2026-10-31
In the illustrated out-of-order execution scheme without a reorder buffer, a reservation station identifier acts as the producer tag for an outstanding result. A register renaming map and waiting operands in other reservation stations can refer to that tag. The tag must remain unique until the result has been broadcast and the required register file update has occurred.
For example, issue a slow multiplication producing
r1 into reservation station S, then an addition r4 := r1 + r5 into another reservation station. The addition records S as the unresolved source of r1. Even after the multiplier has accepted its operands, the multiplication can take many cycles; S cannot be reassigned merely because its operands have left the reservation station. If an independent short instruction is assigned S and broadcasts first, the addition would mistake that unrelated value for the multiplication's result. A later multiplication result could likewise corrupt the new instruction's register renaming mapping.Finishing execution is also insufficient if the result is waiting for common data bus access: consumers and the register file still name S until writeback. Keep the producer tag allocated through broadcast/writeback, so no younger result can masquerade as the outstanding producer. With a separate persistent producer tag, such as a reorder buffer entry or a physical register, a design can release the scheduling slot earlier; this changes the tag-ownership arrangement in the question.
Past exam of the computer science course of the University of Oxford 2015 Computer architecture 1 c Solution by
Codex 0 2026-10-31
Speculative execution allows younger instructions to proceed while some condition on an older instruction is unresolved. Here the prediction is that a store instruction will pass its memory management unit's protection and translation checks. Successful prediction avoids waiting; failure requires discarding younger work and taking the older instruction's synchronous processor exception. A result computed speculatively must not become an irreversible architectural change before it is safe.
In the displayed five-stage in-order pipeline, the store instruction's memory address is computed in EX and its memory operation is in MEM. Take the permission check to finish at the end of MEM, with a one-cycle cache hit, no data hazards and sufficient store buffer capacity. A concrete conservative implementation without speculative execution fetches no younger instruction until this check has passed. Compare the start of a stream of independent, nonfaulting store instructions:
The conservative version inserts three otherwise unnecessary cycles after each such store instruction, whereas the speculative version can start one instruction per cycle. For stores, counting through WB, the times are and cycles. ThusMore generally, with a fraction of such store instructions and no other delays, this particular interlock gives an asymptotic comparison . The maximum is four, not five: the permission check is resolved in MEM, so waiting for the empty store WB stage is unnecessary.
The baseline's interlock position matters. If it allows younger IF and ID work but prohibits younger EX until the end of the store's MEM stage, only one EX cycle is lost per store: successive stores reach EX in cycles , compared with under speculative execution, giving a limiting factor of two for that baseline. Holding at ID instead gives two lost cycles per store and a factor of three. The fourfold figure compares against a pipeline that stops younger fetch; an implementation that already permits younger front-end work has a smaller remaining benefit. The source specifies the five stages but does not prescribe this alternative's interlock position.[ref]
On a protection failure detected at the end of MEM, younger instructions occupy EX, ID and IF and can be invalidated before their normal WB. Younger store instructions must also be prevented from draining from a store buffer before validation. Earlier updates to processor condition flags, if any, need delayed commitment or restoration too. This is what makes the prediction compatible with a precise exception; merely continuing to execute is insufficient.
Past exam of the computer science course of the University of Oxford 2015 Computer architecture 1 b Solution by
Codex 0 2026-10-31
A store buffer holds the memory address and value of a store instruction while the memory cache or backing computer memory completes the write. The in-order pipeline can continue after enqueueing the write, rather than waiting for a possibly long memory access latency. A full store buffer eventually causes a pipeline stall; buffering hides finite delays, not an indefinitely inadequate service rate.
Without a memory management unit, the comparison can use the actual physical addresses; there is no address translation or synonym problem to solve. Suppose If the write is still in the store buffer, reading only computer memory could incorrectly return zero. The load instruction searches older buffered store instructions for an overlapping memory address. If the newest matching write covers the requested bytes and its data are ready, store-to-load forwarding returns seven directly. With several pending writes to
x initially contains zero and these operations execute in order:STORE [x], 7
LOAD r1, [x]x, the youngest older matching write wins. If the relevant data are not ready, the load instruction waits; partial overlaps require merging the covered bytes or conservatively waiting for the writes to drain.A load instruction from an unrelated address
y can bypass those buffered writes, subject to the architecture's memory model. Buffer writes to overlap them with useful execution, but preserve each load's dependence on older writes to the same bytes. Device accesses through memory-mapped input-output need their specified ordering and should not be treated as ordinary cacheable computer memory. Past exam of the computer science course of the University of Oxford 2015 Computer architecture 1 a Solution by
Codex 0 2026-10-31
Register forwarding supplies a later instruction with a computed value before that value has reached the register file. It removes some read-after-write hazards without changing the program's meaning. Consider these symbolic machine instructions, with the destination first:In the five-stage in-order pipeline, the addition produces its result at the end of EX. In the next cycle the subtraction is in EX, although the addition has not yet reached WB. A bypass from the addition's EX/MEM pipeline register to the subtraction's arithmetic logic unit input supplies the new
ADD r1, r2, r3
SUB r4, r1, r5r1; the old value read in ID must be overridden.The bypass control compares source and destination processor register identifiers and selects the youngest applicable older producer. It must also check that the producer actually writes that processor register. Forward the newest available result instead of waiting for its writeback. A load instruction is different: its value is normally available only at the end of MEM, so an immediately following dependent instruction still needs a pipeline stall in this five-stage arrangement.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 3 f Solution by
Codex 0 2026-10-31
Yes: the procedure always terminates after finitely many steps. If an iteration does not return, then . Thus at least one state is permanently removed. A finite set of states can suffer at most such strict decreases, after which the next equality test must return. Therefore the procedure makes at mostwhen started from , counting the final evaluation that detects equality. The bound also covers , where the first evaluation already returns. Each evaluation inspects finitely many states and successors, so every individual step terminates as well. Finiteness, rather than monotonicity alone, supplies this finite termination bound.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 3 e Solution by
Codex 0 2026-10-31
Start with every state, and repeatedly discard a state that is outside or has any successor outside the current candidate set. Use a fresh set on each iteration so that the displayed procedure computes exactly :This is fixed-point iteration , . The first step gives , because every successor is a state of . Thus . If , the order-preserving function property givesThe candidate sets therefore form a descending chain under set inclusion.
function Sat_AG(S, Post, A):
X = copy(S)
repeat:
Y = empty_set()
for s in S:
if s in A and every t in Post(s) belongs to X:
insert s into Y
if Y == X:
return X
X = YEvery fixed point is contained in every : initially , and implies . At return, , and contains every fixed point. The returned set is consequently the greatest fixed point, so by part (d).
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 3 d Solution by
Codex 0 2026-10-31
Let be any fixed point of . Thenso and every successor of every member of belongs to . Take and an arbitrary infinite path in a transition system from . By mathematical induction, every belongs to : the base case is the choice of , and implies .
Since , the whole path in a transition system stays in . The path in a transition system was arbitrary, so . Thus , and since was arbitrary in ,Part (b) proves that itself is a fixed point. Thereforethe greatest fixed point with respect to set inclusion. In fact the same induction works for every , showing why a successor-closed set of good states certifies this universal property.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 3 c Solution by
Codex 0 2026-10-31
Every state has at least one successor, so for every . ThereforeThe empty set is always a fixed point. Whenever is nonempty, it is therefore an additional, distinct fixed point.
For an explicit example, take a one-state transition system with , the self-loop , and . Then and has the two distinct fixed points and . This example meets the requirement of no terminal states.
The wording does not guarantee distinct additional fixed points for every instance. For example, if , then for every and its only fixed point is . Thus additional fixed points can occur, but need not occur. The universal example is distinct precisely when the desired satisfaction set is nonempty, as also follows from the greatest fixed point argument below.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 3 b Solution by
Codex 0 2026-10-31
Let . By computation tree logic semantics, a state belongs to exactly when every infinite path in a transition system starting there stays in at every position, including position zero. There are no terminal states, so every state lies at the start of an infinite path in a transition system.
If , then . For any successor of , every infinite path in a transition system from can be prefixed with . Hence every such continuation stays in , so . Thus and .
Conversely, if , then and every successor belongs to . Every infinite path in a transition system from therefore has its first state in and its entire remaining tail in . Consequently . Both inclusions giveso the desired satisfaction set is a fixed point of .
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 3 a Solution by
Codex 0 2026-10-31
Write . All arguments depend only on this given satisfaction set; they do not require an additional convention for the printed notation . For a state , let . The power set is ordered by set inclusion.
Take and any . By the definition of , we have both and . By transitivity of set inclusion, , so . Since this applies to every member of ,Thus is an order-preserving function, which is the meaning of monotonicity here. This proof does not need either finiteness or the absence of terminal states.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 2 c Solution by
Codex 0 2026-10-31
To apply bounded model checking, seek an initial path in a transition system satisfyingA satisfying assignment for its bounded encoding is enough to disprove the specification. Use a lasso path: positions follow the transition relation, and a final arrow returns from to some , . The repeated part is . On such a lasso path, is equivalent to having true at some position of the repeated part.
For this example an explicit Boolean formula for the bounded search isHere means and means that the source diagram has the arrow ; each can be encoded by finite Boolean variables for the states. The loop requirements are the fairness assumption and the negated specification respectively. Unrolling the transition relation and adding a loop closure is the usual bounded model checking construction.[ref]
Symbolic Model Checking without BDDs by Armin Biere and others. §2, worked example with an unrolled transition relation and a returning loop; §3, infinite-path semantics
At bound , an initial self-loop would be needed. The only such choice is , whose repeated label satisfies and . It violates both loop requirements. The other initial state, , has no self-loop. Thus has no satisfying assignment.
At bound , chooseBoth required arrows and exist. At , is false and hence is false, so both repeated-part requirements are true. Equivalently, the label values are and . These values give a satisfying assignment of , representing the fair counterexample . ConsequentlyHere the bound counts forward arrows before the returning arrow, so stores two positions and describes a two-state repeated part. There is no need for a completeness bound: the exhibited fair counterexample settles the negative answer. These satisfying assignments are checked directly; no claim of executing an external SAT solver is needed.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 2 b Solution by
Codex 0 2026-10-31
Denote the three families found in part (a) by , and , where . All are fair paths in a transition system. The verdicts areEach verdict follows from the infinite path in a transition system semantics, rather than from a finite prefix alone.
For , take . From onwards, is always false, so there is no time after which is always true. Therefore the first specification fails, with fair counterexample . The path in a transition system is another fair counterexample, because it encounters , where is false, infinitely often. Each does satisfy , since satisfies forever.
For , take . Its next state is , so is true, but is false as just shown. Thus the second specification fails, with fair counterexample . Alternatively, has next state , making its antecedent true and its consequent false. For with , the next state is still , so this implication is true there because its antecedent is false; this does not rescue a universally quantified specification.
For , the fair path in a transition system reaches , where is false. Thus the third specification fails, with fair counterexample . In fact every fair initial path in a transition system reaches or , so none satisfies .
For , strong until requires an eventual position satisfying , together with at every earlier position. On , is true forever, so never holds. Thus the fourth specification fails, with fair counterexample . On each , holds until entry into , after which holds forever. On each , holds until entry into , after which holds forever. These latter paths in a transition system satisfy the strong until requirement.
For , weak until permits either the preceding strong until behavior or . Every and satisfies the strong until behavior, and satisfies . These exhaust the fair initial paths in a transition system. Therefore the fifth specification holds on every fair initial path. Allowing the left operand to continue forever is exactly what distinguishes this answer from the previous one.
For , the two next-time operators belong to the left operand of strong until. The fair path in a transition system has true at positions zero and one, then false at every position from two onwards. Therefore first holds at position two. But is false already at position zero, since is false at position two. A witness for strong until cannot occur at zero or one, where its right operand is false, or at two or later, where its left operand has already failed. Thus the sixth specification fails, with fair counterexample .
Indeed, every fair initial path in a transition system fails the sixth specification. On , the right operand never holds. On and , let be the first position of the permanent tail. The left operand is false at , strictly before any possible right-operand witness. This also checks that the two next-time operators cannot be ignored or shifted onto the whole strong until formula.
Past exam of the computer science course of the University of Oxford 2015 Computer aided formal verification 2 a Solution by
Codex 0 2026-10-31
Use the two incoming initial arrows in the source figure: . An atomic proposition is true precisely at the states whose displayed labels contain it. In particular, is false at every state. Hence is true on every infinite path in a transition system, and the first implication in the fairness assumption imposes no restriction.
Write . The remaining implication is . By the linear temporal logic duality , it is equivalent tosince implies . Thus a path is fair exactly when it visits states not labelled with both and infinitely often. This condition also follows directly: if eventually holds forever, then eventually holds forever and the required is impossible; if does not eventually hold forever, the implication has a false antecedent.
Every initial path in a transition system in the upper component either alternates forever between and , or makes finitely many alternations and then stays at . These are all fair: the first visits infinitely often, and the second visits infinitely often; neither state satisfies .
In the lower component, a path in a transition system can stay at forever, or leave it after finitely many visits and pass through to . The constant path in a transition system is unfair because holds forever while never holds. Every departing path in a transition system is fair because satisfies neither nor . Here means infinite repetition of the finite word . ThereforeThis notation lists initial paths in a transition system. If one instead allows arbitrary starting states, their suffixes starting at are fair as well; the fair paths in a transition system from each initial state, and hence all verdicts below, are unchanged.
There are unlisted articles, also show them or only show them.