Title: COMPUTING (Higher)
1COMPUTING(Higher)
- Unit 1
- Computer Systems
- Topic 1 Data Representation
2DATA REPRESENTATIONSystems Booklet - Pages 3-9
- Computers can store three main types of data
- Numbers,
- Text
- Graphics.
-
- These types of data require to be manipulated by
computers and as such, they must be represented
in a form the computer can understand and use. -
- Computers ability to perform very complex
calculations at high speeds remains one of their
main uses.
3- Text processing is also a major function of
computers. From the storage of vast quantities of
names and addresses in large databases to using a
word-processor, text handling is of vital
importance to todays computers. -
- Storage of graphics has more recently become
important because of the widespread use of
desktop publishing and computer-aided design. -
- All of this information is translated into
numbers for storage within the computer.
4Bit, Byte and Word
- A bit is a binary digit. A binary digit can be
either a 1 (one) or a 0 (zero). - A byte is a group of 8 bits.
- A word is a group of bits that can be addressed,
transferred and manipulated in one operation by
the CPU. Computers typically work with 32 bit or
64 bit words. - For example, a computer with a 32 bit word size
would be able to store 32 bits in each memory
location.
5(No Transcript)
6Representing text
- Text is found in many different types of data
files in word-processing files, database files,
graphics files and spreadsheet files. - Text is represented by a binary code. There are
2 codes commonly used to represent text. - One is called UNICODE
- The other is ASCII code. ASCII stands for
A merican S tandard C ode for I
nformation I nterchange
7Character sets
- The character set of a computer is the complete
set of characters that the computer can produce.
- It includes all the letters of the alphabet (both
upper case and lower case), the digits 0 to 9,
punctuation marks, special symbols such as , ,
and control characters. -
- Keys such as RETURN, TAB and DELETE that control
a particular function are known as control
characters.
8- In the ASCII code, an 8 bit binary number
represents each character in the character set.
This allows 128 different characters / symbols to
be represented. - .
- Whenever a key is pressed on the keyboard, the
system recognises the key and stores its ASCII
code value. - The table below shows a few of the ASCII code
values.
9- Here is a word translated into the ASCII code
This pattern of 4 x 8-bit binary codes is what
would be stored in memory to represent the word
FACE.
10Unicode
- Unicode exists because of the need to represent
non-Latin characters in computers e.g. Japanese
and Chinese - Its characters are encoded using 16 bits. This
allows it to represent up to 65,536 symbols. - Many packages, including Microsoft Office store
documents in Unicode.
11ASCII v UNICODE
- Unicode has a much wider range of characters
available compared to ASCII - 65,536 v 256
- ASCII normally takes up less memory.
- Unicode is designed to be used for languages
other than Latin type languages. - Unicode is an accepted world standard, used by
most major computer manufacturers / software
companies.
12Representing numbers
- In everyday life, we use the decimal number
system for counting. This is made up of the
digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and builds up
in units of ten 10, 20, 30, 40 and so on. -
- The columns used in the decimal system are those
we are familiar with from our days in the primary
school - Thousands Hundreds Tens Units
-
and so on
13- The decimal number 4738 means
In other words, 4738 4 x 1000 7 x 100 3
x 10 8 x 1 The column headings used in the
decimal system are used because they are the
powers of 10. To get the next column heading as
we go from right to left, we multiply the
previous column heading by 10.
14- Computers use the much simpler binary number
system. In the binary system, all numbers are
made up of combinations of the digits 0 and 1. -
- Binary numbers work in a similar way to the
decimal system. - Instead of being based on powers of 10, the
binary system is based on powers of 2. -
- To get the next column heading as we go from
right to left, we multiply the previous column
heading by 2. - The column headings are
15- Consider the binary number 1001. To work out the
decimal equivalent of this number, place the
binary digits under the correct column heading
working from right to left.
In other words, the binary number 1001 is the
same as the decimal number 9.
16- Consider a second example the binary number
10101
In other words, the binary number 10101 is the
same as the decimal number 21.
17- If larger numbers are required, additional binary
columns must be used - remember to work from
right to left. The table below shows the first
eight binary columns.
128
64
32
16
8
4
2
Units
7
6
5
4
3
2
1
0
2
2
2
2
2
2
2
2
We can use this table to find the binary
equivalent of the decimal number 69.
18Why computers use binary
- Binary is used in computers because
-
- Computers use switches, and switches are
set ON and OFF This matches the binary values of
1 and 0. - The rules of binary arithmetic are simple.
(Compare the number of rules for addition of
binary (4) with addition of Decimal (100)) - With only 2 states existing for any piece
of information, electrical variations are less
important. (E.G. Something and Nothing) - The problem with this is that the larger a number
is the more binary columns it needs and the
more binary columns it needs, the more storage
space it takes up in memory.
19Representation of Negative Integers
- The representation of negative integers (whole
numbers) in a computer is a complex problem.
There are two main methods of representing
integers so that both positive and negative
numbers can be shown. These are called -
- Signed Bit and
- Twos Complement
-
- The simplest method is Signed Bit (also called
sign and magnitude).
20Signed Bit
- This method makes use of 1 bit (Most Significant
Bit) to represent the signed bit. (Magnitude) The
sign bit is -
- 1 for negative and
- 0 for positive.
-
- The rest of the digits show the magnitude of the
number. For example, to show both 5 and -5 as
8-bit binary numbers using this method - - 5 0000 0101
- -5 1000 0101
- In each case the left-most bit is the sign bit,
the other seven digits represent the value 5.
21Twos Complement
- The second method of representing negative
numbers is twos complement. To calculate twos
complement of an integer involves inverting
(reversing) all the bits of the binary pattern
(to find the ones complement) then adding 1. -
- For example, to find the twos complement of the
number - 0101
22Rules for binary addition
- There are only four rules required for adding
binary numbers. These are shown below -
- 000
- 101
- 011
- 110 (with a carry of 1)
23- Invert all the digits to find the ones
complement - 0101 1010
- Then add 1 1010 1011
-
- Using twos complement the sign bit is
-
- 1 for negative and
- 0 for positive.
-
- Using the same examples as before,, 5 and -5 in
8-bit notation would be shown as -
- 5 0000 0101
- -5 1111 1011
-
- Note that positive numbers are the same using
signed bit or twos complement method but
NEGATIVE NUMBERS are different.
24Which One Is Best?
- The signed bit method is not used very often as
it has two main disadvantages - - Signed bit has 2 values for zero, 0 and 0
- Signed bit does not always give a logical
sequence of numbers when adding 1 to a number. - (E.g. O1117,
- 1000 -0)
25Fractions In Binary
- A fixed-point number is a number that is
represented by a set of digits with the point in
the correct position. - E.g.
- 146.98 is a fixed point decimal number.
- 11101.101 is a fixed point binary number.
-
- The binary digits after the point (Fractions) are
calculated using the same method as integers. In
this case the digits after the point represent
1/2 1/4 1/8 1/16 etc. -
- E.G. What value does 101.101 have in decimal?
26- E.G. What value does 101.101 have in decimal?
(14)(11)(11/2)(11/8) 5 5/8 (or 5.625)
27Floating Point Representation
- Computers have to store real numbers. (i.e.
numbers with a decimal point) - These numbers are stored in FLOATING POINT
FORMAT. So called, as the point floats (changes)
position in the number. - This is shown using the formula
28- For example, a decimal number such as 987654321
would be stored as - 0.987654321 x 109.
-
- 0. 987654321 is the MANTISSA
- 10 is the BASE and
- 9 is the EXPONENT.
-
- In a computer, binary numbers are used. A binary
stored in floating point form might be - .11010110 10010100 x 2 11110110
29Remember !!!
30Quick Revision on Sizes
- Remember that
- Bit smallest unit (1 or 0)
- Byte 8 Bits
- Kilobyte(Kb) 1024 Bytes
- Megabyte(Mb) 1024 Kb
- Gigabyte(Gb) 1024 Mb
- Terabyte (Tb) 1024 Gb
31Representing Graphics
- Graphics are made up of pixels.
- A pixel (or picture element) is a point on the
screen.
The quality of a graphical image depends on the
number of pixels used to produce the screen
display.
The greater the number of pixels, the clearer the
image will be.
The term resolution is used to measure the number
of pixels on a screen. The higher the
resolution, the clearer and more precisely
defined the image is.
32Bit Mapped Graphics
- In a black and white system, a single bit (a 1 or
a 0) is used to represent each pixel. - If the pixel is shaded, a 1 represents it
- if the pixel is blank, a 0 represents it.
It is easy to see how the pixels can be
translated into the pattern of binary numbers on
the left.
33- This pattern of binary numbers is called a bit
map. Each bit that is used to represent a
graphical image must be stored in the computers
memory. -
- The higher the resolution, the more bits are used
to encode the graphic and the more memory space
is needed. - When colour is introduced, the memory
requirements to store the details of each pixel
must be increased. For example, two bits can
store four colours - 00 Black
- 01 Red
- 10 Yellow
- 11 White
- Similarly, eight bits (1 Byte) can store 256
colours, with 24 bits (3 bytes) allowing 16777216
colours (Known as true colour).
34Calculating Bit Mapped Storage Requirements
- To do this we need to know the
- size of the image,
- resolution and
- bit depth.
- E.g. Size usually inches e.g. 6 x 4
- Resolution say 500 dpi (pixels per inch)
- Bit Depth e.g. 1 byte for 256 colours
35Data Compression
- As we have just seen, Bit-mapped images can need
a lot of storage. - A colour bitmapped image with a high resolution
and 24 bit colour needs over 50Mb for a smallish
photo. - To combat this, File Compression is used to
reduce storage requirements. - There are many Different techniques, including
coding using an index of colours actually used
(Lossless Compression) and not coding differences
indistinguishable to the human eye (Lossy
Compression).
36JPEG Compression
- uses Lossy compression
- Uses complex mathematical encoding
- Loses some information that our eyes and brain
usually ignore - The higher the compression ratio the worse the
resulting image is
37JPEG Compression
? Saved using lowest compression ratio File size
1Mb
Saved using highest compression ratio ?
File size 94Kb
38Vector (Object Oriented) Graphics
- In draw packages (Object Oriented packages),
objects are stored with their attributes. This
means the computer is aware of the type of the
shape being displayed and is therefore able to
resize it more accurately For example, when a
rectangle is drawn, the package stores -
- Rectangle (StartX, StartY, Length, Breadth,
Line Thickness, Fill Colour, Pen Colour...)
39- Other examples could include
-
- Circle (CentreX, CentreY, Radius, Line
- Thickness, Fill Colour, Pen Colour ...)
-
- Line (StartX, StartY, EndX, EndY, Line
Thickness, Line Colour ...) -
- Text (StartX, StartY, font, size, style,
characters, ...)
40Bit Mapped V Vector Graphics
41Bit Mapped V Vector Graphics
- VECTOR GRAPHICS
- ADVANTAGES
- Objects can be edited independently of the other
objects. - Less Storage space required than for the same
image in bit-mapped form. - Objects can be layered, without affecting other
objects. - Objects are easier to draw.
- Not resolution dependent.
- DISADVANTAGES
- Can only use mathematically defined shapes.
- Not as detailed images as bit mapped.
42- BIT MAPPED GRAPHICS
- ADVANTAGES
- Better quality pictures.
- Allows freehand drawing
- DISADVANTAGES
-
- Resolution dependent.
- More Storage space required than for the same
image in Vector form. (Saves full screen at all
times) - When one part of image is placed on top of
another (layering), the part of the image being
covered is deleted. (Single dimension image) - No resizing of individual objects permitted.
43COMPUTING(Higher)
- Unit 1
- Computer Systems
- Topic 1 Data Representation
44CATEGORIES OFCOMPUTERS Systems Booklet - Pages
10-12
- Computers are normally classified into these
categories
- Mainframe - A high-level computer designed for
the most intensive computational tasks. - Desktop Computer - Sometimes known as a personal
computer, this is a compact system that can fit
on your desk at home, work, or school. - Laptop Computer A computer system designed to
be portable, but can still as powerful as desktop
systems.
45- Palmtop Computer A pocket sized computer, tend
to run applications that are useful to
individuals, eg diary, address book, calculator,
etc. - Embedded Computer Hardware and software to do a
specific function, e.g. in a washing machine.
Always part of a larger system, and works in
real-time - Networked Computer - A computer (usually a micro)
that has access to a network. Networked computers
have their own processor and memory and have
access to a file server for programs and data.
There are 2 main types of network - Local Area Networks (LAN) and
- Wide Area Networks (WAN).
Desktop, Laptop, Palmtop and Networked Computers
can be classified as types of microcomputers.
46Processing Power
- The clock speed of the processor is the main
indicator of the power of the processor. - It is measured in MHz (Megahertz) or GHz
(Gigahertz). - 1 Megahertz is one million clock pulses per
second. - 1 Gigahertz is one thousand million clock pulses
per second
47Computer Organisation Systems Booklet - Pages
14-18
- Figure 1 Computer Block Diagram 1
PROCESSOR
OUTPUT
INPUT
MEMORY
BACKING STORE
48 49- Figure 2 Computer Block Diagram 2
PROCESSOR
INPUT
OUTPUT
MEMORY
BACKING STORE
50Computer Memory
- Two types of internal (immediate access) memory
exist - RAM
- ROM.
51RAM Random Access Memory
- Random Access Memory is the working area of the
computer and is used to store programs and data
currently being used. - Has same access time for all locations.
- Volatile loses contents on power off.
- There are2 types of RAM (Static and Dynamic)
- Static holds contents as long as there is power.
- Dynamic has to be refreshed (every 2 ms).
Each memory location has a unique address.
52ROM Read Only Memory
- ROM is a permanent area of storage for data and
programs. These chips are 'hard-wired' and cannot
be altered by software.
- Contents are permanent or non-volatile.
- Software data fixed into ROM at manufacture.
- Operating systems and specialised ROMs (e.g.
cameras and CD players etc.)
53Programmable Read Only Memory (PROM) Sometimes
special ROMs are provided for the user to
program. This process requires a special hardware
device and is called 'blowing' since each bit is
a fusible link that becomes zero when destroyed.
Such devices are called PROMs and the process is
irreversible. Erasable Programmable Read Only
Memory (EPROMS) These also exist, where the
user can use Ultra Violet light to erase a ROM
for reprogramming.
54External Memory
- External memory, such as the hard disk, holds
quantities of data too large to store in main
memory. - It is also used to keep a permanent copy of
programs and data. - Examples of external memory devices are
- hard disk
- floppy disk
- zip disk
- CD-R
- magnetic tape
- flash drive.
55Buses
What is a Bus? A bus is a group of parallel
wires, along which data can pass in the form of
electrical signals. The width of the bus
determines the amount of data it can handle at
any given time. What does a Bus do? Buses are
used to connect computer components together.
Buses can be internal, e.g. between the CPU and
registers, and external, e.g. between the
computer and other peripherals (printers, etc.).
Buses can be dedicated to one task, or may carry
data for many different tasks. Buses may also be
BI-DIRECTIONAL or UNIDIRECTIONAL.
56PROCESSOR
address bus
data bus
control bus
MEMORY
57- DIFFERENT TYPES OF BUSES.
- The main buses we will look at are the
- Data Bus
- Address Bus
- Control Bus
- The DATA BUS
- This is a bi-directional bus that carries data
between the processor and memory. All the data
is in binary. The width of it will match the size
of a memory location
58The ADDRESS BUS This is a unidirectional bus
which carries the addresses of the locations
where data and instructions can either be found
or stored. Each memory location has a unique
identifier (address) so that the processor can
locate it. Therefore, the width of the Address
bus relates directly to the number of possible
memory locations within memory (RAM and ROM).
59Therefore
- Maximum Addressable Memory
- 2 Width of the address bus x Width of the data bus
60For Example If a system has a 16-line address
bus and a 32-bit data bus then the possible
memory locations (addresses) in that computer are
216 (65536). Note this is just the number of
locations, the amount of memory needs the data
bus width as well!! Why 216? Computers work in
base 2, so each line can be either 1 or 0 at any
given time. This allows for 216 possible
combinations of 1 and 0. We then multiply the
total number of addresses by the width of the
data bus 216 x 32 2097152 bits /8 /1024
256KB
61- The CONTROL BUS
- This is a bus in name only. It is, in fact a
collection of lines that are unrelated, and each
one carries out a different task. The common
lines in the control bus are the - Read Line - Initiates a memory read operation
(after the address bus is set up) - Write Line - Initiates a memory write operation
(after the address bus, and data bus is set up) - Reset Line - Clears all registers and starts the
execution of instructions from a predefined
location (similar to switch the computer off and
on)
62- Interrupt Line - cause the processor to stop what
is doing, save its current state, and then
service the interrupt. Once completed, it will
return the computer to its previous state. - E.g. Paper Jam in printer, inform user). The
processor can be set to ignore these. - Non-Maskable Interrupt Line - As above, but
cannot be ignored by the processor. E.g. Power
failure imminent. - Clock - Send a regular sequence of pulses, which
are used to synchronise the processor. These
are counted in MHz (million cycles per second.)
Many processor events are timed to take 1 clock
cycle, but more complex instructions may take 2
or 4 clock cycles to perform.
63STRUCTURE OF THE CPU Systems Booklet - Page 17
- A more detailed look at the Processor (CPU) shows
three main components
- Arithmetic and Logic Unit,
- Control Unit,
- Registers.
These are connected to the rest of the computer
via the buses discussed earlier.
64- The Arithmetic Logic Unit (ALU)
-
- This is a key part of the processor
- It is where data is processed and manipulated.
- It performs arithmetic functions such as add and
subtract, and logical operations such as AND, OR
and NOT. -
The Control Unit The function of a processor is
to fetch instructions from memory and carry them
out. The Control Unit performs this function by
fetching, interpreting, and executing each
instruction in turn. It sends out control signals
controlling the operation of all hardware,
including I/O devices, and the CPU.
65Computer Memory
- The Registers
-
- The processor requires fast access to temporary
storage locations for use when setting up buses
and fetching instructions therefore special
areas called registers exist within the processor
itself. The types and number of registers vary
greatly from processor to processor but there are
certain features common to all of them. (see
page 17) - Two registers that we will look at are
- Memory Address Register (MAR)
- Memory Data Register (MDR)
66- MEMORY - READING AND WRITING
- The basic operations involving the Address and
Data buses are - Read from Memory
- Write to Memory
- READ From Memory -
- Instructions are fetched, or data is read
- Processor (CPU) sets up the Address lines with
the required address (location) - Processor (CPU) activates read line on Control
bus. - Memory releases data (instructions) onto the Data
bus.
67WRITE to Memory Data is written to memory
- Processor (CPU) sets up Address lines with the
required address (location) - Processor (CPU) sets up the Data lines with the
data to be written. - Processor (CPU) activates write line on Control
bus. - Data is written from the Data bus to the Memory
location.
68Stored Program Concept
To run a program, the computer must first load
the program from backing storage into RAM, where
it is stored until required by the processor.
This is called the Stored Program Concept. The
program loaded may contain hundreds of thousands,
or even millions of instructions, but the
processor can only execute one at a time.
Therefore, it
69- Fetches the instructions one at a time from
memory (RAM), - Places them into the processor,
- Decodes them, and
- Executes them.
This cycle is repeated for every instruction.
This process is called the FETCH EXECUTE
CYCLE.
70The FETCH EXECUTE CYCLE
71Measures of Processor Speed
- When we measure performance we usually mean how
fast the computer carries out instructions.
There are many different ways of measuring
performance, the main ones are - Clock Speed
- Generally the faster the clock speed the faster
the processor 3.2 GHz is faster than 933 MHz.
(more details later.) - Mips Millions of Instructions per Second
- Better comparison but beware of false claims e.g.
only using the simplest fastest instructions
and different processor families. - Flops Floating Point Operations per sec.
- Best measure as FP operations are in every
processor and provide best basis. - Benchmark Tests
- Well defined standardised routine to test the
performance of a computer. - Dhrystone tests string and frequently used
functions - Whetstone test using arithmetic functions
72- Memory and System Performance
-
- A common way of increasing system performance is
to increase the amount of memory in the computer,
but - Word size,
- Speed of access, and
- Cache memory
- Can also all affect system performance.
73Cache Memory
- This is a section of memory between the processor
and the main memory, or the processor and disks,
with a very fast access time. This means it
takes less time to fetch information stored here.
74Clock Speed
- Every processor has a clock which ticks
continuously at a regular rate. - This Synchronises all the components.
- Cycle time measured in MHz or GHz
- 200 MHz (megahertz) means the clock ticks
200,000,000 times a second (P1 -1995) - 1.4 GHz (gigahertz) is 1,400,000,000 times a
second (P4 2001) - 2.3 4 GHz (Dual/ Multi Core)
75Bus Widths and System Performance
- The width of the data bus defines how much data
can be accessed in one FETCH. (i.e. speed of
access) -
- A computer with a 32-bit data bus will be
distinctly faster than one with a 16-bit data bus - BUT
- (because factors other than the width of the bus
have to be taken into consideration) it will not
be twice as fast. - Most modern processors are 64 bit but some are
now 128 bit.