Skip to content
Book 3: Advanced Theory

Book 3 · Chapter 15

Hardware and Virtual Machines

§15.1§15.2Core · ≈ 12.3 m · ↘B3·15

This chapter is in the ebook.

Read it in full on cswithzak.com. Every question has its mark scheme and every program is ready to run. The free practice for each section is below, with the short code the book prints beside it.

Open in the ebook

For the whole chapter

§15.1 Processors, parallel processing and virtual machines

Short code B3·15·1

§15.2 Boolean algebra and logic circuits

Short code B3·15·2

RISC and CISC processors

Short code B3·15·10

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Pipelining

Short code B3·15·11

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Interrupts in a pipelined processor

Short code B3·15·12

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

The four basic computer architectures

Short code B3·15·13

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Massively parallel computers

Short code B3·15·14

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Virtual machines

Short code B3·15·15

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Command words for processors and VMs

Short code B3·15·16

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Boolean algebra: notation and laws

Short code B3·15·20

from itertools import product
def tt(e, v):
    f = e.replace('NOT', ' not ').replace('.', ' and ').replace('+', ' or ')
    return ''.join(str(int(bool(eval(f, {}, dict(zip(v, r)))))) for r in product((0, 1), repeat=len(v)))
laws = [["identity AND", "A.1", "A"], ["identity OR", "A + 0", "A"], ["null AND", "A.0", "0"], ["null OR", "A + 1", "1"], ["idempotent AND", "A.A", "A"], ["idempotent OR", "A + A", "A"], ["inverse AND", "A.NOT A", "0"], ["inverse OR", "A + NOT A", "1"], ["double complement", "NOT(NOT A)", "A"], ["commutative AND", "A.B", "B.A"], ["commutative OR", "A + B", "B + A"], ["associative AND", "(A.B).C", "A.(B.C)"], ["associative OR", "(A + B) + C", "A + (B + C)"], ["distributive AND over OR", "A.(B + C)", "A.B + A.C"], ["distributive OR over AND", "A + B.C", "(A + B).(A + C)"], ["absorption AND", "A.(A + B)", "A"], ["absorption OR", "A + A.B", "A"], ["redundancy AND", "A.(NOT A + B)", "A.B"], ["redundancy OR", "A + NOT A.B", "A + B"], ["De Morgan NAND", "NOT(A.B)", "NOT A + NOT B"], ["De Morgan NOR", "NOT(A + B)", "NOT A.NOT B"]]
for name, l, r in laws:
    print(name, tt(l, 'ABC') == tt(r, 'ABC'))
Spread 20: every law in the table, proved by comparing truth tables over A, B and C

Output

identity AND True
identity OR True
null AND True
null OR True
idempotent AND True
idempotent OR True
inverse AND True
inverse OR True
double complement True
commutative AND True
commutative OR True
associative AND True
associative OR True
distributive AND over OR True
distributive OR over AND True
absorption AND True
absorption OR True
redundancy AND True
redundancy OR True
De Morgan NAND True
De Morgan NOR True
Run and checked before printing

De Morgan's laws

Short code B3·15·21

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Simplifying with Boolean algebra

Short code B3·15·22

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Sum-of-products: from a truth table or a circuit

Short code B3·15·23

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Karnaugh maps

Short code B3·15·24

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Karnaugh maps: wrap-around and the exam routine

Short code B3·15·25

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Half adders and full adders

Short code B3·15·26

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

SR flip-flops

Short code B3·15·27

DECLARE Q : BOOLEAN
DECLARE QBar : BOOLEAN
PROCEDURE Latch(S : BOOLEAN, R : BOOLEAN)
   DECLARE Pass : INTEGER
   FOR Pass ← 1 TO 2
      Q ← NOT (R OR QBar)
      QBar ← NOT (S OR Q)
      OUTPUT Pass, " ", Q, " ", QBar
   NEXT Pass
ENDPROCEDURE
Q ← FALSE
QBar ← TRUE
CALL Latch(TRUE, FALSE)
CALL Latch(FALSE, FALSE)
CALL Latch(FALSE, TRUE)
CALL Latch(FALSE, FALSE)
Spread 27, Trace it: two cross-coupled NOR gates settling, for S, R = 1 0, 0 0, 0 1, 0 0. Q and QBar are global, so the flip-flop keeps its value between calls.

Output

1 FALSE FALSE
2 TRUE FALSE
1 TRUE FALSE
2 TRUE FALSE
1 FALSE TRUE
2 FALSE TRUE
1 FALSE TRUE
2 FALSE TRUE
Run and checked before printing

JK flip-flops and the clock

Short code B3·15·28

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Command words for logic

Short code B3·15·29

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Past-paper practice

Short code B3·15·90

Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.

Workbook 3: Hardware and Virtual Machines

Short code W3·15 · Advanced Theory Workbook

The write-in workbook for this chapter has drills, exam-style practice, trace tables, fix-the-mistake and mark-it-yourself pages. Its full mark schemes and an interactive version arrive here with the chapter.

Ask Z about Hardware and Virtual Machines
Buy ZAK's books — WhatsApp the books desk: Buy the booksPrint or ebook