Princess Sumaya Univ. Computer Engineering Dept. Chapter 2:
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 1 / 18 Basic Computer Organization The 5 Classic Components of a Computer The Basic Hardware/Software Interface The Stored-Program Concept
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 2 / 18 Instructions Assembly Language Instruction: Perform:a = b + c ADDa, b, c; a b + c What are ‘a’, ‘b’ and ‘c’? ●The storage concept: ♦ Registers (R1, R2 …) ♦ Memory Sequence of Instructions: Perform: a = (b + c) – (d + e)
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 3 / 18 Memory Operands Data Transfer Instructions ●Memory Address (Location) ●Slower than registers ●Lower bandwidth than registers Load and Store Instructions Memory
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 4 / 18 Constant Operands Memory Operand Perform a = b + 4 Immediate Operand Memory b
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 5 / 18 Memory Access Height and Width 1 KB 4 KB Address & Data 16 Locations 1 K Locations 1 M Locations Read & Write Memory bit 1 KB
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 6 / 18 Stored Program Architecture Instructions (Program) Operands (Data) Memory 1024 x 32 OpcodeOperands Binary Operand
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 7 / 18 Memory Organization Byte Access Word Access 20 Byte 21 Byte 20 Byte Byte Byte Byte 24 Byte Byte Byte Byte 20 Byte Byte 22 Byte Byte
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 8 / 18 Memory Organization Mixed Access ●Little Endian ●Odd/Even Alignment 20 Byte Byte 22 Byte Byte DATABUS MSB LSB
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 9 / 18 Memory Organization Mixed Access ●Alignment! 20 Byte Byte Byte Byte 24 Byte Byte Byte Byte DATABUS MSB LSB
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 10 / 18 Instruction Representation Instruction Format Machine Language & Machine Code Sequence of instructions OpcodeOperands ADD R1, R2, F F Assembly Language Machine Language
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 11 / 18 Operations (Opcodes) Arithmetic ●Add, Sub, Mul, Div, Inc, Dec … Logic ●Shift ♦ Logical & Arithmetic ♦ Right & Left ●Bitwise AND, OR, XOR ●Complement (NOT)
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 12 / 18 Operations (Opcodes) Shift Operation for Multiplication ●Multiply by 2 ♦ Shift Left 1 bit ♦ Unsigned Binary ♦ 2’s Complement ●Multiply by 10 ♦ BCD ♦ Shift Left 4 bits
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 13 / 18 Control Instructions Making Decisions (Conditional Branches) Perform if (i == j) then a = b + c else a = b – c i == j ? a = b + ca = b – c
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 14 / 18 Control Instructions Transferring Execution ●Unconditional Branch or Jump ●Call Subroutine ●Software Interrupt
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 15 / 18 RISC & CISC Reduced Instruction Set Computer ●32-Bit Storage: ♦ Registers (R1, R2 … R31) ♦ Memory ●Arithmetic operations: ♦ Simple ♦ Limited to registers Complicated Instruction Set Computer ●IA-32
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 16 / 18 EAX Intel Architecture IA-32 General-Purpose Registers (GPRs) Segment Registers Segmented Memory Addressing (Real Mode) ALAX EAX AXAL EBX BXBL ECX CXCL EDX DXDL ESISI EDIDI “Base” “Count” CS SS DS “Division” “String Source” “String Destination” Also: “Accumulator”
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 17 / 18 Intel Architecture IA-32 Variable Length Instruction Format
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. 18 / 18 Intel Architecture IA-32 YearMicroprocessorAddress BitsData BitsTransistors , , /829, /8134, /16/8275, /16/81,200, Pentium3232/16/83,100, Pentium Pro3232/16/85,500, Pentium II3232/16/87,500, Pentium III3232/16/89,500, Pentium 43232/16/842,000, Pentium 4 EM64T6432/16/8125,000, Core 2 Quad6432/16/8820,000,000
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. Chapter 2
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. Chapter 2 Exercise 1 Write an assembly language program to perform a+2b where ‘a’ and ‘b’ are stored in R1 and R2. Write an assembly language program to swap two locations at memory addresses 10 and 20. Rewrite the following program to run faster: SUB R1, R1, R1 INC R1 ADD R2, R3, R1 A memory has 4 bits of address and 4 bits of data. Determine the total number of bits inside it.
Princess Sumaya University – Computer Arch. & Org. (1) Computer Engineering Dept. Chapter 2 Exercise 2 Determine the value of R1: LD R1, M [ 43 ] Write the assembly instruction at 44. Assuming 8-bit registers, determine the value of R1: Load Immediate R1, Binary ‘ ’ Arith Shift Right R1 Assuming i and j are integers, R1= i and R2 = j, write the C- language statement for: Compare R1, R2 Jump Equal Label_1 Clear R1 Label_1: Clear R Opcode Operand 1 Operand 2 Operand 3 Add (= B1)Reg (5 bits) Add (= B2)Reg (5 bits) Constant