Faculty of Computer Science © 2006 CMPUT 229 Why Computer Architecture? An Introduction to CMPUT 229.

Slides:



Advertisements
Similar presentations
Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Advertisements

Lecture 9: MIPS Instruction Set
Instructor: Tor Aamodt
Chapter 2 — Instructions: Language of the Computer — 1 Branching Far Away If branch target is too far to encode with 16-bit offset, assembler rewrites.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
Systems Architecture Lecture 5: MIPS Instruction Set
CSE 340 Computer Architecture Spring 2014 MIPS ISA Review
Faculty of Computer Science © 2006 CMPUT 229 Why Computer Architecture? An Introduction to CMPUT 229.
Lecture 8: MIPS Instruction Set
Faculty of Computer Science © 2006 CMPUT 229 Pointers and Arrays Differentiating Pointers from Data.
Faculty of Computer Science © 2006 CMPUT 229 Subroutines - Part 2 Calling Itself.
Spring 2008, Jan. 14 ELEC / Lecture 2 1 ELEC / Computer Architecture and Design Spring 2007 Introduction Vishwani D. Agrawal.
The Structure of the CPU
CMPUT Computer Organization and Architecture I1 CMPUT229 - Fall 2006 Computer Organization and Architecture I Li-Yan Yuan.
1 Lecture 5: MIPS Examples Today’s topics:  the compilation process  full example – sort in C Reminder: 2 nd assignment will be posted later today.
Computer Organization: Introduction Spring 2006 Jen-Chang Liu ( )
August 26 TA: Angela Van Osdol Questions?. What is a computer? Tape drives? Big box with lots of lights? Display with huge letters? Little box with no.
Lecture 7: Instruction Set Architecture CSE 30: Computer Organization and Systems Programming Winter 2014 Diba Mirza Dept. of Computer Science and Engineering.
Computer Organization
1 CS/COE0447 Computer Organization & Assembly Language Pre-Chapter 2.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Computer Architecture ECE 4801 Berk Sunar Erkay Savas.
Natawut NupairojAssembly Language1 Introduction to Assembly Programming.
Irwin Fall 2006 PSU CSE331 Computer Organization and Design Fall 2007 Read Me Mary Jane Irwin ( Course url:
Fall 2015, Aug 17 ELEC / Lecture 1 1 ELEC / Computer Architecture and Design Fall 2015 Introduction Vishwani D. Agrawal.
Lecture 7. Instructions and High-Level to Machine Code Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education.
Spr 2015, Feb 9... ELEC / Lecture 4 1 ELEC / Computer Architecture and Design Spring 2015 Compiling and Executing Programs.
CS35101 Computer Architecture Spring 2006 Week 1 Slides adapted from: Mary Jane Irwin ( Course url:
1 CS/COE0447 Computer Organization & Assembly Language Chapter 2 Part 4.
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
ELEC Digital Logic Circuits Fall 2015 Introduction
Computer organization Practical 1. Administrative Issues The course requirements are: –To be nice and open minded –To pass the exam (there is a boolean.
Computer Organization and Architecture I José Nelson Amaral
 1998 Morgan Kaufmann Publishers MIPS arithmetic All instructions have 3 operands Operand order is fixed (destination first) Example: C code: A = B +
CMPUT Computer Organization and Architecture I1 CMPUT229 - Fall 2003 Topic5: Linking José Nelson Amaral.
August 27 Books? ? Accounts?. What does a computer look like? Tape drives? Big box with lots of lights? Display with huge letters? Little box with.
CDA 3100 Fall2009. Special Thanks Thanks to Dr. Xiuwen Liu for letting me use his class slides and other materials as a base for this course.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 2 Part 3.
Spring 2016, Jan 13 ELEC / Lecture 1 1 ELEC / Computer Architecture and Design Spring 2016 Introduction Vishwani D. Agrawal.
1 Lecture 6: Assembly Programs Today’s topics:  Large constants  The compilation process  A full example  Intro to the MARS simulator.
May 2, 2001System Architecture I1 Systems Architecture I (CS ) Lecture 11: Arithmetic for Computers * Jeremy R. Johnson May 2, 2001 *This lecture.
May 22, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 14: A Simple Implementation of MIPS * Jeremy R. Johnson Mon. May 17, 2000.
The course purpose and structure Teach the computers internals on hardware/software interface level The students upon completion of the course should be.
Introduction to System Software
DDC 2223 SYSTEM SOFTWARE DDC2223 SYSTEM SOFTWARE.
Lecture 6: Assembly Programs
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
Systems Architecture I
CS170 Computer Organization and Architecture I
Instructions - Type and Format
Systems Architecture I
Systems Architecture Lecture 5: MIPS Instruction Set
Jeremy R. Johnson Wed. Apr. 5, 2000
Systems Architecture II
CDA 3100 Spring 2010.
Systems Architecture I
A primer on Computers and Programs
CS/COE0447 Computer Organization & Assembly Language
Systems Architecture I
Systems Architecture I
Lecture 6: Assembly Programs
Introduction to Computer Systems
Systems Architecture I
January 16 The books are here. Assignment 1 now due Thursday 18 Jan.
Systems Architecture I
Computer Architecture
ELEC / Computer Architecture and Design Fall 2014 Introduction
Topic 2b ISA Support for High-Level Languages
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Faculty of Computer Science © 2006 CMPUT 229 Why Computer Architecture? An Introduction to CMPUT 229

© 2006 Department of Computing Science CMPUT 229 Organization of a Computer Clements, pp.20 COPYRIGHT 2006 OXFORD UNIVERSITY PRESS ALL RIGHTS RESERVED

© 2006 Department of Computing Science CMPUT 229 Structure of a Computer Clements, pp.21 COPYRIGHT 2006 OXFORD UNIVERSITY PRESS ALL RIGHTS RESERVED

© 2006 Department of Computing Science CMPUT 229 Stored-Program Computer Clements, pp.21 COPYRIGHT 2006 OXFORD UNIVERSITY PRESS ALL RIGHTS RESERVED

© 2006 Department of Computing Science CMPUT 229 A Personal-Computer (PC) Motherboard Clements, pp.22 COPYRIGHT 2006 OXFORD UNIVERSITY PRESS ALL RIGHTS RESERVED

© 2006 Department of Computing Science CMPUT 229 Below Your Program High-level language program in C void swap(int v[ ], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = 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 Compiler Assembly language program (for MIPS) Assembler Binary machine language program (for MIPS) Henn-Patt, pp.7

© 2006 Department of Computing Science CMPUT 229 Trying it out #include void swap(int v[ ], int k); void print_vector(int v[ ]); int main(int argc, char *argv[ ]) { int v[]={1,3,5,7,9,-1}; print_vector(v); swap(v,2); print_vector(v); } void swap(int v[], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } void print_vector(int v[]) { int i; for(i=0 ; v[i]>0 ; i++) printf("\t%d ",v[i]); printf("\n"); }

swap: # vars= 8, regs= 2/0, args= 0, extra= 8.frame$fp,24,$31.mask0x ,-4.fmask0x ,0.setnoreorder.cpload$25.setreorder subu$sp,$sp,24.cprestore 0 sw$fp,20($sp) sw$28,16($sp) move$fp,$sp sw$4,24($fp) sw$5,28($fp) lw$2,28($fp) move$3,$2 sll$2,$3,2 lw$3,24($fp) addu$2,$2,$3 lw$3,0($2) sw$3,8($fp) lw$2,28($fp) move$3,$2 sll$2,$3,2 lw$3,24($fp) addu$2,$2,$3 lw$3,28($fp) move$4,$3 sll$3,$4,2 lw$4,24($fp) addu$3,$3,$4 addu$4,$3,4# page 1 $ gcc -S swap.c [on a MIPS R12K machine] lw$3,0($4) sw$3,0($2) lw$2,28($fp) move$3,$2 sll$2,$3,2 lw$3,24($fp) addu$2,$2,$3 addu$3,$2,4 lw$2,8($fp) sw$2,0($3)# page 2

swap: # vars= 0, regs= 0/0, args= 0, extra= 0.frame$sp,0,$31.mask0x ,0.fmask0x ,0.setnoreorder.cpload$25.setreorder sll$5,$5,2 addu$5,$5,$4 lw$2,4($5) lw$3,0($5) sw$2,0($5).setnoreorder.setnomacro j$31 sw$3,4($5).setmacro.setreorder.endswap.rdata.align2 $ gcc -O3 -S swap.c [on a MIPS R12K machine]

swap: link.w %a6,#-4 move.l 12(%a6),%d0 lsl.l #2,%d0 move.l 8(%a6),%a0 move.l (%a0,%d0.l),-4(%a6) move.l 12(%a6),%d0 move.l %d0,%d1 lsl.l #2,%d1 move.l 8(%a6),%a1 move.l 12(%a6),%d0 lsl.l #2,%d0 add.l 8(%a6),%d0 move.l %d0,%a0 addq.l #4,%a0 move.l (%a0),(%a1,%d1.l) move.l 12(%a6),%d0 lsl.l #2,%d0 add.l 8(%a6),%d0 move.l %d0,%a0 addq.l #4,%a0 move.l -4(%a6),(%a0) unlk %a6 rts $ gcc -S swap.c [for a 68K machine] swap: link.w %a6,#0 move.l 8(%a6),%a0 move.l 12(%a6),%d0 move.l (%a0,%d0.l*4),%d1 move.l 4(%a0,%d0.l*4),(%a0,%d0.l*4) move.l %d1,4(%a0,%d0.l*4) unlk %a6 rts $ gcc -O3 -S swap.c [for a 68K machine]

swap:.prologue 2, 2.vframe r2 mov r2 = r12 ;;.body st8 [r2] = r32 mov r14 = r2 ;; adds r14 = 8, r2 ;; st4 [r14] = r33 mov r14 = r2 adds r16 = 12, r2 ;; mov r14 = r2 ;; adds r14 = 8, r2 ;; ld4 r14 = [r14] ;; sxt4 r15 = r14 addl r14 = 4, r0 ;; setf.sig f6 = r15 setf.sig f7 = r14 ;; xma.l f6 = f6, f7, f0 ;; getf.sig r15 = f6 ld8 r14 = [r2] ;; add r14 = r15, r14 ;; ld4 r14 = [r14] ;; st4 [r16] = r14 mov r14 = r2 ;; adds r14 = 8, r2 ;; ld4 r14 = [r14] ;; sxt4 r15 = r14 addl r14 = 4, r0 ;; setf.sig f6 = r15 setf.sig f7 = r14 ;; xma.l f6 = f6, f7, f0 ;; getf.sig r15 = f6 ld8 r14 = [r2] ;; add r16 = r15, r14 mov r14 = r2 ;;#page 1 adds r14 = 8, r2 ;; $ gcc -S swap.c [on an Itanium I machine] ld4 r14 = [r14] ;; sxt4 r15 = r14 addl r14 = 4, r0 ;; setf.sig f6 = r15 setf.sig f7 = r14 ;; xma.l f6 = f6, f7, f0 ;; getf.sig r15 = f6 ld8 r14 = [r2] ;; add r14 = r15, r14 ;; adds r14 = 4, r14 ;; ld4 r14 = [r14] ;; st4 [r16] = r14 mov r14 = r2 ;; adds r14 = 8, r2 ;; ld4 r14 = [r14] ;; sxt4 r15 = r14 addl r14 = 4, r0 ;; setf.sig f6 = r15 setf.sig f7 = r14 ;; xma.l f6 = f6, f7, f0 ;; getf.sig r15 = f6 ld8 r14 = [r2] ;; add r14 = r15, r14 ;; adds r15 = 4, r14 mov r14 = r2 ;; adds r14 = 12, r2 ;; ld4 r14 = [r14] ;; st4 [r15] = r14.restore sp mov r12 = r2 br.ret.sptk.many b0.endp swap#.section.rodata.align 8# page 2

swap:.prologue.body sxt4 r33 = r33 ;; shladd r33 = r33, 2, r32 ;; mov r14 = r33 ;; ld4 r16 = [r14], 4 ;; ld4 r15 = [r14] ;; st4 [r33] = r15 st4 [r14] = r16 br.ret.sptk.many b0.endp swap# $ gcc -O3 -S swap.c [on an Itanium I machine]

© 2006 Department of Computing Science CMPUT 229 Machine Organization P-Pro bus (64-bit data, 36 bit address, 66 MHz) CPU Interrupt Controler 256-KB L2 Bus interface PCI Bridge PCI I/O Cards PCI I/O Cards PCI I/O Cards PCI Bus PCI Bridge PCI I/O Cards PCI I/O Cards PCI I/O Cards PCI Bus Memory Controller Memory Interleave Unit 1-, 2-, 4-way Interleaved DRAM CullerSinghGupta, pp. 32

© 2006 Department of Computing Science CMPUT 229 Example of SMP machine: Pentium “quad pack” P-Pro bus (64-bit data, 36 bit address, 66 MHz) CPU Interrupt Controler 256-KB L2 Bus interface CPU Interrupt Controler 256-KB L2 Bus interface CPU Interrupt Controler 256-KB L2 Bus interface CPU Interrupt Controler 256-KB L2 Bus interface PCI Bridge PCI I/O Cards PCI I/O Cards PCI I/O Cards PCI Bus PCI Bridge PCI I/O Cards PCI I/O Cards PCI I/O Cards PCI Bus Memory Controller Memory Interleave Unit 1-, 2-, 4-way Interleaved DRAM CullerSinghGupta, pp. 32

© 2006 Department of Computing Science CMPUT 229 Converting Source into Executable Files COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Henn-Patt, pp. A-4

© 2006 Department of Computing Science CMPUT 229 A More Complete Story Source file Compiler Assembler file Object file Assembler Linker Source file Compiler Assembler file Object file Assembler Source file Compiler Assembler file Object file Assembler Program library Program library Executable file

© 2006 Department of Computing Science CMPUT 229 The Linker COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Henn-Patt, pp. A-18

© 2006 Department of Computing Science CMPUT 229 When to use Assembly Language? –When you don’t have the tools to program in higher level: new embedded processors compilers that check deadlines for real time system do not exist yet –When the tools fail: Compilers still generate sub-optimal code –When you are building the tools: Compiler designer/builders must know assembly well

© 2006 Department of Computing Science CMPUT 229 Anatomy of an Object File Size and position of other pieces. Machine Code Binary Data Representation. References that must change if the program is moved in memory. Associate addresses with external label. Unresolved references. Compilation information to allow mapping of addresses to source code. COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Henn-Patt, pp. A-13

© 2006 Department of Computing Science CMPUT 229 Books Referenced  Clements: Principles of Computer Hardware, by Alan Clements, Fourth Edition, Oxford University Press,  Henn-Patt: Computer Organization and Design: The Hardware/Software Interface, by John L. Hennessy and David A. Patterson, Second Edition, Morgan Kaufmann,  CullerSinghGupta: Parallel Computer Architecture: A Hardware/Software Approach, by David E. Culler and Jaswinder Pal Singh with Anoop Gupta, Morgan Kaufmann, 1999.

© 2006 Department of Computing Science CMPUT 229 Finding these slides  All the slides for CMPUT 229 are linked to the webpage at: >  Because the slides contain figures from textbooks, they are password-protected (to avoid copyright violations). Here is the username and password: –Username: GenUs –Password: archieorg