Download presentation
Presentation is loading. Please wait.
1
Introduction to Computing
Unit 2 : Computer Architecture NCC Education - Title Master 1
2
Summary of the Lecture Data representation What’s inside
The processor Memory The machine cycle Input/output
3
Digital Computing Nowadays all computers are digital
They deal with two-state, on-off data 0/1 yes/no true/false This simplifies how they are made More reliable, cheaper, quicker
4
Digital Computers Most information can be coded into digital signals.
Text Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras risus. Pellentesque et libero. Integer rhoncus lacinia tellus. Integer ac dui a risus tristique ullamcorper. Sed suscipit dui vel elit. Vestibulum eros. Nulla accumsan laoreet lectus. Integer metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Dates, numbers, contact details, addresses
5
Digital Computers Most information can be coded into digital signals.
Music Images Program instructions
6
File Data Types If you look at the files on your storage medium, you will see a wide range of different types of data:
7
Bits and Bytes A bit is the smallest unit of data
It is 0 or 1 – nothing else Collections of bits can mean anything e.g. “can you come out tonight?” 11=yes, 10=maybe, 01=if you pay, 00=no More bits and you can say more
8
Bits and Bytes With enough bits you can say anything but you might need a lot of bits, so we usually group them 8 bits = 1 byte 1 byte is how much is stored in one location in most computers NCC Education - Slide Master 8
9
Bits and Bytes 1 byte is not a lot
There are 256 (28) different ways of arranging the 8 bits in a byte: to
10
Bits and Bytes 256 combinations can give you:
256 different whole numbers (0-255) 256 different characters: Enough for A-Z, a-z plus a few more) Not enough for all the languages in the world We need more bytes for that But with enough bytes, anything is possible
11
Lots of Bytes 1024 bytes is 1 kilobyte 1024 kilobytes is 1 megabyte
1024 megabytes is 1 gigabyte 1024 gigabytes is 1 terabyte 1024 terabytes is 1 petabyte and so it goes on – we always want more!
12
Bytes are Versatile Bytes can be integers: 00000001 =1 00000010=2
=3 =4 =5 =6 =7 etc.
13
Bytes and Integers 128 64 32 16 8 4 2 1 Each column is worth twice the column to its right 128 64 32 16 8 4 2 1 Add up the values that have a 1 in them, in this case it is 2 128 64 32 16 8 4 2 1 In this case, it is =143
14
More Uses of Bytes We can make codes We can now write text
=65 We can say that means “A” =66 That means “B” We can now write text This particular code is called ASCII – American Standard Code for Information Interchange.
15
Bytes do not always mean the same thing
So how do we know if is 65 or “A”? It all depends on the software. We can say that it depends on where it is in memory (the address). For example, it could be: Address 0-100 Content instructions numbers letters other data spare
16
It all depends The software determines what the bytes mean: Integers
Fractional numbers Text Images Sound Program instructions
17
Number Systems We are used to thinking in tens but it doesn’t have to be like that. Binary is simpler. Only two digits 0 and 1
18
Number Systems Decimal: based on digits Each column is worth 10 times the one on the right 1000 100 10 1 Binary: based on 2. 2 digits Each column is worth 2 times the one on the right 8 4 2 1
19
Number Systems The trouble with binary is that you need a lot of digits for not a lot of information but It is convenient for computers
20
Number Systems There is a another way:
Hexadecimal otherwise known as hex Based on the number 16 16 digits ABCDEF Each column is worth 16x the one on the right 4096 256 16 1
21
Hexadecimal (Hex) (16 *1) + 1 = 17 (A (that’s 10) * 16) + 6 = 166
4096 256 16 1 (16 *1) + 1 = 17 4096 256 16 1 A 6 (A (that’s 10) * 16) + 6 = 166 4096 256 16 1 F (F * 16) + F = (15 * 16) + 15 = 255
22
Hexadecimal So….. hexadecimal is shorthand for binary
1 hex digit is worth 4 binary digits F = 1111 = 15 hex binary decimal
23
Arithmetic Adding binary numbers is easy. There are 4 rules: 0 + 0 = 0
0 + 1 = 1 1 + 1 = 0, carry 1 = 1, carry 1
24
Arithmetic Add 0110 + 0011 That is 6 + 3 = 9 in decimal 0110 0011 1001
carry→ 1 1
25
Arithmetic Subtraction is carried out by changing the number being subtracted into a negative, then adding. 5 - 4 = 1 is the same as 5 + (-4) = 1 Negative numbers can be made in binary by using one of the bits to represent a sign.
26
Integers and Floating Point
Integers are whole numbers. 1 byte can hold integers from 0 to 255. For larger numbers or fractions, we need another method – floating point.
27
Floating Point Numbers
The number is split into two parts: The mantissa is the fractional part. The exponent is a measure of the size of the number. Floating point numbers can represent very large and very small numbers in a limited amount of memory. The numbers are usually approximated.
28
Floating point numbers
In decimal: E4 mantissa exponent This is a shorthand way of saying: 14560 (move the point 4 places to the right) It’s the same process in binary.
29
The Microprocessor The microprocessor does the work
It runs the programs It processes the data
30
The Microprocessor The microprocessor is connected to the RAM
RAM is just a data store. It holds: The data being processed The program instructions These are “fetched” into the processor as required microprocessor RAM
31
The Basic Plan of any Computer
primary storage (RAM) ALU Arithmetic Logic Unit performs calculations comparisons CU Control Unit carries out program instructions fetches data secondary storage (disks, memory sticks etc)
32
Primary Memory Otherwise known as RAM (random access memory) or main storage or immediate access store RAM stores: program(s) currently being processed data currently being processed data on its way to output data on its way from input RAM loses its contents when the power is turned off.
33
Secondary Memory This is persistent memory.
Used for keeping data between sessions. There are many examples: magnetic hard disks tapes optical cd dvd blu ray solid state sub notebook PCs flash memory camera cards SIM cards USB memory sticks
34
The Registers The processor contains special memory cells called registers 5 important examples are: program counter current instruction register accumulator memory address register memory data register holds the address of the next instruction to be fetched holds a copy of the instruction currently being processed holds the data currently being worked on holds the address that is currently active holds the data brought from or being sent to RAM
35
The Machine Cycle Most modern computers are based on the same model, the von Neumann architecture. Processing and data are separated. What happens: The program instructions are loaded into RAM The instructions are copied, one by one to the processor The instructions are decoded and carried out by the processor. This happens over and over until the program is terminated. It is called the machine cycle or the fetch-decode-execute cycle.
36
The Machine Cycle The program counter is set to the start address of the program Remember: MAR=memory address register MDR=memory data register CIR=current instruction register repeat the address of the instruction is placed in the MAR the program counter is incremented by 1 the data in the memory location pointed to by the MAR is copied into the MDR the instruction in the MDR is copied into the CIR the instruction in the CIR is decoded the instruction is executed until program terminates
37
The Machine Cycle Sometimes this cycle is interrupted
The program may require a jump Another program might be given control of the processor
38
The Little Man Computer
This is a simulation of a working computer. It has all the basic features of a real computer but in a cut-down form.
39
The Little Man Computer (LMC)
100 RAM locations registers
40
LMC: The Instruction Set
A list of all the possible instructions There are 11 possible instructions. A real PC has about 100. Each instruction has a code number (machine code) and a mnemonic (assembly language). LOAD Code:5 mnemonic: LDA SUBTRACT Code: 2 mnemonic: SUB BRANCH IF ZERO Code: 7 mnemonic: BRZ DATA LOCATION Code : not applicable mnemonic: DAT STORE Code: 3 mnemonic: STA INPUT Code: 901 mnemonic: INP BRANCH IF ZERO OR POSITIVE Code: 8 mnemonic: BRP END Code: 000 mnemonic: HLT ADD Code: 1 mnemonic: ADD OUTPUT Code: 902 mnemonic: OUT BRANCH ALWAYS Code: 6 mnemonic: BRA
41
LMC: What the opcodes mean - 1
LOAD Load the content of the address specified into the accumulator STORE Store the contents of the accumulator in the address specified ADD Add the contents of the specified address to the accumulator
42
LMC: What the opcodes mean - 2
SUBTRACT Subtract the content of the address specified from the accumulator. INPUT Copy the value from the In box to the accumulator. OUTPUT Copy the value from the accumulator to the Out box.
43
LMC: What the opcodes mean - 3
BRANCH IF ZERO If the contents of the accumulator are 0, the program counter will be set to the given address. BRANCH IF ZERO OR POSITIVE If the contents of the accumulator are 0 or positive, the program counter will be set to the given address. BRANCH ALWAYS Set the contents of the program counter to the given address.
44
LMC: What the opcodes mean - 4
END Stop the program. DATA LOCATION This reserves the next available address for data storage.
45
LMC: Example program Instruction meaning opcode operand what happens
901 INPUT none data goes from the In-box into the accumulator 320 STORE 3 20 copy data in the accumulator into memory address 20 another data item is taken from the In-box and it overwrites what is in the accumulator 120 ADD 1 the value in address 20 is added to the number in the accumulator 902 OUTPUT the value in the accumulator is copied to the Out-box END program ends
46
LMC: Example Program It adds 2 numbers together.
With real assembly language, it takes even more instructions. Assembly language takes a lot of effort to do not very much.
47
Input and Output The Little Man computer receives input from the In-box and sends output to the Out-box. Real computers have input and output devices. Input and output devices are slower than the processor. The data streams to and from the devices have to be stored so that the processor is working to full capacity and not kept waiting.
48
Input and Output The data is queued up in a special part of memory (RAM) called a buffer. The buffer is emptied when the hardware is ready for the data. This is part of device management – another job for the operating system.
49
Input and Output input buffer input device output buffer output device
processor output buffer output device
50
Unit 2 Any questions? NCC Education - End Slide Master 50
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.