A Level Computer Science Interactive Lab

Created by tr.wailinhtet · Computer Science School · Chapters 15 and 18

Von Neumann architecture and the fetch-decode-execute cycle

Program instructions and data share one memory. Step through a small program (LOAD, ADD, STORE) and watch the registers, the three buses and the memory change.

Processor (CPU)

Buses

Main memory (RAM)

Cycle log

Registers: PC holds the address of the next instruction; MAR holds the address being read or written; MDR holds the data just read or about to be written; CIR holds the instruction being decoded; ACC holds the result of ALU work. CU decodes instructions and sends control signals; ALU does arithmetic and logic.

CISC and RISC processors

Compare the two designs, then watch RISC-style pipelining overlap the five stages of each instruction.

CISC featuresRISC features
Many instruction formats are possibleUses fewer instruction formats/sets
There are more addressing modesUses fewer addressing modes
Makes use of multi-cycle instructionsMakes use of single-cycle instructions
Instructions can be of a variable lengthInstructions are of a fixed length
Longer execution time for instructionsFaster execution time for instructions
Decoding of instructions is more complexMakes use of general multi-purpose registers
More difficult to make pipelining workEasier to make pipelining function correctly
Design emphasis is on the hardwareDesign emphasis is on the software
Uses the memory unit to allow complex instructionsProcessor chips require fewer transistors

Pipelining simulator

Stages: IF (instruction fetch), ID (decode), OF (operand fetch), IE (execute), WB (write-back). Each stage takes one clock cycle.

Logic gates, half adder and full adder

Choose a gate to see its truth table, then set the inputs of the adders.

Inputs

Half adder (A and B)

Sum = A XOR B, Carry = A AND B

Full adder (A, B and Cin)

Karnaugh maps

Click an output (X) in the truth table or a cell in the K-map to flip it. The simplest sum-of-products expression is found for you. The K-map columns use Gray code (00, 01, 11, 10) so neighbours differ by one bit.

SR flip-flop (NOR gates)

Two cross-coupled NOR gates store one bit. Toggle S (set) and R (reset) and watch Q and its inverse change. Try S = 1, then S = 0 to see the memory.

SRQQ̅Comment

Shortest path: A* and Dijkstra

Step through each algorithm on the textbook graph. Dijkstra expands the node with the smallest g (cost so far). A* expands the smallest f = g + h, where h is the heuristic estimate to the goal.