0% found this document useful (0 votes)
52 views32 pages

Computer Architecture

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views32 pages

Computer Architecture

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

COMPUTER SYSTEMS

FUNDAMENTALS
( 4COSC004W )
COMPUTER ARCHITECTURE
Hardware to the von Neumann Model

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 3


Process states
Input/output Input/output
or or
Event completion Waiting event wait

Interrupt
Ready Running
Dispatch

New Terminated
Admitted Exit

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 4


Major hardware components
Pep/9 computer

Input Central Output


Main memory
device Processing Unit device

Bus

Data flow

Control flow

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 5


Major components
■ Main memory
– We have discussed
– Fully indexed scratch-pad
– Instructions & data
■ Input devices
■ Output Devices
■ CPU

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 6


CPU (Central Processing Unit)
■ A number of registers which hold specific pieces of information
– 16 bit accumulator (A)
■ Results of calculations
– 16 bit index register (X)
■ Elements in arrays
– 16 bit Program counter (PC)
■ Instructions
– 16 bit Stack pointer (SP)
■ Runtime stack
– 24 bit Instruction Register (IR)
■ Holds an instruction that has just been read
– 4 status bits (N, Z, V, C)
■ Logical gates - electronics

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 7


CPU Instruction set
■ CPUs have very limited instruction sets
■ Pep/9 has an instruction set of 39 instructions
■ Compilers are used to compile high-level programming languages into machine
language.

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 8


Von-Neumann execution cycle
■ Fetch instruction from Mem[PC]
■ Decode the fetched instruction
■ Increment PC
■ Execute the fetched instruction

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 9


Address: Machine Language (bin) Machine Language (hex)
0000 1101 0001 0000 0000 0000 1101 D1000D ; Load byte accumulator ‘H’

0003 1111 0001 1111 1100 0001 0110 F1FC16 ; Store byte accumulator output device

0006 1101 0001 0000 0000 0000 1110 D1000E ; Load byte accumulator ‘i’

0009 1111 0001 1111 1100 0001 0110 F1FC16 ; Store byte accumulator output device

000C 0000 0000 00 ; stop

000D 0100 1000 0110 1001 4869 ; ASCII “Hi” characters

(Warford, 2017) Figure 4.33, 4.34

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 10


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000
000D 4869 ; ASCII “Hi” characters 0003
0006
0009
CPU 000C
A 000D
PC …
IR FC16

(a) Initial state before loading

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 11


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 000D 4869
PC …
IR FC16

(b) Program loaded into memory

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 12


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’ PC
0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 000D 4869
PC 0000 …
IR FC16

(c) PC 0000 (hex)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 13


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’ PC
0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 000D 4869
PC 0000 …
IR D1000D FC16

(d) Fetch instruction at Mem(PC)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 14


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 000D 4869
PC 0003 …
IR D1000D FC16

(e) Increment PC

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 15


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0048 000D 4869
PC 0003 …
IR D1000D FC16

(f) Execute. Load byte for H to accumulator

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 16


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device PC


0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0048 000D 4869
PC 0003 …
IR F1FC16 FC16

(g) Fetch instruction at Mem(PC)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 17


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0048 000D 4869
PC 0006 …
IR F1FC16 FC16

(h) Increment PC

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 18


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0048 000D 4869
PC 0006 …
FC16 0048 H
IR F1FC16

(i) Execute. Store byte from accumulator to output device

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 19


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’ PC


0009 F1FC16 ; Store byte accumulator output device Memory
000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0048 000D 4869
PC 0006 …
IR D1000E FC16 H

(j) Fetch instruction at Mem(PC)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 20


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0048 000D 4869
PC 0009 …
IR D1000E FC16 H

(k) Increment PC

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 21


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0069 000D 4869
PC 0009 …
FC16 H
IR D1000E

(l) Execute. Load byte for i to accumulator

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 22


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device PC Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0069 000D 4869
PC 0009 …
F1FC16 FC16 H
IR

(m) Fetch instruction at Mem(PC)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 23


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0069 000D 4869
PC 000C …
FC16 H
IR F1FC16

(n) Increment PC

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 24


Address: Machine Language (hex)
0000 D1000D ; Load byte accumulator ‘H’

0003 F1FC16 ; Store byte accumulator output device

0006 D1000E ; Load byte accumulator ‘i’

0009 F1FC16 ; Store byte accumulator output device Memory


000C 00 ; stop PC 0000 D1000D
000D 4869 ; ASCII “Hi” characters 0003 F1FC16
0006 D1000E
0009 F1FC16
CPU 000C 00
A 0069 000D 4869
PC 000C …
IR F1FC16 FC16 0069 Hi

(o) Execute. Store byte from accumulator to output device

Computer Systems Fundamentals - 4COSC004W weingan@wmin.ac.uk 25


ASSEMBLY LANGUAGE
One-step up from Machine Language

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 26


High and Low Level languages:

High Level Language

Assemble / Compile

Load
Machine Code

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 27


Instruction set

■ RISC (Reduced Instruction Set Computing)


Asmb5 – 39 commands
■ CISC (Complex Instruction Set Computing)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 28


Operand addressing methods
Direct Immediate
■ Oprnd = Mem[OprndSpec] ■ Oprnd=OprndSpec
■ Asmb5 letter: d ■ Asmb5 letter: i
■ The operand specifier is the ■ The operand specifier is the
address in memory of the operand operand

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 29


PEP9 DEMONSTRATION

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 30


Further reading:

■ Computer Systems, S. Warford


– 4. Computer Architecture (pp. 184 – 230)

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 31


By this stage you:

■ Have gain an appreciation of ;


– Major hardware components
– CPU
■ Cycles
– Von Neumann Model
– Machine code

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 32


Thank you

© The University of Westminster (2021)

These notes were modified from the lecture slides generated by Noam Weingarten.
The right of Noam Weingarten to be identified as author of this work has been asserted by them in accordance with the
Copyright, Designs and Patents Act 1988

Computer Systems Fundamentals - 4COSC004W Week10 part 1/2 33

You might also like