EECC250 - Shaaban #1 lec #16 Winter99 1-24-2000 Estimation of Assembly Programs Execution Time For a CPU running at a constant clock rate: clock rate =

Slides:



Advertisements
Similar presentations
Microprocessors.
Advertisements

Chapter 3 Introduction to the 68000
Instructor: Dr Aleksandar Milenkovic Lecture Notes
EECC250 - Shaaban #1 Lec # 2 Winter Addressing Modes  Addressing modes are concerned with the way data is accessed  Addressing can be.
The family.
9/20/6Lecture 3 - Instruction Set - Al Instruction Set.
EECC250 - Shaaban #1 lec #14 Winter Binary Coded Decimal (BCD) Arithmetic Binary Coded Decimal (BCD) is a way to store decimal numbers.
EECC250 - Shaaban #1 Lec # 6 Winter Stack-Related Instructions PEA Push Effective Address Calculates an effective address and pushes it.
Addressing Modes & Instruction Set By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41 URL:
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
EECC250 - Shaaban #1 Lec # 5 Winter Stacks A stack is a First In Last Out (FILO) buffer containing a number of data items usually implemented.
ARM Instructions I Prof. Taeweon Suh Computer Science Education Korea University.
ECE 447 Fall 2009 Lecture 5: TI MSP430 Software Development in C and Assembly pt. 2.
Assembly Programming on the TI-89 Created By: Adrian Anderson Trevor Swanson.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the SH-2 32-bit RISC.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Machine Instruction Characteristics
9/20/6Lecture 3 - Instruction Set - Al Instruction Set (2)
ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/ ECE265.
CSCI 136 Lab 1: 135 Review.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Passing Parameters using Stack Calling program pushes parameters on the stack one element at a time before calling subroutine. Subroutine Call (jsr, bsr)
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
ECE 447: Lecture 12 Logic, Arithmetic, Data Test and Control Instructions of MC68HC11.
Advanced Assembly Language Programming
Arithmetic and Logic Chapter 5
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
M68k Arithmetic Instructions ECE 511: Digital System & Microprocessor.
Microprocessor & Assembly Language
Logical, Shift, Rotate & BCD. What we will learn in this session: Logical instructions. Shift & Rotate instructions. BCD operations. Bit operations.
Data Transfers, Addressing, and Arithmetic
Status Register Status = system byte (supervisor only) + user byte = system status + condition code register usually, it is not important to know.
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
Assembly Language Assembly Language
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Lecture Set 5 The 8051 Instruction Set.
Introduction to 8085 Instructions
Machine control instruction
Assembly Language Programming Part 2
Microcomputer Programming
Overview Introduction General Register Organization Stack Organization
The University of Adelaide, School of Computer Science
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Arithmetic and Logic Chapter 5
68000 Arithmetic Instructions
Lecture 3 - Instruction Set - Al
The 8051 Assembly Language Arithmetic & Logic Instructions
Chapter 8 Central Processing Unit
Programmer’s View of the EAGLE
Write a program to calculate x**y, given x and y.
Logical Operations In some applications it is necessary to manipulate other sizes of data, or perhaps only individual bits. There are instructions that.
Logical Operations bitwise logical operations AND, OR, EOR, NOT
M68k Arithmetic Instructions
Arithmetic and Logic Chapter 5
The ARM Instruction Set
Branching instructions
Overheads for Computers as Components 2nd ed.
Chapter 5 Arithmetic and Logic Instructions
CS501 Advanced Computer Architecture
Immediate data Immediate operands : ADD r3, r3, #1 valid ADD r3, #1,#2 invalid ADD #3, r1,r2 invalid ADD r3, r2, #&FF ( to represent hexadecimal immediate.
CS-401 Computer Architecture & Assembly Language Programming
ECE511: Digital System & Microprocessor
Presentation transcript:

EECC250 - Shaaban #1 lec #16 Winter Estimation of Assembly Programs Execution Time For a CPU running at a constant clock rate: clock rate = 1 / clock cycle time Every machine or assembly instruction takes one or more clock cycles to complete. The total time an assembly program requires to run is given by: Execution time = Total number of cycles X Clock cycle time = Instruction count X cycles per instruction X clock cycle time = Instruction count X cycles per instruction / clock rate Example: For a CPU running at 8MHZ is executing a program with a total of instructions. Assuming that each instruction takes 10 clock cycles to complete: Execution time = X 10 / = seconds

EECC250 - Shaaban #2 lec #16 Winter Cycles Per Instruction For the 68000, the number of clock cycles required by an instruction to execute depends on: –The exact type of the instruction in question. –Addressing modes used for both the instruction source and destination if applicable. –Size of operands: Byte- and word-sized operands usually take the same number of cycles to process. Instructions with long word-sized operands take more cycles than that with byte/word-sized operands. For a running at 8MHZ all instruction times are rounded to multiples of four (i.e. 10 becomes 12 etc.).

EECC250 - Shaaban #3 lec #16 Winter Instructions Summary Instr Description ABCD Add decimal with extend MOVE Move source to destination ADD Add MULS Signed multiply AND Logical AND MULU Unsigned multiply ASL Arithmetic shift left NBCD Negate Decimal with Extend ASR Arithmetic shift right NEG Negate Bcc Branch conditionally NOP No operation BCHG Bit test and change NOT Ones complement BCLR Bit test and clear OR Logical OR BRA Branch always PEA Push effective address on stack BSET Bit test and set RESET Reset External devices BSR Branch to subroutine ROL Rotate left without extend BTST Bit test ROR Rotate right without extend CHK Check register against bounds ROXL Rotate left with extend CLR Clear operand ROXR Rotate right with extend CMP Compare RTD Return and deallocate DBcc Decrement and branch RTE Return from exception conditionally DIVS Signed divide RTR Return and restore DIVU Unsigned divide RTS Return from subroutine EOR Exclusive OR SBCD Subtract decimal with extend EXG Exchange registers Scc Set conditional EXT Sign extend STOP Stop JMP Jump SUB Subtract JSR Jump to subroutine SWAP Swap data register halves LEA Load Effective Address TAS Test and set operand LINK Link stack TRAP Trap LSL Logical shift left TRAPV Trap on overflow LSR Logical shift right TST Test

EECC250 - Shaaban #4 lec #16 Winter Cycles For MOVE Instructions Addressing ModeOperand Size Clock Cycles

EECC250 - Shaaban #5 lec #16 Winter Time to Calculate Effective Addresses (an) (an)+ -(an) d(an) d(an,dn).b.w/.l 4/8 4/8 6/10 8/12 10/14 abs.s abs.l d(pc) d(pc,dn) Imm.b.w/.l 8/12 12/16 8/12 10/14 4/8 The time taken to calculate the effective address must be added to instructions that affect a memory address. Addressing Mode Operand Size Addressing Mode

EECC250 - Shaaban #6 lec #16 Winter Cycles For Standard Instructions.b.w/.l ea,an ea,dn dn,mem add 8/6(8) 4/6(8) 8/12 and - 4/6(8) 8/12 cmp 6/6 4/6 - divs - 158max - divu - 140max - eor - 4/8 8/12 muls - 70max - mulu - 70max - or - 4/6(8) 8/12 sub 8/6(8) 4/6(8) 8/12 (8) time if effective address is direct Add effective address times from above for mem addresses Addressing ModeOperand Size Clock Cycles

EECC250 - Shaaban #7 lec #16 Winter Cycles For Immediate Instructions. b.w/.l #,dn #,an #,mem addi 8/ /20 addq 4/8 8/8 8/12 Moveq.l only andi 8/ /20 nbcd+tas.b only cmpi 8/14 8/14 8/12 eori 8/ /20 scc false/true moveq ori 8/ /20 subi 8/ /20 subq 4/8 8/8 8/12 Add effective address times from above for mem addresses Addressing ModeOperand Size Clock Cycles

EECC250 - Shaaban #8 lec #16 Winter Cycles for Single-Operand Instructions.b.w/.l #,dn #,an #,mem clr 4/6 4/6 8/12 nbcd neg 4/6 4/6 8/12 negx 4/6 4/6 8/12 not 4/6 4/6 8/12 scc 4/6 4/6 8/8 tas tst 4/4 4/4 4/4 Add effective address times from above for mem addresses Addressing ModeOperand Size Clock Cycles

EECC250 - Shaaban #9 lec #16 Winter Cycles for Shift/Rotate Instructions. b.w/.l dn an mem asr,asl 6/8 6/8 8 lsr,lsl 6/8 6/8 8 ror,rol 6/8 6/8 8 roxr,roxl 6/8 6/8 8 Memory is byte only For register add 2x the shift count Addressing ModeOperand Size Clock Cycles

EECC250 - Shaaban #10 lec #16 Winter d(an d(pc (an) (an)+ -(an) d(an),dn) abs.s abs.l d(pc),dn) jmp jsr lea pea movem t=4 m>r movem t=5 r>m movem add t x number of registers for.w movem add 2t x number of registers for.l Addressing Mode Clock Cycles Misc. Instructions

EECC250 - Shaaban #11 lec #16 Winter Cycles for Bit Manipulation Instructions.b/.l register.l memory.b only only bchg 8/12 8/12 bclr 10/14 8/12 bset 8/12 8/12 btst 6/10 4/8 Addressing Mode Clock Cycles Operand Size

EECC250 - Shaaban #12 lec #16 Winter Cycles To Process Exceptions Address Error 50 Bus Error 50 Interrupt 44 Illegal Instr. 34 Privilege Viol. 34 Trace 34

EECC250 - Shaaban #13 lec #16 Winter Cycles for Other Instructions. b.w/.l dn,dn m,m addx 4/8 18/30 cmpm - 12/20 subx 4/8 18/30 abcd 6 18.b only sbcd 6 18.b only Bcc.b/.w 10/10 8/12 bra.b/.w 10/10 - bsr.b/.w 18/18 - DBcc t/f 10 12/14 chk - 40 max 8 trap trapv Add effective address times from above for mem addresses Addressing Mode Operand Size Clock Cycles

EECC250 - Shaaban #14 lec #16 Winter Cycles for Other Instructions reg<>mem movep.w/.l 16/24 Reg Mem Reg andi to ccr 20 - move from usp 4 andi to sr 20 - nop 4 eori to ccr 20 - ori to ccr 20 eori to sr 20 - ori to sr 20 exg 6 - reset 132 ext 4 - rte 20 link 18 - rtr 20 move to ccr rts 16 move to sr stop 4 move from sr 6 8 swap 4 move to usp 4 - unlk 12 Addressing Mode Clock Cycles

EECC250 - Shaaban #15 lec #16 Winter Timing Example 1 InstructionClock Cycles RANDOMADDI.B#17,D0 8 LSL.B#3,D012 NOT.BD0 4 RTS16 For a running at 8MHZ: Clock cycle = 125 nsec Execution time = 40 X 125 nsec = 5  s = 5 x second Total Cycles needed: 40 cycles

EECC250 - Shaaban #16 lec #16 Winter Timing Example 2 Clock Cycles Instruction Overhead Loop MOVE.B#255,D0 8 READADD.W(A0)+,D1 8 SUBQ.B#1,D0 4 BNEREAD 10 Total Cycles Needed = ( ) = x 22 = 5618 cycles Execution time for 8MHZ = 5618 x 125 nsec = Seconds =.702 msec

EECC250 - Shaaban #17 lec #16 Winter Timing Example 3 TOBIN converts a four-digit BCD number in the lower word of D0 into a binary number returned in D2 Clock Cycles Instructions overhead outer inner loop loop TOBINCLR.LD2 6 MOVEQ#3,D6 4 NEXTDIGITMOVEQ#3,D5 4 CLR.WD1 4 GETNUMLSL.W#1,D0 8 ROXL.W#1,D1 8 DBRAD5,GETNUM 10 MULU#10,D2 42 ADD.WD1,D2 4 DBRAD6,NEXTDIGIT 10 RTS 16 Total Clock cycles = overhead + ( (inner loop cycles x 4 ) + outer loop cycles) x 4 = 26 + ( ( 26 x 4 ) + 64 ) x 4 = x 4 = 698 cycles = 698 x 125 nsec =  s or over BCD numbers converted to binary every second.