Required:PM: Ch 8.1-3, pgs 109-114 Recommended:Wiki: Microarchitecture Wiki: Addressing_mode Wiki: Three-state logicWiki: Microarchitecture Wiki: Addressing_mode.

Slides:



Advertisements
Similar presentations
Required:PM: Ch 8.1-3, pgs Recommended:Wiki: Microarchitecture Wiki: Addressing_mode Wiki: Three-state logicWiki: Microarchitecture Wiki: Addressing_mode.
Advertisements

Machine cycle.
Microprocessors.
CS364 CH16 Control Unit Operation
S04: MSP430 Microarchitecture
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
Chapter 5 The LC-3.
Chapter 4 - ISA 1.The Von Neumann Model. 4-2 The Stored Program Computer 1943: ENIAC Presper Eckert and John Mauchly -- first general electronic computer.
LC-3 Computer LC-3 Instructions
S. Barua – CPSC 240 CHAPTER 5 THE LC-3 Topics Memory organization Registers Instruction set Opcodes.
Execution of an instruction
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Overview The von Neumann Machine - the programmable digital computer Introducing the LC-3 Computer - A “toy” computer for us to learn from Computer machine.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Chapter 4 The Von Neumann Model. BYU CS/ECEn 124Chapter 4 - The Von Neumann Model2 Concepts to Learn… Computer Architecture Von Neumann vs. Harvard MSP430.
LC-3 Instruction Set Architecture
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
1 Sec (2.3) Program Execution. 2 In the CPU we have CU and ALU, in CU there are two special purpose registers: 1. Instruction Register 2. Program Counter.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Chapter 6 – MSP430 Micro-Architecture. BYU CS/ECEn 124Chapter 6 - MSP430 Micro-Architecture2 Concepts to Learn… Computer Architecture MSP430 Micro-Architecture.
Chapter 6 – MSP430 Micro-Architecture
Part II: Addressing Modes
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4: IT Students.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4:
Basic Operational Concepts of a Computer
S03: Instruction Set Architecture
Memory and Addressing How and Where Information is Stored.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
CPU Design. Introduction – The CPU must perform three main tasks: Communication with memory – Fetching Instructions – Fetching and storing data Interpretation.
Today… Homework #4 due today. Lab 4 – Microarchitecture due Friday. microArch430.exe – Rev 2.1a Download from website Report any problems Questions? BYU.
Chapter 4 The Von Neumann Model
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Chapter 5 The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Data Movement Instructions Load --
Princess Sumaya Univ. Computer Engineering Dept. Chapter 5:
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA = All of the.
Execution of an instruction
COMPUTER ARCHITECURE INSTRUCTION SET ARCHITECTURE.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Lab 4: MSP430 Microarchitecture
Fetch-execute cycle.
CDA 3101 Fall 2013 Introduction to Computer Organization
Computer Architecture Lecture 03 Fasih ur Rehman.
Lecture 3 – MSP430 ISA The Instruction Set Reading: Chapter 5: Architecture of the MSP430 Processor.
8086 Internal Architecture
Four LEDs are connected to Port 4, bits 0 thru 3. Indicate which LEDs are ON/OFF after each instruction is executed. Quiz 4.1 mov.b#0x0f,&P4DIR 1.and.b#0xf0,&P4OUT.
CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000.
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
Computer Organization Instructions Language of The Computer (MIPS) 2.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Chapter 3 – Instruction Set Architecture. Instruction Length and Cycles.
CPE 323 Introduction to Embedded Computer Systems: The MSP430X Architecture Instructor: Dr Aleksandar Milenkovic.
BASIC COMPUTER ARCHITECTURE HOW COMPUTER SYSTEMS WORK.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final.
8085 Microprocessor Architecture
ECE 3430 – Intro to Microcomputer Systems
S04: MSP430 Microarchitecture
Quiz 4.1 Four LEDs are attached to Port 4, bits 0 thru 3. Indicate which LEDs are ON/OFF after each instruction is executed. P4.7 P4.6 P4.5 P4.4 P4.3.
Five Execution Steps Instruction Fetch
Microcomputer Programming
Computer Organization and Assembly Language (COAL)
The fetch-execute cycle
Number Representations and Basic Processor Architecture
Design of the Control Unit for One-cycle Instruction Execution
Topic 6 LC-3.
Computer Architecture and the Fetch-Execute Cycle
Computer Concept and Practice
A Top-Level View Of Computer Function And Interconnection
Presentation transcript:

Required:PM: Ch 8.1-3, pgs Recommended:Wiki: Microarchitecture Wiki: Addressing_mode Wiki: Three-state logicWiki: Microarchitecture Wiki: Addressing_mode Wiki: Three-state logic 2.2 Microarchitecture 2.2b – Instruction Phases

ISA2 Learning Objectives… After watching this video and studying the reading assignments, you should be able to: Describe computer instruction cycles. Explain the purpose of the fetch cycle. Understand the cycle relationship to addressing modes. Explain the difference between PC-relative and absolute addressing modes. BYU CS 124

Instruction Cycles

BYU CS 124 MSP430 Microarchitecture4 The Instruction Cycle INSTRUCTION FETCH Obtain the next instruction from memory DECODE Examine the instruction, and determine how to execute it SOURCE OPERAND FETCH Load source operand DESTINATION OPERAND FETCH Load destination operand EXECUTE Carry out the execution of the instruction STORE RESULT Store the result in the designated destination Not all instructions require all six phases Instruction Cycle

BYU CS 124 MSP430 Microarchitecture5 Fetching an Instruction   PC Fetch Cycle PC can be incremented anytime during the Fetch phase

BYU CS 124 MSP430 Microarchitecture6 Addressing Modes The MSP430 has four basic addressing modes: 00 = Rs - Register 01 = x(Rs) - Indexed Register 10 - Register Indirect (source only) 11 - Indirect Auto-increment (source only) When used in combination with registers R0-R3, three additional source addressing modes are available: label - PC Relative, x(PC) &label – Absolute, x(SR) #n – (source only) Addressing Modes

Addressing Mode Demo BYU CS 124 MSP430 Microarchitecture7 Addressing Modes.text start: add.wr4,r10; r4 += r10; add.w6(r4),r10; r10 += M[r4+6]; r10 += M[r4]; r10 += M[r4++]; add.wcnt,r10; r10 += cnt; add.w&cnt,r10; r10 += cnt; add.w#100,r10; r10 += 100; add.w#1,r10; r10++; pushcnt; M[--r1] = cnt; jmpstart cnt:.word 0x000a 8000: 540A 8002: 541A : 542A 8008: 543A 800a: 501A e: 521A 801e 8012: 503A : 531A 8018: c: 3ff1 801e: 000a

BYU CS 124 MSP430 Microarchitecture8 00 = Register Mode Addressing Modes Registers CPU Memory ADDER add.w r4,r10 ; r10 += r4 PC R10 R4 IR Data Bus (1 cycle) 0x540a PC ALU Address Bus +2

BYU CS 124 MSP430 Microarchitecture9 Source: Register Mode – Rs  Rs Evaluate Source Operand Select the source register

Memory BYU CS 124 MSP430 Microarchitecture10 01 = Indexed Mode Addressing Modes Registers Address Bus Data Bus (+1 cycle) CPU ADDER add.w 6(r4),r10 ; r10 += M[r4+6] 0x0006 PC R10 R4 IR Data Bus (1 cycle) 0x541a PC ALU Address Bus +2

BYU CS 124 MSP430 Microarchitecture11 Source: Indexed Mode – x(Rs)   Rs  PC  PC incremented at end of phase Evaluate Source Operand Use PC to obtain index, use Rs for base register

Memory BYU CS 124 MSP430 Microarchitecture12 10 = Indirect Register Mode Addressing Modes Registers Address Bus Data Bus (+1 cycle) CPU ADDER ; r10 = M[r4] PC R10 R4 IR Data Bus (1 cycle) 0x542a Address Bus 0x542a PC ALU +2

BYU CS 124 MSP430 Microarchitecture13 Source: Indirect Mode   Rs Evaluate Source Operand

Memory BYU CS 124 MSP430 Microarchitecture14 Addressing Modes Registers Data Bus (+1 cycle) CPU ADDER 11 = Indirect Auto-increment Mode ; r10 += M[r4++] PC R10 R4 IR Data Bus (1 cycle) 0x543a Address Bus PC 0x543a Address Bus 0002 ALU +2

BYU CS 124 MSP430 Microarchitecture15 Source: Indirect Auto Mode   Rs Evaluate Source Operand Increment by 1 (.b) or 2 (.w)

Memory BYU CS 124 MSP430 Microarchitecture16 Addressing Modes Registers Address Bus Data Bus (+1 cycle) CPU ADDER 01 w/R0 = Symbolic Mode cnt add.w cnt,r10 ; r10 += M[cnt] 0x000c PC R10 IR Data Bus (1 cycle) 0x501a PC ALU Address Bus +2 *Also called PC Relative address mode

BYU CS 124 MSP430 Microarchitecture17 Source: Symbolic Mode – label   PC   PC incremented at end of phase Evaluate Source Operand Use PC to obtain relative index and for base register

Memory BYU CS 124 MSP430 Microarchitecture18 Addressing Modes Registers Address Bus Data Bus (+1 cycle) CPU ADDER cnt 01 w/R2 = Absolute Mode 0000 add.w &cnt,r10 ; r10 += M[cnt] 0xc018 PC R10 IR Data Bus (1 cycle) 0x521a PC ALU Address Bus +2

BYU CS 124 MSP430 Microarchitecture19 Source: Absolute Mode – &Address   #0  PC Evaluate Source Operand Use PC to obtain absolute address, use #0 for base register PC can be incremented anytime during the phase

Memory BYU CS 124 MSP430 Microarchitecture20 Addressing Modes Registers CPU ADDER 11 w/R0 = Immediate Mode add.w #100,r10 ; r10 += 0x0064 PC R10 Data Bus (+1 cycle) IR Data Bus (1 cycle) 0x503a PC 0x503a 0x0064 ALU Address Bus +2

BYU CS 124 MSP430 Microarchitecture21 Source: Immediate Mode – #n   PC PC can be incremented anytime during the phase Evaluate Source Operand

BYU CS 124 MSP430 Microarchitecture22 MSP430 Source Constants To improve code efficiency, the MSP430 "hardwires" six register/addressing mode combinations to commonly used source values: #0 - R3 in register mode (00) #1 - R3 in indexed mode (01) #2 - R3 in indirect mode (10) #-1 - R3 in indirect auto-increment mode (11) #4 - R2 in indirect mode (10) #8 - R2 in indirect auto-increment mode (11) Eliminates the need to use a memory location for the immediate value - commonly reduces code size by 30%. Evaluate Source Operand

Memory BYU CS 124 MSP430 Microarchitecture23 Addressing Modes Registers CPU ADDER Constant Generator add.w #1,r10 ; r10 += 1 PC R ffff IR Data Bus (1 cycle) 0x531a Address Bus PC 0x531a ALU +2

BYU CS 124 MSP430 Microarchitecture24 Constant Mode – #{-1,0,1,2,4,8}  R3 Evaluate Source Operand

Memory BYU CS 124 MSP430 Microarchitecture25 Addressing Modes Registers Address Bus Data Bus (+1 cycle) CPU ADDER 3 Word Instruction cnt add.w cnt,var ; M[var] += M[cnt] 0x000c PC var Address Bus Data Bus (+1 cycle) PC Data Bus (+1 cycle) 0x0218 IR Data Bus (1 cycle) 0x5090 PC ALU Address Bus +2

BYU CS 124 MSP430 Microarchitecture26 Final Instruction Phases Execute PUSH Decrement stack pointer (R1) Ready address for store phase JUMP Compute 10-bit, 2’s complement, sign extended Add to program counter (R0) Store Move data from ALU to register, memory, or I/O port

Memory BYU CS 124 MSP430 Microarchitecture27 Registers Address Bus Data Bus (+1 cycle) CPU Push Instruction cnt push.w cnt ; M[--sp] = M[cnt] 0x000c PC IR Data Bus (1 cycle) 0x1210 PC fffe (+1 cycle) Address Bus SP 0xa5a5 Data Bus (+1 cycle) 0xa5a5 ALU ADDER SP Execute Phase Address Bus +2

BYU CS 124 MSP430 Microarchitecture28 Execute Phase: PUSH.W Execute Cycle  SP SP = SP - 2 Use Store Phase to push on stack

Memory BYU CS 124 MSP430 Microarchitecture29 Addressing Modes Registers CPU ADDER Execute Phase: jne func jne func ; pc += sext(IR[9:0]) << 1 PC R2 IR Data Bus (1 cycle) 0x3c2a Address Bus PC 0x3c21 ALU +2 SEXT[9:0]<<1 func COND Jump Next

BYU CS 124 MSP430 Microarchitecture30 Execute Phase: Jump Execute Cycle  PC 2’s complement, sign-extended Select “COND” to conditionally change PC

BYU CS 124 MSP430 Microarchitecture31 Store Phase: Rd  Store Cycle

BYU CS 124 MSP430 Microarchitecture32 Store Phase: Other…  Store Cycle

Review Questions

2.2.4 Review Questions 1.add.w tab(r10),r9 2.and.w &mask,r12 3.bis.b #0x08,r6 4.mov.b cnt,r11 5.mov.w r4,r5 6.mov.w #100,r14 a.Absolute b.Constant c.Immediate d.Indexed register e.Indirect auto-increment f.Indirect register g.Register h.Symbolic BYU CS 124 MSP430 Microarchitecture34 Match the following source operand modes:

2.2.4 Review Questions (answers) 1.add.w tab(r10),r9 2.and.w &mask,r12 3.bis.b #0x08,r6 4.mov.b cnt,r11 5.mov.w r4,r5 6.mov.w #100,r14 a.Absolute b.Constant c.Immediate d.Indexed register e.Indirect auto-increment f.Indirect register g.Register h.Symbolic BYU CS 124 MSP430 Microarchitecture35 Match the following source operand modes:

PC BYU CS 124 MSP430 Microarchitecture Review Questions Present the destination operand of the following instruction to the ALU: add.w r4,cnt ; M[cnt] += r4 cnt Memory Registers CPU ADDER IR PC ALU 0x5480 R4 0x0218 0x5480

0x0218 0x5480 PC BYU CS 124 MSP430 Microarchitecture Review Questions (answers) Present the destination operand of the following instruction to the ALU: add.w r4,cnt ; M[cnt] += r4 cnt Memory Registers CPU ADDER IR PC ALU Address Bus 1.Put PC on Address Bus Data Bus (+1 cycle) 2.Present ADDER Op1 w/Data Bus PC 3.Present ADDER OP2 w/PC Address Bus 4.Put ADDER on Address Bus Data Bus (+1 cycle) 5.Load ALU OP2 from Data Bus +2 6.Increment PC by 2 PC R4 0x5480

BYU CS 124 MSP430 Microarchitecture Review Questions Show how to retrieve a PC-relative destination operand from memory and present to the ALU:

BYU CS 124 MSP430 Microarchitecture Review Questions (answers)  PC    Show how to retrieve a PC-relative destination operand from memory and present to the ALU:

BYU CS 124 MSP430 Microarchitecture40