Chapter 3 – Instruction Set Architecture. Instruction Length and Cycles.

Slides:



Advertisements
Similar presentations
Instruction Clock Cycles Generally, 1 cycle per memory access: – 1 cycle to fetch instruction word – +1 cycle if or #Imm – +2 cycles.
Advertisements

Machine cycle.
More Intel machine language and one more look at other architectures.
Chapter 4 The Von Neumann Model
MSP430 Assembly Paul Roper
S04: MSP430 Microarchitecture
Chapter 8 – Stacks BYU CS/ECEn 124Chapter 8 - Stacks2 Topics to Cover… The Stack Subroutines Subroutine Linkage Saving Registers.
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
9-6 The Control Word Fig The selection variables for the datapath control the microoperations executed within datapath for any given clock pulse.
ELEN 468 Advanced Logic Design
Datorteknik DatapathControl bild 1 Designing a Single Cycle Datapath & Datapath Control.
Introduction to Microprocessors (CS 45) Session Microprocessor - 2.
LC-3 Computer LC-3 Instructions
CHAPTER 4 COMPUTER SYSTEM – Von Neumann Model
Execution of an instruction
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Blinky Lab 3: Blinky Lab Modify the blinky.asm assembly program to blink the LaunchPad red LED quickly on and off at exactly 10 second intervals. Calculate.
ECE 382 Lesson 2 Readings Lesson Outline Admin Assembler Linker
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.
2.4 Interrupts Required:PM: Ch 9.1-7, pgs PM: Ch , pgs PM: Ch , pgs PM: Ch , pgs PM: Ch 11.5, pgs
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
The Processor Data Path & Control Chapter 5 Part 1 - Introduction and Single Clock Cycle Design N. Guydosh 2/29/04.
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
Chapter 5 – MSP430 ISA The Instruction Set
Required:PM: Ch 8.1-3, pgs Recommended:Wiki: Microarchitecture Wiki: Addressing_mode Wiki: Three-state logicWiki: Microarchitecture Wiki: Addressing_mode.
Quiz 3.1  Compiler friendly  Larger code sizes (~30%)  Complicated microcode  Fewer instructions  Easier to validate  Emphasis on hardware.
CPU Fetch/Execute Cycle
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Chapter 7 – MSP430 Assembler / Linker
Basic Operational Concepts of a Computer
Chapter 8 – Stacks
S03: Instruction Set Architecture
BYU CS 124Lab 0 - Warm-up Lab1 Lab 0 – Warm-up Lab 1.Acquire a Texas Instruments MSP430 LaunchPad Development Tool. 2.Setup a CS user account. 3.Install.
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
Introduction to Computer Engineering CS/ECE 252, Fall 2009 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin – Madison.
Computer Organization and Architecture Tutorial 1 Kenneth Lee.
Lab 4: MSP430 Microarchitecture
Lecture 3 – MSP430 ISA The Instruction Set Reading: Chapter 5: Architecture of the MSP430 Processor.
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.
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
CS61C L20 Datapath © UC Regents 1 Microprocessor James Tan Adapted from D. Patterson’s CS61C Copyright 2000.
Chapter 4 The Von Neumann Model
Computer Organization Instructions Language of The Computer (MIPS) 2.
CPE 323 Introduction to Embedded Computer Systems: The MSP430X Architecture Instructor: Dr Aleksandar Milenkovic.
Stored Program Concept Learning Objectives Learn the meaning of the stored program concept The processor and its components The fetch-decode-execute and.
Programmable System on Chip
ELEC 418 Advanced Digital Systems Dr. Ron Hayne
Assembly language.
ECE 3430 – Intro to Microcomputer Systems
S04: MSP430 Microarchitecture
ELEN 468 Advanced Logic Design
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.
ECE 382 Lesson 4 Lesson Outline Readings
Chapter 4 The Von Neumann Model
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
The fetch-execute cycle
CS170 Computer Organization and Architecture I
Computer Structure S.Abinash 11/29/ _02.
COMS 361 Computer Organization
The Stored Program Computer
October 29 Review for 2nd Exam Ask Questions! 4/26/2019
Introduction to Computer Engineering
Computer Architecture
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Presentation transcript:

Chapter 3 – Instruction Set Architecture

Instruction Length and Cycles

Instruction Length 1 word for instruction Format I: Format II: Format III: OpcodeS-regAdb/wAsD-reg Instruction Length Opcodeb/wAdD/S-reg OpcodeCondition10-bit, 2’s complement PC offset 1 additional word for each of the following addressing modes: Source index mode (As = 01) mov 10(r4),r5 mov cnt,r5 mov &P1IN,r5 Chapter 3 - ISA3 mov #100,r5 Source immediate mode (As = 11, SR = PC) mov r4,10(r5) mov r4,cnt mov r4,&P1OUT Destination index mode (Ad = 1) BYU CS 124

Chapter 3 - ISA4 Quiz 3.5 What is the length (in words) for each of the following instructions? InstructionL L add.w r5,r6mov.w EDE,TONI add.w cnt(r5),r6mov.b @r10+,tab(r6) add.w cnt,r6mov.w #45,TONI add.w &cnt,r6mov.w #2,&MEM add.w #100,r6mov.b #1,r11 mov.w r10,r11mov.w #45,r11 #-1,-1(r15) mov.w Instruction Length BYU CS 124

Chapter 3 - ISA5 Quiz 3.5 (solution) What is the length (in words) for each of the following instructions? InstructionL L add.w r5,r6mov.w EDE,TONI add.w cnt(r5),r6mov.b @r10+,tab(r6) add.w cnt,r6mov.w #45,TONI add.w &cnt,r6mov.w #2,&MEM add.w #100,r6mov.b #1,r11 mov.w r10,r11mov.w #45,r11 #-1,-1(r15) mov.w Instruction Length BYU CS 124

Chapter 3 - ISA6 Finite State Machine Clocks Selects Busses Sensors Registers Phase Memory Registers Phase Multiplexors Decoders WE ALU Drivers Control Logic BYU CS 124 Instruction Clock Cycles Computer Clock

Chapter 3 - ISA7 Processor Speed MCLK – Master Clock Most instruction phases require a clock cycle No clock, no instruction execution CPI – Cycles Per Instruction Average number of clock cycles per complete instruction. MIPS – Millions of Instructions per Second (MIPS) Characterizes a processor’s performance MIPS = MCLK / CPI. Clock speed ≠ faster computer Solution BYU CS 124 Instruction Clock Cycles 4 Steps 8 Steps 2 GHz 1 GHz

Chapter 3 - ISA8 Cycles Per Instruction... Instruction timing: 1 cycle to fetch instruction word +1 cycle if or #Imm +2 cycles if source uses indexed mode 1 st to fetch base address 2 nd to fetch source Includes absolute and symbolic modes +2 cycles if destination uses indexed mode +1 cycle if writing destination back to memory +1 cycle if writing to PC (R0) Jump instructions are always 2 cycles Instruction Clock Cycles BYU CS 124

Chapter 3 - ISA9 Example Cycles/Length... ExampleSrcDstCyclesLength add R5,R8RnRm 1 1 add 2 1 mov 3 1 add R5,4(R6)Rnx(Rm) 4 2 add R8,EDERnEDE 4 2 add R5,&EDERn&EDE 4 2 add #100,TAB(R8)#nx(Rm) 5 3 add &TONI,&EDE&TONI&EDE 6 3 add #1,&EDE#1&EDE 4 2 Instruction Clock Cycles BYU CS 124

Chapter 3 - ISA10 Quiz 3.6 How many cycles for each instruction? ;******************************************************************************* ; CS/ECEn 124 Lab 3 - blinky.asm ;******************************************************************************* ; cycles = --- ; MCLK = --- cycles / 10 seconds = --- Mhz ; CPI = MCLK / --- ; MIPS = MCLK / CPI / = --- MIPS.cdecls C,LIST, "msp430.h" ; MSP430 COUNT.equ 0 ; delay count ; text ; beginning of executable code ; RESET: mov.w #0x0280,SP ; init stack pointer mov.w #0x5a80,&0x0120 ; stop WDT (WDTCTL) bis.b #0x01,&0x0022 ; set P1.0 as output (P1DIR) mainloop: xor.b #0x01,&0x0021 ; toggle P1.0 (P1OUT) mov.w #COUNT,r15 ; use R15 as delay counter delayloop: sub.w #1,r15 ; delay over? jnz delayloop ; n jmp mainloop ; y, toggle led ; ; Interrupt Vectors ; sect ".reset" ; MSP430 RESET Vector.word RESET ; start address.end Instruction Clock Cycles BYU CS 124

Chapter 3 - ISA11 Quiz 3.6 (solution) How many cycles for each instruction? ;******************************************************************************* ; CS/ECEn 124 Lab 3 - blinky.asm ;******************************************************************************* ; cycles = --- ; MCLK = --- cycles / 10 seconds = --- Mhz ; CPI = MCLK / --- ; MIPS = MCLK / CPI / = --- MIPS.cdecls C,LIST, "msp430.h" ; MSP430 COUNT.equ 0 ; delay count ; text ; beginning of executable code ; RESET: mov.w #0x0280,SP ; init stack pointer mov.w #0x5a80,&0x0120 ; stop WDT (WDTCTL) bis.b #0x01,&0x0022 ; set P1.0 as output (P1DIR) mainloop: xor.b #0x01,&0x0021 ; toggle P1.0 (P1OUT) mov.w #COUNT,r15 ; use R15 as delay counter delayloop: sub.w #1,r15 ; delay over? jnz delayloop ; n jmp mainloop ; y, toggle led ; ; Interrupt Vectors ; sect ".reset" ; MSP430 RESET Vector.word RESET ; start address.end Instruction Clock Cycles BYU CS 124

Chapter 3 - ISA12 Quiz 3.7 Given a 1.2 MHz processor, what value for DELAY would result in a 1/4 second delay? DELAY.equ ??? mov.w #DELAY,r12 ; delay1: mov.w #1000,r15 ; delay2: sub.w #1,r15 ; jne delay2 ; sub.w #1,r12 ; jne delay1 ; Instruction Clock Cycles BYU CS 124

Chapter 3 - ISA13 Quiz 3.7 (solution) Given a 1.2 MHz processor, what value for DELAY would result in a 1/4 second delay? DELAY.equ ??? mov.w #DELAY,r12 ; 2 cycles delay1: mov.w #1000,r15 ; 2 cycles delay2: sub.w #1,r15 ; 1 cycle jne delay2 ; 2 cycles sub.w #1,r12 ; 1 cycle jne delay1 ; 2 cycles 2 + DELAY  ( ) second = 1,200,000 cycles 0.25 seconds = 1,200,000 / 4 = 300,000 cycles 300,000 cycles = 2 + (DELAY x 3005) cycles – 2 DELAY = = = 100 Instruction Clock Cycles BYU CS 124