300 likes | 833 Views
CSNB374: Microprocessor Systems. Chapter 1: Introduction to Microprocessor. Microprocessor-based Computer System. A computer system consists of the following components: Microprocessor (CPU) Memory system I/O system These three components are interconnected by busses.
E N D
CSNB374: Microprocessor Systems Chapter 1: Introduction to Microprocessor
Microprocessor-based Computer System • A computer system consists of the following components: • Microprocessor (CPU) • Memory system • I/O system • These three components are interconnected by busses. • This architecture applies to any computer system, from the earlier mainframe computers to the latest systems.
The Microprocessor (CPU) • The controlling element (the brain) of the a computer system. • Controls memory and I/O by executing program stored in memory. • A program is a series of instruction. • Instruction is in machine language – string of 0’s and 1’s. • The set of instructions used by a CPU is called the instruction set – unique for each CPU type.
The Microprocessor (CPU) • Two main components of a CPU: • Execution Unit (EU) • The purpose is to execute instructions • Contains the arithmetic logic unit (ALU) • Data for operation by ALU are stored registers • Bus Interface Unit (BIU) • The purpose is to facilitate communication between the EU and the memory or I/O. • Responsible for transmitting address, data and control signals on the busses.
Memory System • The location where the information processed by the memory is stored. • Each location in memory contains an 8-bit data (8 bits = 1 byte). • The data stored in a memory byte are called contents. • Each memory byte is accessed using an address. • Specified using a hex number.
Memory System • Two bytes of data form a word (16 bits). • A pair of successive memory bytes can be treated as a single unit called a memory word. • Accessed using the lower address of the two memory bytes. • Intel processors store the least significant byte in the lower memory address (little endian). • Data size can also be in doubleword (32 bits).
I/O System • A computer communicates with the outside world through I/O devices. • I/O devices are connected to the computer through I/O circuits. • I/O circuits contains several registers called I/O ports. • Some ports are used for data while others are used for control commands. • I/O ports are accessed using I/O addresses (similar to memory addresses).
Busses • A common group of wires that interconnect components in a computer system. • Three types of busses: address, data and control. • An operation may require data to be transmitted on all the three busses. Example: memory read. • CPU places address of memory location on address bus. • Control signal tells the memory to perform a read. • Data is received from memory on data bus.
Busses • The size of the address bus determines the maximum memory size that can be supported. • 32-bit systems has 32 pins for the address. • Can support a maximum of 4GB of memory. • The size of the data bus determines how much data can be transferred at a time. • Many new microprocessors has 64-bit extensions. • They have 64-bit data bus. • But the address bus is still less than 64-bit.
Number Systems • Use of microprocessor requires the working knowledge of number systems. • Binary, decimal, hexadecimal. • Decimal numbers: • Base (radix) 10 • Contains 10 different digits: 0 to 9 • The one we use in everyday life • Binary numbers: • Base (radix) 2 • Contains only 2 different digits: 0 and 1 • The number representation used in digital circuits
Number Systems • Hexadecimal numbers: • Base (radix) 16 • Contains 16 different digits: 0 to 9, A to F • Normally written with ‘0x’ in front or with an ‘H’ at the back. Example: • 91B716 = 0x91B7 = 91B7H • Used as a compact way to represent binary numbers
Number System Conversions • Binary to decimal (example): • 10012 = (1x23) + (0x22) + (0x21) + (1x20) = 8 + 0 + 0 + 1 = 910 • Hexadecimal to decimal (example): • 610A16 = (6x163) + (1x162) + (0x161) + (10x160) = 24576 + 256 + 0 + 10 = 2484210
Number System Conversions • Decimal to binary (example): Convert 4310 to binary. 43 / 2 = 21 remainder 1 21 / 2 = 10 remainder 1 10 / 2 = 5 remainder 0 5 / 2 = 2 remainder 1 2 / 2 = 1 remainder 0 1 / 2 = 0 remainder 1 Therefore, 4310 = 1010112
Number System Conversions • Decimal to hexadecimal (example): Convert 42510 to hexadecimal. 425 / 16 = 26 remainder 9 26 / 16 = 1 remainder 10 (A) 1 / 16 = 0 remainder 1 Therefore, 42510 = 1A916
Conversion Involving Fractional Numbers • Binary to decimal (example): • 0.0112 = (0x2-1) + (1x2-2) + (1x2-3) = 0 + 0.25 + 0.125 = 0.37510 • 10.112 = (1x21)+(0x20)+(1x2-1)+(1x2-2) = 2 + 0 + 0.5 + 0.25 = 2.7510 • Hexadecimal to decimal (example): • 0.A816 = (10x16-1) + (8x16-2) = 0.625 + 0.03125 = 0.6562510
Conversion Involving Fractional Numbers • Decimal to binary (example): Convert 0.37510 to binary. 0.375 x 2 = 0.75 0 0.75 x 2 = 1.5 1 0.5 x 2 = 1.0 1 0 x 2 = 0 Therefore, 0.37510 = 0.0112
Conversion Involving Fractional Numbers • Decimal to hexadecimal (example): Convert 0.120849610 to hexadecimal. 0.1208496 x 16 = 1.9335938 1 0.9335938 x 16 = 14.9375 E 0.9375 x 16 = 15.0 F 0 x 16 = 0 Therefore, 0.120849610 = 0.1EF16
Binary-coded Hexadecimal • Refers to the use of binary to represent a hexadecimal number. • Example:
Binary and Hexadecimal Arithmetic • In general, addition and subtraction in other number systems are performed in a similar way to addition and subtraction in decimal. • However, there is a minor difference. • Addition: • Digit position can only contain the maximum digit permitted by the number system. • If addition of two digits result in a number higher than the maximum digit, there will be a carry. • Subtraction: • When a borrow is performed, the borrowed value will be the value of the number system’s radix.
Unsigned and Signed Integers • Unsigned integers can only represent positive numbers. • If the hardware can store 8-bits, the integer that can be stored ranges from 0 to 255. • Signed integers can represent both positive and negative numbers. • The value of the MSB tells whether the number is positive or negative. • If the hardware can store 8-bits, the integer that can be stored ranges from -128 to +127.
Unsigned and Signed Integers • In theory, there are three ways to represent negative integers in binary: • Using a sign bit • 1’s complement • 2’s complement • Example: Assuming an 8-bit hardware, represents -10 in binary. • Using a sign bit: 10001010 • 1’s complement: 11110101 • 2’s complement: 11110101 + 1 = 11110110
Unsigned and Signed Integers • In all microprocessor systems, signed integers are represented using 2’s complement. • Advantage of 2’s complement: • Subtraction can be performed using addition. • Simplifies the ALU circuitry. • Example: • 2010– 1010 = 2010 + (-1010) = 000101002 + 111101102 =000010102
Floating Point Numbers • Representing a number as an integer that has certain number of bits can seriously limit the values that can be represented. • What if we want to represent a very large number? Or a number with decimal point? • Floating point number refers to a way to represent real numbers which supports a wide range of values. • Format: • M x 10E • M – mantissa / significand / fraction • E – exponent
Floating Point Numbers • Example: Representing a very large number. • 5500000000000000000 = 55 x 1017 • Example: Representing a number with decimal point. • 2.934 = 2934 x 10-3 • Single-precision floating point number has 32 bits. • Double-precision floating point number has 64 bits.
Floating Point Numbers • Single precision floating point number format • Double precision floating point number format