St. Benedict s High School. Computing Science. Software Design & Development. (Part 2 Computer Architecture) National 5

Similar documents
Computer Systems: Data Representation

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

CC411: Introduction To Microprocessors

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Homeschool Enrichment. The System Unit: Processing & Memory

INTRODUCTION TO COMPUTERS

Technology in Action

C H A P T E R 1. Introduction to Computers and Programming

Computer Science Applications to Cultural Heritage. Introduction to computer systems

National 5 Computing Science Software Design & Development

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

Stonelaw High School. Computing Science. BGE - Computer Systems

Chapter Two. Hardware Basics: Inside the Box

Name: Date: Hour: The abacus (still in use today) is about 5,000 years old. Not a computer.

Common Technology Words and Definitions

Higher Computing: Computer Systems CONTENTS

Objectives. Connecting with Computer Science 2

An Overview of the Computer System. Kafui A. Prebbie 24

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

General Computing Concepts. Coding and Representation. General Computing Concepts. Computing Concepts: Review

M1 Computers and Data

Chapter 4 The Components of the System Unit

2nd Paragraph should make a point (could be an advantage or disadvantage) and explain the point fully giving an example where necessary.

Introduction. Arizona State University 1

9/7/2012. Introduction. Peeking into Computer Science. Jalal Kawash Mandatory: Chapter 1 Optional: None. Reading Assignment

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Digital Fundamentals

Sahalsoftware college. Welcome To understanding Basic Computer Concept

CS 101, Mock Computer Architecture

Computer Organization

7/28/ Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc.

Question Bank. Fundamentals Of Computer FYBCA (SEM - I)

Computers Are Your Future

1. A folder inside a folder is called. a) Mini Directory b) Sub Directory c) Root Folder d) Child Folder e) None of these

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

Computer Architecture 2/26/01 Lecture #

Full file at

Components of a personal computer

Digital Fundamentals

CMSC 1513 Lecture 1.2

Padasalai s - VIRUDHUNAGAR DISTRICT COMMON FIRST MID TERM TEST, JULY 2018 STANDARD 11 COMPUTER APPLICATION

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

HANDOUT: COMPUTER PARTS

Chapter 9: A Closer Look at System Hardware

Chapter 9: A Closer Look at System Hardware 4

Diskrečioji matematika

The Central Processing Unit

Unit - II. Computer Concepts and C Programming 06CCP13. Unit II

CS1101: Lecture 18. Computer Systems Organization: Input/Output. Lecture Outline. Mice. Dot-Matrix Printers. Mice

Q1. Describe C.P.U and its subunits with the help of diagram?

Computer Fundamentals

Bits and Bytes. Here is a sort of glossary of computer buzzwords you will encounter in computer use:

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

Representing Characters, Strings and Text

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what

Motherboard BIOS. Fig: 1 What you see (or something similar) if you turn the PC manufacturer's logo off

TUTORIAL Describe the circumstances that would prompt you to use a microprocessorbased design solution instead of a hard-wired IC logic design.

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Machine Architecture. or what s in the box? Lectures 2 & 3. Prof Leslie Smith. ITNP23 - Autumn 2014 Lectures 2&3, Slide 1

machine cycle, the CPU: (a) Fetches an instruction, (b) Decodes the instruction, (c) Executes the instruction, and (d) Stores the result.

Introduction to Computers - Chapter 4

Introduction to Informatics

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

Bits, bytes, binary numbers, and the representation of information

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Segment 1A. Introduction to Microcomputer and Microprocessor

System Unit Components Chapter2

Basic Computer Hardware Notes in PDF

Basic computer principles

Basic data types. Building blocks of computation

CS/EE 260. Digital Computers Organization and Logical Design

Intermediate Programming & Design (C++) Notation

Higher Grade Computing Homework Answers Units 1 & 2

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Switching to AQA from OCR

Chapter 1: An Overview of Computers and Logic

What is the typical configuration of a computer sold today? 1-1

Chapter 4 The Components of the System Unit

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

So computers can't think in the same way that people do. But what they do, they do excellently well and very, very fast.

C++ Programming Language Lecture 1 Introduction

Lecture 1: What is a computer?

lesson 3 Transforming Data into Information

8. A is approximately one billion bytes a. Kilobyte b. Bit c. Gigabyte d. Megabyte 9. SMPT, FTP and DNS are applications of the layer a. Data link b.

Computers Are Your Future

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

Final Labs and Tutors

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

COMPUTER ORGANIZATION & ARCHITECTURE

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

Standard File Formats

Input and output Systems. Peter Rounce - room G06

Chapter 4: Computer Codes. In this chapter you will learn about:

Switching to AQA from Edexcel

Introduction. Computer System Organization. Languages, Levels, Virtual Machines. A multilevel machine. Sarjana Magister Program

Information Science 1

Hardware and Software - Revision Summary

Transcription:

Computing Science Software Design & Development (Part 2 Computer Architecture) National 5

DATA REPRESENTATION Numbers Binary/Decimal Conversion Example To convert 69 into binary: write down the binary place value headings, then work out which headings add up to 69: 128 64 32 16 8 4 2 1 0 1 0 0 0 1 0 1 01000101 = (1 * 64 ) + (1*4) + (1*1) = 64 + 4 + 1 = 69 Using this method it is just as easy to convert from binary back to decimal as shown above. More examples 128 64 32 16 8 4 2 1 0 0 0 0 0 1 0 1 5 0 0 1 0 0 0 0 0 32 0 1 0 0 1 1 0 1 13 1 0 0 0 1 1 0 0 140 1 1 1 1 1 1 1 1 255 Something to know about storing numbers on a computer is that a fixed number of bits is always used. For simplicity our examples will always use just 8 bits as above. However, let s say a computer uses 32 bits to store numbers, then 3 would be stored as: 00000000000000000000000000000011 324 564 046 stored as: 00010011010110000111010001001110 2

Floating Point Representation Real numbers and very large numbers are stored in the computer as floating point numbers. This is like the standard form or scientific notation used in maths except the computer does not store the point or the base. Decimal Example 93 000 000 in Standard Form: 9.3 x 107 93 000 000 in Floating Point: 93 8 The 93 is called the MANTISSA The 6 is called the EXPONENT So, in decimal Mantissa x 10 Exponent However, computers use binary, and in binary we express the exponent as a power of 2, so every binary floating point number is of the form: Mantissa x 2 Exponent More about the mantissa and exponent... Computers use a fixed number of bits to store floating point numbers. For instance with 32 bits they might use 24 bits for the mantissa and 8 bits for the exponent. Or they could use 20 bits for the mantissa and 12 bits for the exponent. This has an effect on the ACCURACY of the numbers stored and the RANGE of values that can be stored. 3

(Decimal examples) With our numbers imagine we have a calculator that can only display 3 digits for the mantissa and 1 digit for the exponent: With our numbers imagine we have a calculator that can only display 3 digits for the mantissa and 1 digit for the exponent: E 93 000 000 would be stored: 9 3 8 12 875 000 would be stored: 1 2 9 8 Note the loss of accuracy. 2 340 000 000 cannot be stored at all. The point moves 10 places and this is out of our range. So the exponent determines the range of numbers that can be stored in floating point. Binary example The binary number 1101.0011011101 The decimal point cannot be stored so it is moved 4 places to the LEFT. So the number in floating point from will be :.11010011011101 x 2 4 which in binary, is.11010011011101 x 2 100 In this case the mantissa is 11010011011101 and the exponent is 100. Range & accuracy Increasing the length of the mantissa increases the accuracy of the number stored. Increasing the length of the exponent increases the range of numbers stored. 4

Text Representation of Characters. Input, output, backing storage and data communications devices store and manipulate data in character code. During processing, text data stays as character code but numerical data is converted to binary patterns following the convention already discussed. Programmers specify the type of data within their code and conversion is then carried out by hardware or software. The characters that can be represented by the computer is known as the character set. Many computers have the flexibility of using several character sets, but we will restrict our discussions to ASCII and Unicode. ASCII American Standard Code for Information Interchange (ASCII) was first developed for teletypewriters and is now an internationally agreed standard for storing information. It is a character set which forms the basis for almost all other character sets. ASCII uses 7 bits per character, giving a possible 128 different characters (27 = 128). It has 96 displayable characters, enough to represent a letter or symbol of the English alphabet and numerical symbols. There are 32 special character codes known as control characters. A single code is used to represent each character which is stored in binary. When data is to be displayed or printed, the code is converted into an appropriate shape. The 7-bit table of ASCII codes is shown below. 5

The Control Characters The first 32 ASCII values are non-printing control characters, such as Return and Line feed. You generate these characters on the keyboard by holding down the Control key while you strike another key. When IBM PCs were designed, they moved and stored data in 8-bit units. The extra bit increased the character set from 128 to 256 (28 = 256), producing an extended character set that could accommodate international dialects or alphabetic characters in foreign languages (French and German accented characters are examples). Unicode An increase in worldwide communications brought a need to exchange information internationally. This presented a problem for Latin based character sets. Languages such as Japanese and Arabic, for example, do not use the Latin-based symbols of English, French or German and have entirely different symbol shapes. A Japanese symbol is shown. A solution to the problem of supporting multilingual text was to encode characters using 16 bits, thus providing 65,536 possible symbols (216 = 65,536). This is Unicode which is capable of including the characters from all known languages and alphabets in the world. SUMMARY ASCII codes can be stored in using 7 or 8 bits per character and therefore requires less storage than Unicode. Unicode uses 16 bits per character and can therefore represent more characters than ASCII. Unfortuantely this requires more storage than ASCII. 6

Graphics Bit-mapped graphics For a graphic drawn in a painting type package, the computer stores the necessary information as a two dimensional array of pixels. In black & white images, each pixel is represented by one bit. For example, Once drawn, each individual pixel can still be edited. Another example of storing a bit-mapped image: This is a graphic of a flower. In a painting type program it is viewed by the computer as a bit pattern. Because EVERY pixel is stored, bit-mapped graphics require a large amount of storage. 7

Using colour and bit-mapped graphics. The value of each pixel (whether it is filled in or not) is stored in one or more bits of data. For simple black & white images, one bit is sufficient to represent each pixel, but for colours, each pixel requires more than one bit of data. The more bits used to represent a pixel, the more colours that can be represented. The table below shows the way in which 2 bits can be used to store 4 different colours. Bit Pattern Colour No of Bits 00 Black 2 01 White 2 10 Red 2 11 Yellow 2 Two Red pixels would therefore take 4 bits of storage. Table showing number of bits and corresponding number of colours represented: No of bits per pixel No. of colours 1 2 (Black & white) 2 4 3 8 4 16 5 32 6 64 7 128 8 256 16 65536 24 16,777,216 (True Colour) So, 2 no. of bits = no. of colours available. 8

Advantages of bit-mapped graphic representation a bit mapped image can be edited at the pixel level. Thus a designer may apply particular colour values to a selected pixel area to produce shading or textured effects it is possible to create a wider range of irregular shapes and patterns by simply deleting or editing pixels anywhere on the image Disadvantages of bit-mapped representation requires large amounts of storage space image becomes course (jagged) when scaled Resolution The density of the pixels, known as the resolution, determines how sharply the image is represented. This is often expressed in dots per inch (dpi ). A picture at 300dpi contains much more detail than a picture at 72dpi. 9

Vector Graphics With vector graphics, images are stored as a series of attributes i.e. a description of how it is drawn. Any editing is done at the level of attributes. Editing an individual pixel is not possible. Examples Rectangle Start x,y position Length, breadth and angle of rotation Thickness & colour of line Colour fill etc. Circle Centre x,y position Radius Thickness & colour of line Colour fill etc. Advantages of vector graphic representation as values are not held for every pixel, less storage space required than a bit mapped image they do not lose their image quality on scaling - object attributes are simply recalculated Disadvantages of vector graphic representation individual pixels cannot be edited. 10

Storage Requirements Calculating Storage Requirements - SCREEN You can calculate the storage requirements for a screen or a graphic on the screen using the formula: No. of BITS required = Pixels across x Pixels down x bit depth Example 1: A 1280 by 800 screen using 8 bit colour depth needs: 1280 x 800 x 8 BITS = 8192000 bits /8 = 1024000 bytes /1024 = 1000 Kbytes Example 2: Calculate the storage required for a screen using 1620 by 1280 pixels with 65 536 colours. Bits = 1620 x 1280 x 16 (because 2 16 = 65 536) = 33177600 bits /8 = 4147200 bytes /1024 = 4050 Kbytes /1024 = 3.96 Mbytes Note how the number of bits per pixel increases the file size. 24 bit colour produces a file 3 times larger than 8 bit colour. 11

Calculating Storage Requirements BIT-MAPPED FILE You can also calculate the storage requirements for a bit-mapped graphics file. The idea is basically the same as before but it takes a little longer to get there. As before we need to identify the number of pixels required and the bit-depth (no. of colours used). Calculating the storage requirements of a file requires a little extra detective work! Example: This picture measures 2 inches by 3 inches, contains a possible 256 colours and was scanned at 72 dpi. First we have to work out the number of pixels: 2 inches x 3 inches at 72 d.p.i (dots per inch) = (2 x 72) x (3 x 72) = 31104 pixels Next, the bit depth: Bit depth = 8 (because 2 8 = 256) So, our storage requirement is 31104 pixels at 8 bits each 31104 x 8 = 248832 bits /8 = 31104 bytes /1024 = 30.375 Kbytes 12

TRANSLATORS Need for Translators High Level Languages Computers only understand binary. Unfortunately, humans are not so good at understanding this and so humans program computers in high level languages. High level languages use normal mathematical notation and English words to create instructions. Visual Basic is an example of a high level language. Because high level languages use English-like words programs are easy to write and edit. A translator is a special program that converts a program from a high-level language into machine code. The high-level program is called the source code. This is often created using a text editor. The translator turns this into object code which is usually the machine code (binary) of the computer being used. Translators can normally be put into two groups compilers and interpreters. Interpreters v Compilers Interpreter An interpreter translates and executes a program one statement at a time. Advantages When syntax errors are made by the user, they are highlighted immediately. Speeds up the software development process Disadvantages Interpreted programs are slow to run Every time the program is run, each line of code must be translated again. Statements inside a loop have to be translated every time round the loop. The interpreter must also be in memory as the program is running. Thus the RAM demands of an interpreted program are greater. 13

Compiler A compiler is a program that translates your entire high-level source program into your computer s machine code. It produces a machine code program that is saved to disk and which can be executed by itself. This version of the program is known as object code. The source code will only be used again if the program needs to be updated or bugs fixed. Should this happen, an updated version of the object code is produced by using the compiler again. Advantages A compiled program runs faster than an interpreted program as the whole source is translated to machine code. The compiler only needs to be in memory while translation is taking place - more economic memory usage than interpreter Disadvantage Syntax errors in the source code are only identified when the program is compiled. 14

COMPUTER ARCHITECTURE The Processor The "very fast idiot" The processor is the "brain" of the computer system. It does all the hard work and calculations etc. It can do billions of these calucaltions per second! A computer is able to process huge amounts of data (number crunching) very fast, but it can't think for itself - it can only do what we tell it to do. There is a saying in Computer Science: "Garbage in, garbage out!" Inside The Processor The processor is made up of a number of very important parts as follows: The Control Unit This is the nerve centre of the computer. It controls the sequencing of all operations both within the CPU and in connection with INPUT, OUTPUT and BACKING STORAGE devices. The ALU (Arithmetic & Logic Unit) The two main functions of the ALU are: 1. To carry out the arithmetic required by the system (ADD, SUBTRACT, DIVIDE and so on). 2. To perform certain 'logical operations'. e.g. To test if one data item is larger than another and then to perform some action depending on the result of this test. Registers Registers are temporary memory locations within the processor itself used to hold data being processed. Because they are inside the processor, they are very fast to access. 15

Memory There are two types of memory: RAM and ROM. Random Access Memory (RAM) RAM is for storing user's programs and data while they work. The contents of RAM are temporary - it's contents may be changed. The contents of RAM are lost when the computer is switched off. Adding more RAM allows the user to run programs at the same time without slowing the machine down. Read Only Memory (ROM) The contents of ROM are permanent - it's contents cannot be changed. The contents of ROM are not lost when the computer is switched off. Data stored in ROM loads much faster than RAM. Memory Addresses When the processor fetches instructions and data from the memory it must know where to find them. In a single RAM module there may be millions of memory locations each one containing a program instruction or item of data. In order to find each memory location they are all numbered. Each memory location has it's own unique address. The processor uses the addresses to select the location which contains the program instruction or data to process next. The concept of memory locations, each with its own unique address is called addressability. 16

Buses Moving Data Between Processor and Memory Data and instructions have to be transferred backwards and forwards between memory and the processor and this is done by buses. A bus is an electronic highway used to transmit binary patterns. There are three buses: the address bus which is used by the processor to pinpoint the memory location needed. This is a one-way (uni-directional) bus. the data bus which is used to transfer the data. It's size will usually match the word size i.e. the size of the memory locations. This is a two-way (bi-directional) bus. the control bus which is used to initiate and control what is happening. Memory Read 1. The address bus is used to select the address of the desired memory location. 2. The control bus sends a signal to activate the transfer. 3. The data in the selected location is sent along the data bus to the processor. Memory Write 1. The address bus is used to select the desired memory location. 2. The control bus sends a signal to activate the transfer. 3. The data is sent along the data bus to the selected memory location. 17

Interfaces Data exchange with peripherals So far we have looked at the internal parts of a typical computer system. But what about the peripheral devices we connect our computers to? How do these extra pieces of hardware connect to our systems? Peripheral devices connect to computer systems via slots on the back of the computer. Such devices include printers, scanners, digital cameras, digital video recorders, mice, keyboards, mp3 players etc. They also include storage devices such as disk drives. Each device has its own operational speed, uses its own language and deals with different amounts of data at a time. Interfaces In order for peripheral devices to communicate with the CPU they need to be interfaced. An interface is a unit that sits between the CPU and a peripheral device and compensates for the differences in speed, codes and other characteristics, to ensure compatibility. Basic functions of an interface Control Signals. Transmit and receive signals to/from the CPU in order to synchronise the movement of data in an organised manner. Input/Output. Transfer data between the computer itself and the external device. Data Conversion. Convert data to/from the format understood by the peripheral to the format understood by the processor. The main task of an interface is to transfer data so that the processor is delayed as little as possible and therefore system performance does not suffer unnecessarily. 18