copyys Copy a source block to a destination block Write a pr
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 shown in Figure Figure 1. Test your program using the following three-element source and destination blocks:
.align 8
# Source block
src:
.quad 0x00a
.quad 0x0b0
.quad 0xc00
# Destination block
dest:
.quad 0x111
.quad 0x222
.quad 0x333
Click here for a pdf file describing this lab: http://ece324web.groups.et.byu.net/Labs/archlab/archlab.pdf
Click here for the tar file for this lab: http://ece324web.groups.et.byu.net/Labs/archlab/archlab-handout.tar
1 linked list element. 2 typedef struct ELE long val; struct ELE next 5 *list ptr 7 sum list Sum the elements of a linked list 8 long sum list (list ptr ls) 9 long val 0; while (ls) 11 val +S ls- val 12 ls ls next 13 14 return val; 15 16 17 18 rs um list Recursive version of sum list 19 long rsum list (list ptr ls) 20 if (!ls) 21 return 0; 22 else 23 long val ls- val 24 long rest. rsum list (ls- next) 25 return val rest; 26 28 29 30 copy block. Copy src to dest and return xor checksum of src 31 long copy block (long src, long *dest. long len) 32 long result 0; 33 while (len 0) 34 long val Src 35 *dest, val 36 result val 37 len 38 39 return result 40 41 Figure 1: C versions of the Y86-64 solution functions. See sim/misc/examples.cSolution
Hint: gcc -Og -S will help to get you started…
sum.ys: Iteratively sum linked list elements
Write a Y86 program 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. Test your program using the following three-element list:
One example of correct output:
Addresses changed may vary...
