Problem: Consider the following two SRC code segments for implementing multiplication. Find which one is more efficient in terms of instruction count and.

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

CPSC 330 Fall 1999 HW #1 Assigned September 1, 1999 Due September 8, 1999 Submit in class Use a word processor (although you may hand-draw answers to Problems.
1 ECE369 ECE369 Pipelining. 2 ECE369 “toupper” :converts any lowercase characters (with ASCII codes between 97 and 122) in the null-terminated argument.
MIPS assembly. Review  Lat lecture, we learnt  addi,  and, andi, or, ori, xor, xori, nor,  beq, j, bne  An array is stored sequentially in the memory.
Adding the Jump Instruction
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Assembly Language Working with the CPU.
LC-3 Computer LC-3 Instructions
Overview The Operate Instructions - ADD, AND, NOT The Data Movement Instructions - Load, Load Address, Store Example Using Operate & Data Movement The.
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Feb 18, 2009 Lecture 4-2 instruction set architecture (Part II of [Parhami]) MIPS encoding of instructions Spim simulator more examples of MIPS programming.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chapter 6 Programming in Machine Language The LC-3 Simulator
Chap 4 & 5 LC-3 Computer LC-3 Instructions Chap 4 Homework – due Monday October 27 Chap 5 Homework – due Wednesday October 29 Project 2 Designs (Working.
S. Barua – CPSC 440 CHAPTER 5 THE PROCESSOR: DATAPATH AND CONTROL Goals – Understand how the various.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
1 CS Programming Languages Random Access Machines Jeremy R. Johnson.
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
Lecture 15 Today’s lecture MARIE programming Assembler
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
CSCI 136 Lab 1: 135 Review.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
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.
CDA 3101 Fall 2013 Introduction to Computer Organization
Our programmer needs to do this !
JUMP, LOOP, AND CALL INSTRUCTIONS
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
Datapath and control Dr. ir. A.B.J. Kokkeler 1. What is programming ? “Programming is instructing a computer to do something for you with the help of.
Chapter 5 Computer Organization TIT 304/TCS 303. Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can.
SRC: instruction formats Op-coderarb rc c Type D Op-code Type Aunused Op-codera Type Bc1 21 Op-coderarb.
Computer Science 210 Computer Organization Machine Language Instructions: Control.
Additional Examples CSE420/598, Fall 2008.
Signal Name Direction w.r.t. Printer Function Summary Pin# (25-DB) CPU
Block diagram of a Microcoded Control unit
MIPS Instruction Set Advantages
CS2100 Computer Organisation
Instruction Execution (Load and Store instructions)
Execution time Execution Time (processor-related) = IC x CPI x T
Chapter 11 Instruction Sets
Structural RTL for the br and brl instructions
Computer Science 210 Computer Organization
Instruction Execution (Load and Store instructions)
Decode and Operand Read
Falcon-E : Introduction
Computer Architecture
Single-Cycle CPU DataPath.
CS170 Computer Organization and Architecture I
Systems Architecture I (CS ) Lecture 1: Random Access Machines
Computer Science 210 Computer Organization
Computer Architecture
MIPS coding.
TRAP Routines Subroutines Privileged Instructions
Sequencing, Selection, and Loops in Machine Language
Computer Science 210 Computer Organization
MIPS Functions.
Conditional Jumps and Time Delays
1.4.2 [5] <1.4> What is the global CPI for each implementation?
Review Fig 4.15 page 320 / Fig page 322
Execution time Execution Time (processor-related) = IC x CPI x T
RTL for the SRC pipeline registers
Review.
Example 1: (expression evaluation)
CS501 Advanced Computer Architecture
Reverse Assembly Typical problem:
Systems Architecture I (CS ) Lecture 1: Random Access Machines
MIPS Functions.
Conditional Branching (beq)
Presentation transcript:

Problem: Consider the following two SRC code segments for implementing multiplication. Find which one is more efficient in terms of instruction count and execution time. Program 1: Multiplication by using repeated addition in a for loop Program 2: Multiplication using sub-routine call la r5, 5 ; load value of loop lar r6,mpy ;load address of mpy lar r7, next ;load address of next ld r2, b ; load contents of b in r2 ld r3, c ; load contents of c in r3 la r4, 0 ;load 0 in r4 mpy: brzr r7,r5 ; jump to next after 5 iteration add r4,r4,r3 ;r4 contains r4+c addi r5,r5,-1 ; decrement index br r6 ; loop again next: add r4,r4,r2 ; r4 contains sum of b st r4, a ;store at address label a lar r1,mpy ;load address of mpy in r1 la r3,5 ; load index in r3 ld r4,c ; load contents of c in r4 brl r5, r1 ; r5 contains PC add r2,r2,r7 ; r2 contains sum of b & 5c st r2, a lar r8,again ;r8 contain again address again: brzr r5,r3 ;exit loop when index is 0 add r7,r7,r4 ; r7 contains r7+c addi r3,r3,-1 ; decrement index br r8

Solution The instructions in both programs can be divided into 3 types and the respective count of each type is Number of.. Program 1 Program 2 Data transfer instructions 7 6 Control instructions 2 3 ALSU instructions IC for program 1 = 7 + 2 + 3= 12 IC for program 2 = 6 + 3 + 3= 12

Solution contd.. For execution time, consider the following SRC specifications. ET = IC x CPI x T ET1= (7x4)+(2x2)+(3x3) = 41 ET2= (6x4)+(3x2)+(3x3) = 39 Conclusion: Although the instruction count for both programs is same, program 2 runs much faster than program 1 due to lesser number of clock cycles required. Instruction Type CPI Control 2 ALSU 3 Data Transfer 4