Introduction to Computing

Slides:



Advertisements
Similar presentations
Computer Memory and Data Transfer
Advertisements

Computer Architecture and the Fetch-Execute Cycle
The Little man computer
Computer Architecture. Central Processing Unit (CPU)- micro processor The Personal Computer.
Elements of the Computer (How a processor works)
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
A-Level Computing#BristolMet Session Objectives#4 MUST describe the differences between the main types of primary memory SHOULD describe the function and.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Hardware 2 Basic Architecture Dr John Cowell
Introduction to Computers
Copyright © 2003 by Prentice Hall Module 5 Central Processing Unit 1. Binary representation of data 2. The components of the CPU 3. CPU and Instruction.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Chapter 4 MARIE: An Introduction to a Simple Computer.
Introduction to Computer Architecture. What is binary? We use the decimal (base 10) number system Binary is the base 2 number system Ten different numbers.
Module 8 Part B Adapted By and Prepared James Tan © 2001.
Von Neumann Machine Objectives: Explain Von Neumann architecture:  Memory –Organization –Decoding memory addresses, MAR & MDR  ALU and Control Unit –Executing.
Computer Science 101 Computer Systems Organization.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
CSCI-100 Introduction to Computing Hardware Part I.
DH2T 34 – HNC Computer Architecture 1 Lecture 14 The Fetch-Decode-Execute Cycle [1]. © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College.
D75P 34 – HNC Computer Architecture
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
Dale & Lewis Chapter 5 Computing components
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Computer Architecture and Number Systems
CPU Lesson 2.
Systems Architecture Keywords Fetch Execute Cycle
The Little man computer
Invitation to Computer Science, C++ Version, Fourth Edition
Topics Introduction Hardware and Software How Computers Store Data
Control Unit Lecture 6.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Storage Hardware This icon indicates the slide contains activities created in Flash. These activities are not editable. For more detailed instructions,
CHAPTER 6: The Little Man Computer
Lesson Objectives A note about notes: Aims
Introduction to Computer Architecture
Microprocessor and Assembly Language
Computer Architecture
Chapter 4 The Von Neumann Model
Hook – CPU Knowledge Check
Instructions at the Lowest Level
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Teaching Computing to GCSE
The Processor and Machine Language
Chapter 4 The Von Neumann Model
Functional Units.
Computers: Hardware and Software
CSCE Fall 2013 Prof. Jennifer L. Welch.
Introduction to Computer Architecture
Topics Introduction Hardware and Software How Computers Store Data
Making Programming Friendlier
Computer Architecture
Computer Architecture
CSCE Fall 2012 Prof. Jennifer L. Welch.
Introduction to Microprocessor Programming
DO IT NOW The LMC has the following instruction set:
Unit 1.1 System Architecture Lesson 2
GCSE OCR 1 The CPU Computer Science J276 Unit 1
The Von Neumann Machine
A Level Computer Science Topic 5: Computer Architecture and Assembly
Information Representation: Machine Instructions
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
COMPUTER ARCHITECTURE
Chapter 4 The Von Neumann Model
Little Man Computer.
Presentation transcript:

Introduction to Computing Unit 2 : Computer Architecture NCC Education - Title Master 1

Summary of the Lecture Data representation What’s inside The processor Memory The machine cycle Input/output

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

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, email addresses

Digital Computers Most information can be coded into digital signals. Music Images Program instructions

File Data Types If you look at the files on your storage medium, you will see a wide range of different types of data:

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

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

Bits and Bytes 1 byte is not a lot 01101011 There are 256 (28) different ways of arranging the 8 bits in a byte: 00000000 to 11111111

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

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!

Bytes are Versatile Bytes can be integers: 00000001 =1 00000010=2 00000011=3 00000100=4 00000101=5 00000110=6 00000111=7 etc.

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 128+8+4+2+1=143

More Uses of Bytes We can make codes We can now write text 01000001=65 We can say that means “A” 1000010=66 That means “B” We can now write text This particular code is called ASCII – American Standard Code for Information Interchange.

Bytes do not always mean the same thing So how do we know if 1000001 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 101-200 201-300 301-400 401-500 Content instructions numbers letters other data spare

It all depends The software determines what the bytes mean: Integers Fractional numbers Text Images Sound Program instructions

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

Number Systems Decimal: based on 10. 10 digits 0-9. Each column is worth 10 times the one on the right 1000 100 10 1 Binary: based on 2. 2 digits 0-1. Each column is worth 2 times the one on the right 8 4 2 1

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

Number Systems There is a another way: Hexadecimal otherwise known as hex Based on the number 16 16 digits 0123456789ABCDEF Each column is worth 16x the one on the right 4096 256 16 1

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

Hexadecimal So….. hexadecimal is shorthand for binary 1 hex digit is worth 4 binary digits F = 1111 = 15 hex binary decimal

Arithmetic Adding binary numbers is easy. There are 4 rules: 0 + 0 = 0 0 + 1 = 1 1 + 1 = 0, carry 1 1 + 1 + 1 = 1, carry 1

Arithmetic Add 0110 + 0011 That is 6 + 3 = 9 in decimal 0110 0011 1001 carry→ 1 1

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.

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.

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.

Floating point numbers In decimal: 1.456 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.

The Microprocessor The microprocessor does the work It runs the programs It processes the data

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

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)

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.

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

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

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.

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

The Machine Cycle Sometimes this cycle is interrupted The program may require a jump Another program might be given control of the processor

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. http://www.atkinson.yorku.ca/~sychen/research/LMC/LMCHome.html

The Little Man Computer (LMC) 100 RAM locations registers

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

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

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.

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.

LMC: What the opcodes mean - 4 END Stop the program. DATA LOCATION This reserves the next available address for data storage.

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

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.

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.

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.

Input and Output input buffer input device output buffer output device processor output buffer output device

Unit 2 Any questions? NCC Education - End Slide Master 50