Homework Problem - PowerPoint PPT Presentation

About This Presentation
Title:

Homework Problem

Description:

Software development lifecycle (SDLC) Integrating with the enterprise ... Software Development Lifecycle. Business process analysis. Functional and technical ... – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 22
Provided by: richarde8
Learn more at: https://www.cs.umb.edu
Category:
Tags: homework | problem | wifi

less

Transcript and Presenter's Notes

Title: Homework Problem


1
Homework Problem
  • Text problem 1.7 (due next class)
  • We will talk about the solution.

2
Solution
3
1.7a
4
1.7b
5
1.7c
  • NonFp instructions which are not floating point
  • FP instructions which are part of a floating
    point computation
  • nonfp total fp (operations for hardware)
  • 1.8 10 6 195578 1.6 106
  • For Software
  • fp 3.8 107 1.6 106 3.6 107
  • Inst per operation 3.6 107 / 195578 185

6
1.7 Mflops
  • Mflops 195,578/(1.08 106 )
  • 0.18 mflops

7
Observations About Computer Design
  • Make the common case fast
  • Understand Amdahls law
  • Performance improvement gained from using some
    faster mode of execution is limited by fraction
    of the time you use the faster mode
  • Exploit locality of reference as applied to
    both code and data
  • Rule of thumb

    90 of the execution time is spent in only
    10 of the code
  • Temporal locality
  • Something just recently used will be reused again
    shortly
  • Spatial locality
  • Items near one another will be referenced together

8
Computer Architecture Is
  • The attributes of a computing system as seen
    by the programmer, i.E., The conceptual structure
    and functional behavior, as distinct from the
    organization of the data flows and controls the
    logic design, and the physical implementation.
  • Amdahl, Blaaw, and brooks, 1964

SOFTWARE
9
Computer Architectures Changing Definition
  • 1950s to 1960s computer architecture course
    computer arithmetic
  • 1970s to mid 1980s computer architecture course
    instruction set design, especially ISA
    appropriate for compilers
  • 1990s computer architecture coursedesign of
    CPU, memory system, I/O system, multiprocessors

10
Instruction Set Architecture (ISA)
software
instruction set
hardware
11
Interface Design
  • A good interface
  • Lasts through many implementations (portability,
    compatibility)
  • Is used in many different ways (generality)
  • Provides convenient functionality to higher
    levels
  • Permits an efficient implementation at lower
    levels

use
time
imp 1
Interface
use
imp 2
use
imp 3
12
Instructions
?1998 Morgan Kaufmann Publishers
  • Language of the machine -- machine code
  • More primitive than higher level languages (e.G.,
    No sophisticated control flow)
  • Very restrictive (e.G., MIPS arithmetic
    instructions)
  • Textbook uses dlx (mips) instruction set
    architecture
  • Similar to other architectures developed since
    the 1980's
  • Used by NEC, Nintendo, silicon graphics, Sony
  • Design goals maximize performance and minimize
    cost, reduce design time

13
Isa
  • Each instruction is executed by the hardware
  • How is an instruction represented?
  • By a binary format (bytes words, etc)
  • Fixed - each instruction is a fixed number of
    bits
  • Or variable (multiple word instructions)

14
Operands
  • Operation is identified by an opcode
  • Operands 0,1,2,or 3 required
  • Implicit - opcode indicates where the operand is
    located
  • Explicit - operand is in a field of the
    instruction
  • Registers vs memory

15
MIPS/dlx Arithmetic
  • All instructions have 3 operands
  • Operand order is fixed (destination
    first) example C code A B C dlx
    code add s0, s1, s2 (associated
    with variables by compiler)

16
MIPS Arithmetic
  • Design Principle simplicity favors regularity.
    Why?
  • Of course this complicates some things... C
    code A B C D E F - A MIPS
    code add t0, s1, s2 add s0, t0,
    s3 sub s4, s5, s0
  • Operands must be registers, only 32 registers
    provided

17
Registers Vs. Memory
  • Arithmetic instructions operands must be
    registers, only 32 registers provided
  • Compiler associates variables with registers
  • What about programs with lots of variables

18
Memory Organization
  • Viewed as a large, single-dimension array, with
    an address.
  • A memory address is an index into the array.
  • "Byte addressing" means that the index points to
    a byte of memory.

19
Memory Organization
  • Bytes are nice, but most data items use larger
    "words"
  • For MIPS, a word is 32 bits or 4 byte232 bytes
    with byte addresses from 0 to 232-1
  • 230 words with byte addresses 0, 4, 8, ... 232-4
  • Words are aligned i.E., What are the least 2
    significant bits of a word address?

Registers hold 32 bits of data
20
Instructions
  • Load and store instructions
  • Example C code A8 h A8 MIPS
    code lw t0, 32(s3) add t0, s2, t0 sw
    t0, 32(s3)
  • Store word has destination last
  • Remember arithmetic operands are registers, not
    memory!

21
Our First Example
  • Can we figure out the code?

swap(int v, int k) int temp temp
vk vk vk1 vk1 temp
swap muli 2, 5, 4 add 2, 4, 2 lw 15,
0(2) lw 16, 4(2) sw 16, 0(2) sw 15,
4(2) jr 31
Write a Comment
User Comments (0)
About PowerShow.com