Unformatted text preview:

CS 429H Spring 2014 Y86 Assembly Assigned Feb 7 Due Feb 20 11 59PM 1 Introduction In this lab you will transform three simple functions from C into Y86 assembly and test them against a simulator The purpose of this is to give you practice with assembly level programming in general and with the Y86 instruction set and tools in particular 2 Logistics You will work on this lab individually Any clarifications and revisions to the assignment will be posted on the course Web page or Piazza 3 Handout Instructions You can get a copy of this handout and the assignment code from the course website You should download the asmlab handout 429H tar file 1 Start by copying the file asmlab handout 429H tar to a directory in which you plan to do your work 2 Then give the command unix tar xvf asmlab handout 429H tar This will cause the following files to be unpacked into the directory README Makefile sim tar archlab ps archlab pdf and simguide pdf 3 Next give the command unix tar xvf sim tar 1 This will create the directory sim which contains your personal copy of the Y86 tools You will be doing all of your work inside this directory 4 Change to the sim directory and build the Y86 tools unix cd sim unix make clean make 4 Program Description You will be working in directory sim misc for this lab Your task is to write and simulate the following three Y86 programs The required behavior of these programs is defined by the example C functions in examples c Be sure to put your name and ID in a comment at the beginning of each program 1 Write your Y86 assembly code in myfile ys 2 Invoke the Y86 assembler to convert your Y86 assembly code to byte code unix yas myfile ys This will generate the Y86 machine level program in myfile yo 3 Use the Y86 instruction simulator to execute your program unix yis myfile yo YIS will simulate the execution of the program and print changes to any registers or memory locations The correct register and memory state is mentioned in the following sections In all of your Y86 functions you should follow the IA32 conventions for the structure of the stack frame and for register usage instructions including saving and restoring any callee save registers that you use sum ys Iteratively sum linked list elements Write a Y86 program sum ys that iteratively sums the elements of a linked list Your program should consist of some code that sets up the stack structure invokes a function and then halts In this case the function should be Y86 code for a function sum list that is functionally equivalent to the C sum list function in examples c A sample three element list for testing your code is as follows Please ensure you start your data with the label input data so that I can test your code with other test inputs Your code should be able to take care of linked lists of any length 2 Sample linked list align 4 input data ele1 long 0x00a long ele2 ele2 long 0x0b0 long ele3 ele3 long 0xc00 long 0 For the given linked list your function should return the sum 0xcba in register eax rsum ys Recursively sum linked list elements Write a Y86 program rsum ys that recursively sums the elements of a linked list This code should be similar to the code in sum ys except that it should use a function rsum list that recursively sums a list of numbers as shown in the C function rsum list in examples c The input list looks exactly like the one used in list ys Please ensure you start your data with the label input data so that I can test your code with other test inputs Your code should be able to take care of linked lists of any length copy ys Copy a source block to a destination block Write a program copy ys that copies a block of words from one part of memory to another nonoverlapping area area of memory computing the checksum Xor of all the words copied Your program should consist of code that sets up a stack frame invokes a function copy block and then halts The function should be functionally equivalent to the C function copy block in examples c A sample three element source and destination block for testing your code is as follows Please ensure you start your source block with the label src and the destination block with the label dest so that I can test your code with other test inputs Your code should be able to take care of blocks of any length You can assume the destination block follows immediately after the source block so that you can initialize len as the difference between dst and src align 4 Source block src long 0x00a long 0x0b0 long 0xc00 Destination block dest long 0x111 3 long 0x222 long 0x333 For the given test input the function should return the sum 0xcba in register eax copy the three words 0x00a 0x0b and 0xc to the 12 contiguous memory locations beginning at address dest and not corrupt other memory locations 5 Evaluation The lab is worth 30 points 10 points for each Y86 solution program Each solution program will be evaluated for correctness including proper handling of the stack and registers as well as functional equivalence with the example C functions in examples c The programs sum ys and rsum ys will be considered correct if the graders do not spot any errors in them and their respective sum list and rsum list functions pass all the test cases The program copy ys will be considered correct if the graders do not spot any errors in them and the copy block function passes all test cases and does not corrupt any other memory locations except the ones following dest 6 Handin Instructions Make sure you have included your name and ID in a comment at the top of each file you submit Name your files sum ys rsum ys and copy ys Turnin your files through canvas as a tar file with the name uteid tar For example if your UTEID is vn339 then submit a file named vn339 tar 4


View Full Document

UT CS 429H - LECTURE NOTES

Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?