290 likes | 424 Views
phones off (please). CTEC1414 Lecture 2. Hardware 2 Basic Architecture Dr John Cowell. Overview. Representing data bits, bytes, words, prefixes binary, hex, ASCII, floating point Von Neumann architecture processor: ALU and CU RAM and ROM FPU Processor types CISC and RISC examples
E N D
phones off(please) CTEC1414Lecture 2 Hardware 2 Basic Architecture Dr John Cowell
Overview • Representing data • bits, bytes, words, prefixes • binary, hex, ASCII, floating point • Von Neumann architecture • processor: ALU and CU • RAM and ROM • FPU • Processor types • CISC and RISC • examples • dedicated CTEC1414-2
Terminology • Computers work in binary • bit • binary digit, ‘0’ or ‘1’ • easy to represent as magnetic fields, light/electrical pulses, etc. • byte • a group of 8 bits • n.b. nibble = 4 bits (a small byte!) • word • a group of bits that can be manipulated by the processor as a single unit • almost always it is a whole number of 8-bit bytes • e.g. 32 bit processor has a word length of 32 bits CTEC1414-2
Prefixes • Dealing with single bytes is clumsy • memory capacities are currently in billions of bytes • disk capacities are in billions or trillions of bytes • Prefixes • Kb = Kilobyte = 1024 bytes = 1024 8 bits = 210 • approximately one thousand • Mb = Megabyte = 1024 Kb = (1024)2 bytes = 220 • approximately one million • Gb = Gigabyte = 1024 Mb = (1024)3 bytes = 230 • approximately one billion • Tb = Terabyte = 1024 Gb = (1024)4 bytes = 240 • approximately one trillion (thousand-billion) • Pb = Petabyte = 1024 Tb = (1024)5 bytes = 250 • approximately one thousand trillion CTEC1414-2
Number Bases • Computers use base 2 - binary • humans don’t! • humans use base 10, 12, 60, etc. • binary is difficult (for humans) to read and understand • Base 16 (hexadecimal) and base 8 (octal) are used as they are easier for us • they are used as a shorthand for binary • both of these are easy to convert to and from binary • octal is not used very much anymore • Note: the base is also known as the radix CTEC1414-2
0 = 0 1000 = 8 1 = 1 1001 = 9 10 = 2 1010 = 10 11 = 3 1011 = 11 100 = 4 1100 = 12 101 = 5 1101 = 13 110 = 6 1110 = 14 111 = 7 1111 = 15 Binary System • Counting in binary • uses powers of 2, i.e. • 20 = 1 • 21 = 2 • 22 = 4 • 23 = 8 • 24 = 16 • 25 = 32 • 26 = 64 • 27 = 128 CTEC1414-2
0 = 0 8 = 8 1 = 1 9 = 9 2 = 2 A = 10 3 = 3 B = 11 4 = 4 C = 12 5 = 5 D = 13 6 = 6 E = 14 7 = 7 F = 15 Hexadecimal • Uses characters 0 - 9, then A - F for numbers 10 to 15 • uses powers of 16: • 160 = 1 • 161 = 16 • 162 = 256 • 163 = 4,096 • 164 = 65,536 • 165 = 1,048,576 CTEC1414-2
The ASCII Code Set • If computers only work in binary, how do they represent letters and other characters? • a coding scheme was invented • American Standard Code for Information Interchange • characters are represented as values from 0 to 127 • this value range can be converted to 7 digit binary codes • Most modern representation of characters use ASCII as their base. • 0 to 31 are used for control codes, e.g. CR = 13 • ‘A’ is 65 (1000001) • ‘a’ is 97 (1100001) • ‘1’ is 49 (0110001) • The modern approach is to use a Unicode or ISO standard. For representing any character. CTEC1414-2
Unicode standards • The Unicode Consortium- non profit making organisation made up of company experts. • Unicode – a standard for expressing text. • Covers 93 scripts (arabic, amharic, kanji etc...) • > 109,000 characters. • Latin Script encodings include: • UTF-8 — an 8-bit variable-width encoding which maximizes compatibility with ASCII. • UTF-EBCDIC — an 8-bit variable-width encoding, which maximizes compatibility with EBCDIC. (not part of The Unicode Standard) • UTF-16 — a 16-bit, variable-width encoding • UTF-32 — a 32-bit, fixed-width encoding CTEC1414-2
Real Numbers • If computers only work in binary, how do they represent real numbers? • the truth is they don’t. • again, a special coding scheme was invented to represent numbers such as • 3.141592654, 2.9979 108, 6.626 10-34 • A number is split into two parts • one part describes the number itself (the mantissa) • another describes where the decimal point appears (the exponent) • Again, different coding schemes are possible • fortunately, the ANSI/IEEE 754 is almost universal now CTEC1414-2
Von Neumann Architecture • John von Neumann was a mathematician who co-authored a report in 1946 on computer construction • The main principles were • information is stored on a slow-to-access storage medium (hard disk) • stored as numerical binary digits • information can be interpreted as either instructions or data • worked on in a fast-access, volatile memory (RAM) • each cell in memory has a unique numerical address • a processor manipulates the data according to pre-specified (built-in) operations CTEC1414-2
Instructions and Data • A program comprises instructions (machine code) and data • an instruction has several components: • function code, operand address(es) • is one of several types: • arithmetic / logic operation, control transfer, load / store • input / output, memory reference, processor reference • An instruction is brought from the RAM to the processor and is executed • data may be altered as a result • A new instruction is made ready for execution CTEC1414-2
Machine Code • Computers only understand instructions written in machine code. • Every type of processor understands different machine code. • Application software called a compiler translate a program written in a high level language such as C++, C#, Visual Basic etc... Into machine code • Programs written in different languages can be converted into the same machine language. CTEC1414-2
Recall - CPU Components (micro-) processor CPU control unit arithmetic & logic unit Input Devices RAM Output Devices Communication Devices Backing Storage notice that all information enters and leaves the CPU via the RAM CTEC1414-2
Processor • The ‘brain’ or ‘heart’ of a computer which • interfaces with main memory • controls each operation through the control unit • performs arithmetic and logical comparison operations in the arithmetic / logic unit • The processor contains several registers and buffers for temporary storage to hold • the instruction that is currently being executed • data that is currently being operated on CTEC1414-2
Control Unit • Controls or manages the operations of the processor, including • transmission of program from backing storage to RAM • activation of input / output devices • Fetches the current instruction from memory • Interprets or decodes the instruction • loads any data required into internal register(s) • Determines the address (memory location) of the next instruction to be executed • controls the sequencing of instructions CTEC1414-2
Arithmetic Logic Unit • Carries out operations on data • data can be processed arithmetically • added, subtracted, multiplied, divided, etc. • data can be logically compared • greater than, less than, equal to, etc. • Operations are carried out on data held in temporary storage registers • Results are stored in special accumulator register(s) • Most ALU’s deal with fairly simple operations on integer (whole) binary data CTEC1414-2
RAM and ROM • There are two types of main (primary) memory • RAM and ROM • Random Access Memory • temporary (volatile) storage of instructions and data • all input / output passes through the main system RAM • peripheral device interface cards, e.g. graphics and sound, may have their own RAM on board • Read Only Memory • ‘permanent’ (non-volatile) storage • retains contents when power is turned off • stores firmware that controls the system (e.g. BIOS - Basic Input/Output System) CTEC1414-2
Floating Point Unit • Most modern processors include a third sub-component, the floating point unit (FPU) • used to be held on a separate chip • known as a maths co-processor, e.g. 80387, 80487, etc. • embedded in Pentium and subsequent processors • A FPU specialises in floating point maths • operations such as add, subtract, multiply, divide work directly on floating point numbers • built-in functions such as sin(), log(), etc. • less instructions and faster than conventional ALU CTEC1414-2
Processor Types • There are many different manufacturers of microprocessors, often incompatible • Intel • 8080, 8088, 80186, 80286, 80386, 80486 • Pentium, etc. • AMD • make Intel compatible processors for PCs • Motorola • 68xxx family • used in Apples • IBM, Zilog, Cyrix (owned by VIA) • specialist companies making dedicated processors CTEC1414-2
CISC • It was originally assumed that in order to make a microprocessor better (quicker, more powerful), it was necessary to add more and more instructions • Complex Instruction Set Computer • A CISC microprocessor has a large instruction set, with many complex instructions • Intel • Pentium CTEC1414-2
RISC • Most programs only use a few instructions • optimise the processor for these ‘key’ instructions • Reduced Instruction Set Computer • RISC • very fast, due to fewer instructions • less transistors, so simpler & cheaper to manufacture • but, software has to work harder to make up the ‘missing’ instructions • examples • DEC alpha AXP, Sun (Ultra)Sparc, Motorola 60x, IBM RISC6000 CTEC1414-2
Dual and Quad Core • Intel & AMD have abandoned development of ever faster processors • Both companies have adopted dual or quad core processor architecture • Two, four or eight microprocessor cores are created on a single chip • The cores share • internal memory (cache) • the connection to the rest of the computer CTEC1414-2
Balanced Cores • The work of the cores needs to be carefully balanced • for energy and processing efficiency • The picture is from http://www.intel.com/technology/computing/dual-core/ • It shows an Intel Pentium Extreme Processor CTEC1414-2
Dedicated • Also known as single use systems • Processors designed to perform a specific task • Found in • many household appliances • cars, watches, cameras, etc. • digital signal processing • graphics, sound, etc. • Network switches, e.g. Cyrix • Also widely used in industry in control systems CTEC1414-2
Summary • Representing data • bits, bytes, words, prefixes • binary, hex, ASCII, floating point • Von Neumann architecture • processor: ALU and CU • RAM and ROM • FPU • Processor types • CISC and RISC • Examples • Dual Core • dedicated CTEC1414-2