




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab guide for cs/ece 333 students in the fall 2006 semester. It outlines the objectives, procedures, and instructions for lab 1, which focuses on assembling and simulating src assembly programs, including writing simple programs and procedure calls. Students are required to complete both in-lab and post-lab exercises, which involve using the src assembler and simulator, and submitting their code electronically.
Typology: Lab Reports
1 / 8
This page cannot be seen from the preview
Don't miss anything!





This lab will be comprised of an in-lab exercise to be completed in lab and a post-lab exercise to be completed and electronically submitted by the start time of your lab section the following week. For instance, if you have lab on Wednesday, then your postlab is due the following Wednesday.
You will need your textbook (Appendix B1) and the slides from class on implementing procedure calls in SRC to complete this lab.
Electronically submit the following to Toolkit (One code submission per pair):
Each code submission should contain comments at the top which include the following information:
You may work with one partner on the in-lab and post-lab exercise. If you choose to work with a partner, this partner must be the same partner for both in-lab and post-lab. You must put the names and email IDs of both partners in the top of your submitted assembly code files. If you discuss with another person/group to solve the problem, you must also credit them in the comments of your program describing the nature of the help you received.
You may talk with others about aspects of the coding exercise, but you may not copy code directly from others.
This lab exercise is designed to show you how to use the SRC assembler and the SRC ISA level simulator. The assembler translates SRC assembly language, written according to the conventions shown in Table B.1 of Appendix B in the Computer Systems Design and Architecture text, into valid machine code for the SRC microprocessor. The SRC simulator simulates the SRC microprocessor at the ISA level. That means that it executes the SRC instruction set and shows the effects that each instruction has on the content of the programmer visible registers and the memory of an SRC-based system.
The SRC assembler and simulator have been built as a Java application which requires a minimum of Java 1.1 Runtime Environment to run.
The simulator should be runnable in Windows by double-clicking on the application. You should see an interface that looks like this:
add r4, r5, r6 ; r4 <- r5 + r sub r4, r6, r7 ; r4 <- r6 - r add r20, r21, r22 ; r20 <- r21 + r stop ; halt the program
(SRCTools Version 3.1.1) HexLoc DecLoc MachWord Label Instruction Comment 00000000 0000000000 610a6000 add r4, r5, r6 ; comment1: r4 <- r5+r 00000004 0000000004 710c7000 sub r4, r6, r7 ; r4 <- r6 - r 00000008 0000000008 652b6000 add r20, r21, r22 ; r20 <- r21 + r 0000000c 0000000012 f8000000 stop ; halt the program
--- Symbol Table ---
If there are errors in the assembly file, messages will be displayed in the text window beneath the editor window. The file can be edited and reassembled by hitting the Show Asm File button and making the desired changes. Files can be saved from File->Save or File->Save As.
int findMax(int val1, int val2, int val3) { /* find the max of val1 and val2 / if(val1 < val2) val1=val2; / set val1 = the max of the comparison */
/* find the max compared to val3 / if(val1 < val3) val1=val3; / set val1 = max of val1, val2, val3 */
return val1; }
Using your textbook Appendix B1 and class notes on procedure calls as reference, write an assembly code program that implements this procedure. For this exercise the convention is: a. The stack pointer (SP) will be held in r b. The link register will be r c. Arguments will be saved on the stack starting with the first parameter (val1), then second parameter (val2), then third parameter (val3)
The electronic submission for your post-lab is due at the ending time of your next lab section the following week.
a. It should: i. Load the parameters val1, val2, val3 from their respective memory addresses ii. Save the arguments to findMax on the stack, making the appropriate adjustments to the stack pointer iii. Allocate space for the return value iv. Call findMax v. Terminate execution (stop)
Follow these guidelines when implementing your main() function: