SPIM simulator CSE 410 Spring 2008 Computer Systems

  • Slides: 11
Download presentation
SPIM simulator CSE 410, Spring 2008 Computer Systems http: //www. cs. washington. edu/410 1/21/2022

SPIM simulator CSE 410, Spring 2008 Computer Systems http: //www. cs. washington. edu/410 1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 1

Reading and References • See the Resources section on the SPIM web page for

Reading and References • See the Resources section on the SPIM web page for documentation on SPIM » http: //www. cs. wisc. edu/~larus/spim. html • Appendix A (from the textbook) • Getting Started with PCSpim (from the website) 1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 2

SPIM simulator • SPIM lets you write MIPS assembly language code and run it

SPIM simulator • SPIM lets you write MIPS assembly language code and run it on a PC • PCSpim is installed on the machines in the Labs » Quiz section (11: 00 am Tues, and thurs? ) • You can download versions for Windows and all varieties of UNIX (including Mac. OS X) from the web site » http: //www. cs. wisc. edu/~larus/spim. html 1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 3

Spim display • Register panel » register names and numbers • Text segment panel

Spim display • Register panel » register names and numbers • Text segment panel » note jump and link to “main” at [0 x 00400014] » your code defines the label “main” • • Data and Stack segment panel Message panel Console panel New exception handling 1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 4

1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of

1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 5

IDE • You can use any text editor you like to write the source

IDE • You can use any text editor you like to write the source code » Notepad, source insight, emacs, j. Edit, VS » links to arrive on class software page • con. TEXT – MIPS assembler aware • j. Edit provides a MIPS highlighter • emacs can do anything including asm – but has a huge learning curve 1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 6

addi. s # Load two numbers into registers and add them . text main:

addi. s # Load two numbers into registers and add them . text main: li $t 0, 1 #load immediate li $t 1, 2 add $t 2, $t 1, $t 0 jr $ra 1/21/2022 # return cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 7

Add. s # load two numbers from memory into registers, add them, # and

Add. s # load two numbers from memory into registers, add them, # and store their sum. data one: . word 1 two: . word 2 sum: . word -1. text main: lw $t 0, one lw $t 1, two add $t 2, $t 0, $t 1 sw $t 2, sum jr $ra 1/21/2022 # return cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 8

1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of

1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 9

Under the Hood of SPIM • Previously based on the ISA of MIPS-1 »

Under the Hood of SPIM • Previously based on the ISA of MIPS-1 » A subset of MIPS-32 » Classic R 2000 chip implemented MIPS-1 (almost) • Now: » » 1/21/2022 Fixed memory mapping No caches 2 minimal coprocessors Better exceptions cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 10

Earlier versions of SPIM (MIPS-1 < 7. 0) 1/21/2022 cse 410 -05 -spim ©

Earlier versions of SPIM (MIPS-1 < 7. 0) 1/21/2022 cse 410 -05 -spim © 2006 -07 Perkins, DW Johnson and University of Washington 11