SG 1: FIT1001 Computer Systems S1 2006 1 Important Notice for Lecturers This file is provided as an...
-
Upload
garey-carson -
Category
Documents
-
view
215 -
download
0
Transcript of SG 1: FIT1001 Computer Systems S1 2006 1 Important Notice for Lecturers This file is provided as an...
SG 1: FIT1001 Computer Systems S1 2006 1
Important Notice for Lecturers
• This file is provided as an example only• Lecturers are expected to modify / enhance slides to
suit their teaching style • Lecturers are expected to cover the topics presented
in these slides• Lecturers can export slides to another format if it
suits their teaching style (but must cover the topics indicated in the slides)
• This file should not be used AS PROVIDED – you should modify it to suit your own needs!
• This slide should be deleted from this presentation• Provided by the FIT1001 SIG
www.monash.edu.au
www.monash.edu.au
FIT1001- Computer Systems
Lecture 1
Introduction to Computer Systems
SG 1: FIT1001 Computer Systems S1 2006 4
Lecture 1: Learning Objectives• Use and understand a vocabulary of terms associated with computers;• List and describe the components of a general purpose computer system,
including CPU, memory and Input-Output devices;• Appreciate the rough time line and history of the development of the digital
computer; • Understand the components of the basic von Neumann model of a
computer system and the important issues in its operation;• Appreciate a view of the underlying silicon components that encompasses
several layers of abstraction as an aid to understanding the hardware/software operation of the system as a whole;
• Understand the importance of various numbering systems to a study of digital computer systems;
• Describe the methods used for data conversion between major number systems, decimal, binary and hexadecimal;
• Demonstrate decimal, binary and hexadecimal conversions.
SG 1: FIT1001 Computer Systems S1 2006 5
Introduction
• Why study computer organization and architecture?
– Design better programs, including system software such as compilers, operating systems, and device drivers
– Optimize program behavior– Evaluate (benchmark) computer system performance– Understand time, space, and price tradeoffs
SG 1: FIT1001 Computer Systems S1 2006 6
Introduction
• Computer organization– Encompasses all physical aspects of computer systems
> E.g., circuit design, control signals, memory types
• Computer architecture– Logical aspects of system implementation as seen by the
programmer> E.g., instruction sets, instruction formats, data types, addressing modes
SG 1: FIT1001 Computer Systems S1 2006 7
Introduction – Basic Definitions
• A COMPUTER is a programmable machine• A PROGRAM is a collection or controlled
sequence of instructions– The sequence of instructions is governed by algorithms
• An ALGORITHM is a finite number of steps that define how to perform a task
• SOFTWARE is the collective name given to these programs
• HARDWARE represents all the physical components upon which a program is executed
• PROGRAM EXECUTION involves the processing of instructions of a program by the machine
SG 1: FIT1001 Computer Systems S1 2006 8
Components of a Computer
• There is no clear distinction between matters related to computer organization and matters relevant to computer architecture
– Execution of nested algorithms
• Principle of Equivalence of Hardware and Software– “Anything that can be done with software can also be done
with hardware, and anything that can be done with hardware can also be done with software”
> This principle assumes that speed is not a concern / hardware implementations are almost always faster
SG 1: FIT1001 Computer Systems S1 2006 9
Components of a Computer
• At the most basic level a computer is a device consisting of three pieces:
– A processor to interpret and execute programs
– A memory to store both data and programs
– A mechanism for transferring data to and from the outside world
SG 1: FIT1001 Computer Systems S1 2006 10
Components of a Computer – An Example
• Consider the following advertisement
MHz??
MB??
PCI?? USB??
L1 Cache??
GB??
SG 1: FIT1001 Computer Systems S1 2006 11
Measurement Terminology
• Important to define the measurement terminology you will encounter
– Usually measure how big or fast something is
• In terms of size – Use terminology such as thousands, millions, billions or
trillions of characters
• In computing the powers of 2 are often more important than powers of 10
– Kilo- (K)……………. 1 thousand = 103 ≈ 210 (1024)
– Mega- (M)…………. 1 million = 106 ≈ 220 (1,048,576)
– Giga- (G)……......... 1 billion = 109 ≈ 230 (1,073,741,824)
– Tera- (T)…….......... 1 trillion = 1012 ≈ 240 (1,099,511,627,776)
– Peta- (P)………….. 1 quadrillion = 1015 ≈ 250 (1.12589991 × 1015)
SG 1: FIT1001 Computer Systems S1 2006 12
Measurement Terminology
> Whether a metric refers to a power of ten or a power of two typically depends upon what is being measured
– E.g., 1 kilobyte (1KB) of memory is 1,024 bytes and not 1,000– E.g., 1 gigabyte (1GB) hard disk might be 1 billion bytes and not 230
• What is a byte?– A contiguous sequence of a fixed number of bits
> A bit refers to a digit in the binary number system (0 or 1)
– A byte is now standardized at 8 bits > E.g., 1 kilobyte (1KB) of memory is 1,024 bytes = 8,192 bits
> E.g., 1 gigabyte (1GB) hard disk is 230 bytes = 8,589,934,592 bits
– Much easier to use terms designated with prefix notation
SG 1: FIT1001 Computer Systems S1 2006 13
Measurement Terminology
• In terms of speed – Use terminology such as thousandths, millionths, billionths or
trillionths> Milli- (m)……. 1 thousandth = 10 -3 ≈ 2-10 (Hard disk access)
> Micro- ()…... 1 millionth = 10 -6 ≈ 2-20 (Main memory access)
> Nano- (n)....... 1 billionth = 10 -9 ≈ 2-30 (Circuit speed)
> Pico- (p)........ 1 trillionth = 10 -12 ≈ 2-40
> Femto- (f)….. 1 quadrillionth = 10 -15 ≈ 2-50
– Note the fractional prefixes have exponents that are reciprocal of the size exponents
> An operation may take one microsecond to complete therefore a million of those operations could take place during one second
SG 1: FIT1001 Computer Systems S1 2006 14
Measurement Terminology
• Microprocessor speeds– Processor speeds are measure in hertz
> One hertz simply means one per second
– Until recently processor speeds were measured in Mhz> 1MHz = 1,000,000Hz
– Processor speeds are now expressed in Ghz> 1GHz = 1,000,000,000Hz
– All computer systems contain a system clock which emits an electrical pulse to all main components
> Synchronizes the system to
> Number of pulses emitted per second is known as the frequency– Measured in hertz
SG 1: FIT1001 Computer Systems S1 2006 15
Components of a Computer – An Example
• 667MHz – 667 million cycles per second• A system bus are wires that connect all parts of
the system
A system bus moves data within the computer. The faster the bus the better. This one runs at 133MHz.
The microprocessor is the “brain” of the system. It executes program instructions. This one is a Pentium III (Intel) running at 667MHz.
SG 1: FIT1001 Computer Systems S1 2006 16
Components of a Computer – An Example
• RAM is an acronym for random access memory• Cache is a type of temporary memory which is
faster than RAM
… and two levels of cache memory, the level 1 (L1) cache is smaller and faster than the L2 cache. Note that these cache sizes are measured in KB.
This system has 64MB of (fast) synchronous dynamic RAM (SDRAM) . . .
SG 1: FIT1001 Computer Systems S1 2006 17
Components of a Computer – An Example
• Hard disk capacity determines the amount of data and programs that can be stored
This hard disk can store 30GB. 7200 RPM is the rotational speed of the disk. Generally, the faster a disk rotates, the faster it can deliver data to RAM. (There are many other factors involved.)
A CD-ROM can store about 650MB of data, making it an ideal medium for distribution of commercial software packages. 48x describes its speed. DVD technology has virtually superseded CD technology in terms of data storage and distribution.
EIDE stands for enhanced integrated drive electronics, which describes how the hard disk interfaces with (or connects to) other system components.
SG 1: FIT1001 Computer Systems S1 2006 18
Components of a Computer – An Example
• Ports allow movement of data between a systems and its external devices
This system has four ports.
SG 1: FIT1001 Computer Systems S1 2006 19
Components of a Computer – An Example
• Dot pitch of a monitor tells us how clear the image is
• The number of times per second that the image on the monitor is repainted is its refresh rate
This monitor has a dot pitch of 0.24mm and a refresh rate of 85Hz.
The graphics card contains additional memory and supports the system in generating screen graphics.
SG 1: FIT1001 Computer Systems S1 2006 20
Components of a Computer – An Example
• System buses can be augmented by dedicated I/O buses
• PCI (Peripheral Component Interface), is one such bus
This system has two PCI devices: a sound card, and a modem for connecting to the Internet.
www.monash.edu.au
Standards and Organizations
SG 1: FIT1001 Computer Systems S1 2006 22
Standards and Organizations
• From the preceding computer example we can draw two questions:
– What assurance do we have that computer components will operate as we expect?
– What assurance do we have that computer components will operate together?
• There are many organizations that set computer hardware standards
• Throughout this unit, your studies and in your career you will encounter many of them
SG 1: FIT1001 Computer Systems S1 2006 23
Standards and Organizations
• Important standards-setting groups are:– The Institute of Electrical and Electronic Engineers (IEEE)
> Promotes the interests of the worldwide electrical engineering community
> Establishes standards for computer components, data representation, and signaling protocols, among many other things
– The International Telecommunications Union (ITU)> Concerns itself with the interoperability of telecommunications
systems, including data communications and telephony
– National groups establish standards within their respective countries:
> The American National Standards Institute (ANSI)
> The British Standards Institution (BSI)
SG 1: FIT1001 Computer Systems S1 2006 24
Standards and Organizations
• The International Organization for Standardization (ISO)
– Establishes worldwide standards for everything from screw threads to photographic film
– Co-ordinates worldwide standards development– Is influential in formulating standards for computer hardware
and software, including their methods of manufacture
• Note: ISO is not an acronym– ISO comes from the Greek, isos, meaning “equal.”
www.monash.edu.au
Historical Development of Computers
SG 1: FIT1001 Computer Systems S1 2006 26
Historical Development
• To fully appreciate the computers of today, it is helpful to understand how things got the way they are
• The evolution of computing machinery has taken place over several centuries
• In modern times computer evolution is usually classified into four / five generations according to the salient technology of the era
– The exact starting and ending dates of each epoch are still debated today
SG 1: FIT1001 Computer Systems S1 2006 27
Historical Development
• Generation Zero: Mechanical Calculating Machines (1642 - 1945)
– Early 17th century – John Napier (died 1617)> Mechanise the multiplication table / logarithms
– Approx 1617: Wilhelm Schickard > The Calculating Clock – the beginning of mechanical calculators
– 1642: Blaise Pascal > Pascaline adding machine
– Gottfried Wilhelm von Leibniz (1646 – 1716)> Differential calculus
> First to study binary arithmetic at any length
> More complicated adding machine were developed
SG 1: FIT1001 Computer Systems S1 2006 28
Historical Development
– Charles Babbage (1791 – 1871)> Difference Engine (1822) – used the method of differences
technique
> Analytical Engine (1833) – Died before it could be built– Included many components associated with modern computers
» Mill – an arithmetic processing unit» Store – a type of memory» Input and output devices (input via punched cards)
– 1833 – Ada (wrote notes, translated)» Bernoulli numbers – first computer program
– Jospeh-Marie Jacquard (1752 – 1834)> 1801 – created a programmable weaving loom that used
punched cards
SG 1: FIT1001 Computer Systems S1 2006 29
Historical Development
– 1800’s George Boole> Mathematical logic
> Boolean algebra
– 1890: Herman Hollerith> Created an Electrical Tabulating Machine for Unites States
census
> Used punch cards mechanism
> 10 times faster tabulating results
> 1911 merged companies into the Computing-Tabulating-Company
> 1924 – changed name to International Business Machines (IBM)
SG 1: FIT1001 Computer Systems S1 2006 30
Historical Development
• The First Generation: Vacuum Tube Computers (1945 - 1953)
– Atanasoff Berry Computer (ABC) is credited as the first completely electronic computer
> Built to solve systems of linear equations (so not a general purpose computer)
> Constructed using vacuum tubes
– Electronic Numerical Integrator andComputer (ENIAC)
> John Mauchly and J. Presper Eckert
> Introduced to the public in 1946
> 17,468 vacuum tubes / 1,800 square feet / 30 tons
> Memory capacity of 1,000 bits
> Used punched cards
SG 1: FIT1001 Computer Systems S1 2006 31
Historical Development
• The Second Generation: Transistorized Computers (1954 - 1965)
– Transistors – integrated into computers– 1960: DEC’s PDP-1 (image below right)– IBM 7094 (scientific) and 1401 (business)– Move from machine language to assembly language– Development of high level languages– FORTRAN (1954) / COBOL (1959)
SG 1: FIT1001 Computer Systems S1 2006 32
Historical Development
• The Third Generation: Integrated Circuit Computers (1965 - 1980)
– Integrated circuits (ICs) – electronic circuit on a silicon chip– 1965: DEC’s PDP-8 (minicomputer revolution)– IBM System/360 (below left)
> First family of machines
> First multi programmable machines
– Cray-1 supercomputer(far right)
SG 1: FIT1001 Computer Systems S1 2006 33
Historical Development
• The Fourth Generation: VLSI Computers (1970 - present)
– Very large scale integrated circuits (VLSI) have more than 10,000 components per chip
– General purpose processor on a chip - microprocessors– 1971: Intel 4004 - general purpose calculators – 1972: 8008 / 1974 – 8080– 1974: Mark 8 (computer based on 8008)– 1975: Altair (microcomputer revolution)
> Spawned hacking clubs– Bill Gates / Steve Allen– Steve Wozniak / Steve Jobs
SG 1: FIT1001 Computer Systems S1 2006 34
Historical Development
– Introduction of personal computers> Apple I (1976) / Apple II (1977) - 6502 processor
> IBM-PC XT (1981) - 8088 processor
> Apple Macintosh (1984) - 68000 processor – the GUI
• The Fifth Generation: (future)– Technologies still in development / research
> AI (artificial intelligence)
> Quantum computing
> Nanotechnology
> Natural language
SG 1: FIT1001 Computer Systems S1 2006 35
Historical Development
• Moore’s Law (1965)– Gordon Moore, Intel founder
> “The density of transistors in an integrated circuit will double every year.”
– Contemporary version:> “The density of silicon chips doubles every 18 months.”
– Computers will eventually need to find a different technology
• Rock’s Law – Arthur Rock, Intel financier
> “The cost of capital equipment to build semiconductors will double every four years.”
– In 1968, a new chip plant cost about $12,000– In 2003, a chip plants construction was over $2.5 billion
www.monash.edu.au
Layered Architecture
SG 1: FIT1001 Computer Systems S1 2006 37
Layered Architecture
• A digital computer is a very complex device– Mixture of both hardware and software components
• Computers are capable of solving a wide range of problems
– Must be able to execute programs written in different programming languages
– Writing complex programs requires a “divide and conquer” approach, where each program module solves a smaller problem
• Computer system organization can use a similar approach
– Principle of abstraction – hierarchy of levels or layers– Each level represents a more abstract and less detailed view
of layers beneath
SG 1: FIT1001 Computer Systems S1 2006 38
Layered Architecture
• Each virtual machine layer is an abstraction of the level below it
• The machines at each level execute their own particular instructions, calling upon machines at lower levels to perform tasks as required
• Computer circuits ultimately carry out the work
SG 1: FIT1001 Computer Systems S1 2006 39
Layered Architecture
• Level 6: The User Level– Program execution and user interface level– The level with which we are most familiar
• Level 5: High-Level Language Level– The level with which we interact when we write programs in
languages such as C, Pascal, Lisp, and Java
• Level 4: Assembly Language Level– Acts upon assembly language produced from Level 5– Acts upon instructions programmed directly at this level
• Level 3: System Software Level– Controls executing processes on the system– Protects system resources– Assembly language instructions often pass through Level 3
without modification
SG 1: FIT1001 Computer Systems S1 2006 40
Layered Architecture
• Level 2: Machine Level– Also known as the Instruction Set Architecture (ISA) Level– Consists of instructions that are particular to the architecture
of the machine– Programs written in machine language need no compilers,
interpreters, or assemblers
• Level 1: Control Level– A control unit decodes and executes instructions and moves
data through the system– Control units can be microprogrammed or hardwired – A microprogram is a program written in a low-level language
that is implemented by the hardware– Hardwired control units consist of hardware that directly
executes machine instructions
SG 1: FIT1001 Computer Systems S1 2006 41
Layered Architecture
• Level 0: Digital Logic Level– This level is where we find digital circuits (the chips)– Digital circuits consist of gates and wires– These components implement the mathematical logic of all
other levels– Can abstract the pure physical layer from this level
> Physical layer involves the construction of logic gates
www.monash.edu.au
Model of Computer Structures
SG 1: FIT1001 Computer Systems S1 2006 43
Model of Computer Structure
• On the ENIAC, all programming was done at the digital logic level
• Programming the computer involved moving plugs and wires
• Mauchley and Eckert – Conceived of a computer that
could store instructions in memory - EDVAC
• John von Neumann– Mathematician– Involved in the EDVAC project– Wrote the “First Draft of a Report on the EDVAC”– Stored-program computers have become known as von
Neumann Architecture
SG 1: FIT1001 Computer Systems S1 2006 44
Model of Computer Structure
• Today’s stored-program computers have the following characteristics:
– Three hardware systems: > A central processing unit (CPU)
> A main memory system
> An I/O system
– The capacity to carry out sequential instruction processing– A single data path between the CPU and main memory
> This single path is known as the von Neumann bottleneck
SG 1: FIT1001 Computer Systems S1 2006 45
Model of Computer Structure
• The image below is a general depiction of a von Neumann system
• These computers employ a fetch-decode-execute cycle to run programs
SG 1: FIT1001 Computer Systems S1 2006 46
Model of Computer Structure
• The control unit fetches the next instruction from memory using the program counter to determine where the instruction is located
SG 1: FIT1001 Computer Systems S1 2006 47
Model of Computer Structure
• The instruction is decoded into a language that the ALU can understand
SG 1: FIT1001 Computer Systems S1 2006 48
Model of Computer Structure
• Any data operands required to execute the instruction are fetched from memory and placed into registers within the CPU
SG 1: FIT1001 Computer Systems S1 2006 49
Model of Computer Structure
• The ALU executes the instruction and places results in registers or memory
SG 1: FIT1001 Computer Systems S1 2006 50
Model of Computer Structure
• Conventional stored-program computers have undergone many incremental improvements over the years
– Programs and data can be stored in secondary storage devices, such as hard disks
> Programs and data can be transferred to RAM
– Additional improvements include adding specialized buses, floating-point units, and cache memories etc
• But enormous improvements in computational power require departure from the classic von Neumann architecture
– Adding processors / parallel processing
SG 1: FIT1001 Computer Systems S1 2006 51
Model of Computer Structure
• Late 1960s– High-performance computer systems were equipped with
dual processors to increase computational throughput
• 1970s – Supercomputer systems were introduced with 32 processors
• 1980s– Supercomputers with 1,000 processors were built
• 1999– IBM announced its Blue Gene system containing over 1
million processors
• 2005– Dual core processors
SG 1: FIT1001 Computer Systems S1 2006 52
Model of Computer Structure
• Parallel processing is only one method of providing increased computational power
• More radical systems have reinvented the fundamental concepts of computation
– These advanced systems include genetic computers, quantum computers, and dataflow systems
• At this point, it is unclear whether any of these systems will provide the basis for the next generation of computers
www.monash.edu.au
Analog vs. DigitalRepresentation
SG 1: FIT1001 Computer Systems S1 2006 54
Analog vs. Digital
• Data – the information that is transmitted – Transmitted as an electrical voltage – A signal carried on a communication channel
– Data is represented by changes in signal as a function of time
– Can be analog or digital transmission> Can be represented as waveforms
SG 1: FIT1001 Computer Systems S1 2006 55
Analog vs. Digital
• Analog– The signal takes on a continuous range of values
• Digital– The signal takes on a discrete range of values
SG 1: FIT1001 Computer Systems S1 2006 56
Analog vs. Digital
• Computer data is digital in nature– A digital waveform may represent a sequence of bits of data
on a bus line
• It is often desirable to be able to convert a digital signal to some equivalent analog representation or vice versa
– E.g., analog sound is stored digitally on a compact disc – E.g., to transmit computer data on an ordinary voice-grade
phone line requires that the computer data must be represented by an analog signal
– The transformation between digital and analog should be reversible
SG 1: FIT1001 Computer Systems S1 2006 57
Analog vs. Digital
• Both digital and analog are subject to:– Noise: interference / static that affects the integrity of a signal – Attenuation: a reduction of signal strength during
transmission – Distortion: An undesired change in the waveform of a signal – It is often necessary to provide compensation in the form of
error correction
• During analog to digital conversion– Small amount of information is lost during transformation– Is not possible to recover the original analog waveform
exactly– The errors can be reduced to the point that it doesn’t matter
SG 1: FIT1001 Computer Systems S1 2006 58
Analog vs. Digital
• To convert analog data to digital– Analog waveform is sampled at regular time intervals – The maximum possible amplitude of the waveform is divided
into intervals corresponding to a range of binary numbers
– Sampled values are each converted into their corresponding number value
– The devices that perform conversions are called:> A-to-D converter (analog to digital)
> D-to-A converter (digital to analog)
www.monash.edu.au
Number Systems
SG 1: FIT1001 Computer Systems S1 2006 60
Number Systems
• Computers use the binary number system– 0 or 1 (a bit)– 8 bits = 1 byte
> A byte is the smallest possible addressable unit of computer storage
> The term, “addressable,” means that a particular byte can be retrieved according to its location in memory
– A group of four bits is called a nibble (or nybble)> Bytes, therefore, consist of two nibbles: a “high-order nibble,”
and a “low-order” nibble
– A word is a contiguous group of bytes> Words can be any number of bits or bytes
> Word sizes of 16, 32, or 64 bits are most common
> In a word-addressable system, a word is the smallest addressable unit of storage
SG 1: FIT1001 Computer Systems S1 2006 61
Number Systems
• Bytes store numbers when the position of each bit represents a power of 2
– The binary system is also called the base-2 system
• Humans use the decimal number system– The decimal system is the base-10 system– Base-10 uses powers of 10 for each position in a number
• Any integer quantity can be represented exactly using any base (or radix)
– The decimal number 947 in powers of 10: > 9 102 + 4 101 + 7 100
– The decimal number 5836.47 in powers of 10:> 5 103 + 8 102 + 3 101 + 6 100 + 4 10-1 + 7 10-2
SG 1: FIT1001 Computer Systems S1 2006 62
Number Systems
– The binary number 11001 in powers of 2 is:> 1 24 + 1 23 + 0 22 + 0 21 + 1 20
– = 16 + 8 + 0 + 0 + 1 = 25
– Important powers of 2 that you should remember:> 20 = 1 21 = 2 22 = 4 23 = 8 > 24 = 16 25 = 32 26 = 64 27 = 128 28 = 256
• When the radix of a number is something other than 10, the base is denoted by a subscript
– Sometimes, the subscript 10 is added for emphasis:> 110012 = 2510
> If a radix is not indicated assume that it is in base-10
> All other bases should be clearly marked or indicated
SG 1: FIT1001 Computer Systems S1 2006 63
Number Systems
• Two other important radices are:– The octal (base 8) number system uses 8 symbols 0, 1, 2, 3,
4, 5, 6, and 7 to denote values from 0 to 7 (8 - 1)– The hexadecimal (base 16) number system uses 16 symbols
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F to denote values from 0 to 15 (16 - 1), so F equates to 1510
– Octal is not used much anymore– Hexadecimal is commonly used as it can represent a
shorthand version binary numbers
• So it is important that you become proficient with base-2 and base-16 radix systems
– Enable you to understand the operation of all computer components as well as the design of instruction set architectures
SG 1: FIT1001 Computer Systems S1 2006 64
Decimal Number System
• The decimal (base 10) number system uses 10 symbols
– 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 to denote values from 0 to 9 (10 - 1)
• A simple algorithm which will give us the successive digits of a decimal integer X:
– Start from the right hand end:> Repeatedly
– Get the remainder from dividing X by 10– Divide X by 10
> until X is zero (the quotient = 0)
SG 1: FIT1001 Computer Systems S1 2006 65
Decimal Number System
– E.g., if X is 4792:> 4792 / 10 = Quotient 479 Remainder 2
> 479 / 10 = Quotient 47 Remainder 9
> 47 / 10 = Quotient 4 Remainder 7
> 4 / 10 = Quotient 0 Remainder 4
– The digits 2, 9, 7, 4 have been generated, from right to left, in succession
• A simple algorithm which will give us the successive digits of a decimal fraction X:
– Repeatedly, > Multiply X by 10;
> Remove the digit on the left on the decimal point until 0.0
– Note: we now generate the digits from left to right (not right to left)
SG 1: FIT1001 Computer Systems S1 2006 66
Decimal Number System
– E.g., if X is 0.5803 (and that we want the first five digits)> 0.5803 * 10 = 5.803 (Remove the digit 5)
> 0.803 * 10 = 8.03 (Remove the digit 8)
> 0.03 * 10 = 0.3 (Remove the digit 0)
> 0.3 * 10 = 3.0 (Remove the digit 3)
> 0.0 * 10 = 0.0 (Remove the digit 0)
– We have obtained five successive digits 5, 8, 0, 3, 0.
• Scientific Notation– Many simple ‘rational fractions’ have non-terminating
(repeating) decimal expansions:> 82 / 3 = 27.33333 33333 33333 33333 (approx)
SG 1: FIT1001 Computer Systems S1 2006 67
Decimal Number System
– Many numbers are irrational, i.e. cannot even be represented as rational fractions:
> = 3.1415 92653 58979 32384 62643 (approx)
> 2 = 1.4142 13562 37309 50488 (approx)
– Some are very large and some very small> Avogadro’s constant is 602,252,000,000,000,000,000 (approx)
– (the number of molecules in 22.421 litres of gas at Normal temperature and pressure)
> The rest mass (weight) of an electron is0.000,000,000,000,000,000,000,000,000,000,910,91 Kg (approx)
– Difficult for humans immediately to comprehend the size of these very large and very small numbers
> Scientific notation– Represent numbers conveniently (often as an approximation)
SG 1: FIT1001 Computer Systems S1 2006 68
Decimal Number System
• Scientific notation– The standard form is d0.d1d2d3d4d5dx 10E
> E is an integer called the exponent
> E can be preceded with a minus sign
– Standards / common conventions> 1. Unless the number is zero, the digit d0 on the left of the
decimal point must be a non-zero digit, i.e. 1, 2, ..., 9.
> 2. There must be exactly one non-zero digit d0 before the decimal point
> These rules ensure that everybody will write numbers in the same way:
– 82 / 3 2.7333333333 101
3.141592 100
– Avogadro’s constant 6.02252 1023
– Electron mass 9.1091 10-31 Kg
SG 1: FIT1001 Computer Systems S1 2006 69
Binary Number System
• We have already seen: – The binary number 11001 in powers of 2 is:
> 1 24 + 1 23 + 0 22 + 0 21 + 1 20
– = 16 + 8 + 0 + 0 + 1 = 25
– The powers of 2 increase from right to left
• A simple algorithm which will give us the successive binary digits of a decimal integer X:
– Start from the right hand end:> Repeatedly
– Get the remainder from dividing X by 2– Divide X by 2
> until X is zero (the quotient = 0)
SG 1: FIT1001 Computer Systems S1 2006 70
Binary Number System
– E.g., if X is 4310 = 1010112 > 43 / 2 Quotient = 21 Remainder 1
> 21 / 2 Quotient = 10 Remainder 1
> 10 / 2 Quotient = 5 Remainder 0
> 5 / 2 Quotient = 2 Remainder 1
> 2 / 2 Quotient = 1 Remainder 0
> 1 / 2 Quotient = 0 Remainder 1
– The remainders in reverse order is the binary value
• As with decimal fractions binary fractions involve descending powers of 2
• A simple algorithm which will give us the successive binary digits of a decimal fraction X:
SG 1: FIT1001 Computer Systems S1 2006 71
Binary Number System
– Repeatedly, > Multiply X by 2;> Remove the digit on the left on the decimal point until 0.0
– E.g., if X is 0.67187510 > 0.671875 * 2 = 1.34375 (Remove the digit 1)> 0.34375 * 2 = 0.6875 (Remove the digit 0)> 0.6875 * 2 = 1.375 (Remove the digit 1)> 0.375 * 2 = 0.75 (Remove the digit 0)> 0.75 * 2 = 1.5 (Remove the digit 1)> 0.5 * 2 = 1.0 (Remove the digit 1)> 0.0 * 2 = 0.0 (Remove the digit 0)
– The order from top to bottom is the value after the radix point> We have obtained six successive digits .1010110
– For values such as 10.2310 apply relevant algorithms to each side
SG 1: FIT1001 Computer Systems S1 2006 72
Binary Number System
– E.g., if X is 0.710 > 0.7 * 2 = 1.4 (Remove the digit 1)
> 0.4 * 2 = 0.8 (Remove the digit 0)
> 0.8 * 2 = 1.6 (Remove the digit 1)
> 0.6 * 2 = 1.2 (Remove the digit 1)
> 0.2 * 2 = 0.4 (Remove the digit 0)
> 0.4 * 2 = 0.8 (Remove the digit 0)
> 0.8 * 2 = 1.6 (Remove the digit 1)
> 0.6 * 2 = 1.2 (Remove the digit 1)
> 0.2 * 2 = 0.4 (Remove the digit 0)
– Obvious that iterations 6 to 9 simply repeat iterations 2 to 5> Process would continue indefinitely
SG 1: FIT1001 Computer Systems S1 2006 73
Binary Number System
• A fraction that can be represented exactly in the decimal system may have a repeating representation in the binary system (but the converse is not true)
– Often introduce small round-off errors when storing fractional quantities
SG 1: FIT1001 Computer Systems S1 2006 74
Hexadecimal Number System
• The hexadecimal (base 16) number system uses 16 symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F to denote values from 0 to 15 (16 - 1), so F equates to 1510
– Useful shorthand for binary
– So 1552810 can be written as 3CA816
> 3CA816 = 3 * 163 + C * 162 + A * 161 + 8 * 160
> = 3 * 4096 + 12 * 256 + 10 * 16 + 8 * 1
> = 12288 + 3072 + 160 + 8
> = 1552810
> Again, powers of 16 increase from right to left
SG 1: FIT1001 Computer Systems S1 2006 75
Hexadecimal Number System
• A simple algorithm which will give us the successive hexadecimal digits of a decimal fraction X:
– Start from the right hand end:> Repeatedly
– Get the remainder from dividing X by 16– Divide X by 16
> until X is zero (the quotient = 0)
– E.g., if X is 1552810 > 15528 / 16 Quotient = 970 Remainder 8
> 970 / 16 Quotient = 60 Remainder 10 (A16)
> 60 / 16 Quotient = 3 Remainder 12 (C16)
> 3 / 16 Quotient = 0 Remainder 3
– The remainders in reverse order is the hexadecimal value
SG 1: FIT1001 Computer Systems S1 2006 76
Hexadecimal Number System
• A simple algorithm which will give us the successive hexadecimal digits of a decimal fraction X:
– Repeatedly, > Multiply X by 16;
> Remove the digit on the left on the decimal point until 0.0
– E.g., if X is 0.23710 > 0.237 * 16 = 3.792 (Remove the digit 3)
> 0.792 * 16 = 12.672 (Remove the digit 12 = C16)
> 0.672 * 16 = 10.752 (Remove the digit 10 = A16)
> 0.752 * 16 = 12.032 (Remove the digit 12 = C16)
> 0.032 * 16 = 0.512 (Remove the digit 0)
> 0.512 * 16 = 8.192 (Remove the digit 8)
> …………….
SG 1: FIT1001 Computer Systems S1 2006 77
Hexadecimal Number System
– On the way to generating a repeating hexadecimal fraction> The first remainder 0.792 is repeated on the 26th iteration
> W can say that 0.23710 0.3CAC0816
• It is easy to convert between base 16 and base 2– Because 16 = 24
– To convert from binary to hexadecimal> Group the binary digits into groups of four
– From right to left for integer portion / left to right for fraction portion – Important to pad out with 0’s (to avoid errors)
– Using groups of four, the binary number 110101000110112 (= 1359510) in hexadecimal is:
SG 1: FIT1001 Computer Systems S1 2006 78
Hexadecimal Number System
– Octal (base 8) values are derived from binary by using groups of three bits (8 = 23):
SG 1: FIT1001 Computer Systems S1 2006 79
Exercises to Work On
• Null and Lobur– Chapter 1, page 35
> Exercise questions 1,3 and 10
– Chapter 2, page 86 / 87> Exercise questions 1, 2 and 3 (a and b only of each question)
> Repeat question 1 – but convert to base-2 (a and b only)
> Repeat question 2 – but convert to base-16 (a and b only)
> Repeat question 3 – but convert to base-16 (a and b only)
SG 1: FIT1001 Computer Systems S1 2006 80
Next Week
• Study Guide 2– Data Representation and Computer Arithmetic