1 / 5

Lab #1 PCSpim

Lab #1 PCSpim . SPIM is a software simulator that loads and executes assembly language programs for the MIPS RISC computers. Download and install PCSpim from http://www.cs.wisc.edu/~larus/spim.html Introduction to PCSpim can also be found there. Sample Program.

chloe
Download Presentation

Lab #1 PCSpim

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab #1 PCSpim • SPIM is a software simulator that loads and executes assembly language programs for the MIPS RISC computers. • Download and install PCSpim from http://www.cs.wisc.edu/~larus/spim.html • Introduction to PCSpim can also be found there

  2. Sample Program ## Your first MIPS assembly program ## Notice the stylized format of the code: 3 columns: ## (1) Optional labels, ## (2) Machine instructions, assembler directives and operands, ## (3) Optional comments: right of a '#' until end of line is ## ignored. .data # "data section" global, static modifiable data SID: .word 50 spc1: .asciiz " " nl: .asciiz "\n" msg1: .asciiz "Hello, World\n" msg2: .asciiz "My name is: XXXXXXXXX\n" msg3: .asciiz "\nMy name is still XXXXXXXXX !\n"

  3. Sample Program (cont’d) .text # "text section" code and read-only data .globl main # declare main as a global symbol main: la $a0, msg1 li $v0, 4 # "print string" system call syscall la $a0, msg2 li $v0, 4 syscall lw $a0, SID la $a1, spc1 Loop: beq $0, $a0, Exit add $a0, $a0, -1 li $v0, 1 # "print int" system call syscall

  4. Sample Program (cont’d) move $t0, $a0 move $a0, $a1 li $v0, 4 syscall move $a0, $t0 j Loop Exit: la $a0, msg3 li $v0, 4 syscall ## Exit from program li $v0, 10 # "Exit" system call syscall

  5. Requirements • Type the MIPS sample program into a file using a text editor. Replace XXXXX by your name. Name the new file lab1.s • Run PCSpim and load lab1.s • Write a report (text file) on what the program does. Name the file lab1.rep • Package the two files as lab1.zip and email to grader Z. Yue (zdyue@ee.tamu.edu) with subject 350lab1 • Due date 2/9 (Wed) 11:30 AM.

More Related