













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of instruction execution, data types, instruction representation, and addressing modes in computer organization ii, taught by teemu kerola during the autumn 2010 semester. Topics include instruction execution, data types, instruction representation, and various addressing modes such as register, memory, and indexed addressing.
Typology: Lecture notes
1 / 21
This page cannot be seen from the preview
Don't miss anything!














Ch 10-11 [Sta10] Ā Operations Ā Operands Ā Operand references (osoitustavat) Ā Pentium / ARM
Lecture 6
Instruction cycle
diagram). The CPU repeats these phases
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 2
(Sta10 Fig 10.1)
Computer Instructions ( konekƤskyt )
Ā Set of instructions CPU āknowsā
Ā What does the instruction do?
Ā Where does the data come for the instruction?
Ā Implicit? Explicit?
Ā Memory-mapped I/O Ā I/O with memory reference operations
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 3
Covered on Comp. Org I
Access time? Access rate?
Instructions and data ( kƤskyt ja data )
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 4
instructions
data
address
value
Symbolic
name
(Sta10 Fig 11.13)
What kind of data?
Ā IRA (aka ASCII), EBCDIC
Ā N elements in sequence
 8 /16/32/ 64b, ⦠ Each type and size has its own operation code
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 7
IBM EAS/390 (Sta10 Table 10.5)
Instruction representation ( kƤskyformaatti )
Ā How many different instructions? Ā Maximum number of operands per instruction? Ā Operands in registers or in memory? Ā How many registers?
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 8
(Sta10 Table 10.1)
How many registers?
Ā Work data in registers
Ā Integers vs. floating points, indices vs. data, code vs. data Ā All sets can start register numbering from 0 Ā Opcode determines which set is used
Ā CPU allocates them internally
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 9
Architectures
Ā Accumulator-based architecture ( akkukone ) Ā Just one register, accumulator, implicit reference to it
Ā Stack-based ( pinokone) Ā Operands in stack, implicit reference Ā PUSH, POP
Ā Register-based ( yleisrekisterikone ) Ā All registers of the same size Ā Instructions have 2 or 3 operands
Ā Load/Store architecture Ā Only LOAD/STORE have memory refs Ā ALU-operations have 3 regs
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 10
See : Appendix 10A in Ch10 [Sta10]
Example: JVM
Ā 32b data can be loaded by one operation accessing the word address ( sanaosoite )
Ā For example, loading 32b unaligned data requires two loads from memory (word address) and combining it
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 13
load r1, 2(r4) shl r1, = load r2, 4(r4) shr r2, = or r1, r
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 14
Where are the operands?
Ā In the memory Ā Variable of the program, stack ( pino ), heap ( keko )
Ā In the registers Ā During the instruction execution, for speed
Ā Directly in the instruction Ā Small constant values
Ā How does CPU know the specific location? Ā Bits in the operation code Ā Several alternative addressing modes allowed
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 15
Addressing modes ( osoitusmuodot )
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 16
(Sta10 Fig 11.1)
Ā Example CurrIndex=i++;
Ā Example CurrIndex=--i;
Ā Example Sum = Sum + (*ptrX++);
Ā Example Double X; ā¦. X=Tbl[i];
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 19
EA = (R), R m (R) + S
EA = Mem(R), R m (R) + S
R m (R) - S, EA = (R)
operand size
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 20
Pentium: Registers
Ā EAX, EBX, ECX, EDX accu, base, count, data Ā ESI, EDI source & destination index Ā ESP, EBP stack pointer, base pointer
Ā AX, BX, CX, DX, SI, DI, SP, BP
Ā AH, AL, BH, BL, CH, CL, DH, DL
Ā CS, SS, DS, ES, FS, GS
Ā EIP Extended Instruction Pointer
Ā EFLAGS
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 21
(Sta10 Fig 12.3c)
x86: Data types
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 22
(Sta10Table 10.2)
Single / Double / Extended precision
Ā Not aligned Ā Little Endian
IEEE 754 standard
Pentium: Addressing modes (muistin osoitustavat)
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 25
(Sta10 Table 11.2)
1, 2, 4, 8B
Registers: 1, 2, 4, 8B
Operand = (R)
x86 Addressing
indexing arrays? arrays in stack? two dimensional arrays?
Pentium: Addressing Mode Calculation
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 26
(Sta10 Fig 11.2)
LA = (SR)+(I)*S+(B)+A
Discussion?
Pentium: Instruction format
Ā Complex Instruction Set Computer
Ā Part may be present or absent in the bit sequence Ā Prefix 0-4 bytes Ā Interpretation of the rest of the bit sequence depends on the content of the preceding fields
Ā At most one operand can be in the memory Ā 24 different
Ā OLD 16-bit 8086-programs must still work
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 27
only op-code always!
Pentium: Instruction format
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 28
(Sta10 Fig 11.9)
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 31
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 32
ARM: Instruction set (kƤskykanta)
Ā Reduced Instruction Set Computer
Ā All instructions have the condition code (4 bits)
Ā Instruction type (3 bit) and additional opcode /modifier (5 bit) Ā Easier hardware implementation, faster execution Ā Longer programs?
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 33
ARM Data Types
Ā 8 (byte), 16 (halfword), 32 (word) bits - word aligned
Ā Unsigned integer and twos-complement signed integer
Ā Majority of implementations do not provide floating-
Ā Little and Big Endian supported Ā Bit E in status register defines which is used
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 34
ARM Load/Store Multiple Addressing
Ā 16-bit instruction field specifies list of registers Ā Sequential range of memory addresses Ā Base register specifies main memory address
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 37
(Sta10 Fig 11.4)
ARM Instruction Formats
Ā S = For data processing instructions, updates condition codes Ā S = For load/store multiple instructions, execution restricted to supervisor mode Ā P, U, W = distinguish between different types of addressing mode Ā B = Unsigned byte (B==1) or word (B==0) access Ā L = For load/store instructions, Load (L==1) or Store (L==0) Ā L = For branch instructions, is return address stored in link register Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 38
(Sta10 Fig 11.10)
Discussion?
ARM Condition codes
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 39
(Sta10 Tbl 10.12)
RISC vs. CISC
Computer Organization II, Autumn 2010, Teemu Kerola 10.11.2010 40
HW (Pentium) SW (Crusoe)
Weāll return to this later (lecture 8)
easy to execute
HW
support high-level languages
difficult to execute
High-level programming language
High-level programming language
support high-level lang
difficult to execute
easy to execute
High-level programming language