UNM ECE 335 - Final (7 pages)

Previewing pages 1, 2 of 7 page document View the full content.
View Full Document

Final



Previewing pages 1, 2 of actual document.

View the full content.
View Full Document
View Full Document

Final

44 views

Exam


Pages:
7
School:
The University of New Mexico
Course:
Ece 335 - Integrated Software Systems
Integrated Software Systems Documents

Unformatted text preview:

CSE2421 HW 3 Su13 Grade Sheet NAME PARTNER DEDUCTIONS Question 1 20 points Question 2 10 points Question 3 10 points Question 4 10 points Question 5 10 points Question 6 10 points Question 7 15 points Question 8 15 points TOTAL DEDUCTIONS score given top right Score 100 SUMMER 2013 CSE2421 HOMEWORK 3 Due Date 7 24 2013 IN CLASS 1 20 points For the given Y86 code a explain what the code does b convert the code to a C function c comment each statement len2 pushl ebp rrmovl esp ebp pushl esi irmovl 4 esi pushl edi irmovl 1 edi mrmovl 8 ebp edx irmovl 0 ecx mrmovl edx eax addl esi edx andl eax eax je Done Loop addl edi ecx mrmovl edx eax addl esi edx andl eax eax jne Loop Done rrmovl ecx eax popl edi popl esi rrmovl ebp esp popl ebp ret 8 pts Save ebp New frame pointer Save caller register Constant 4 Save Constant 1 Get a len 0 Get a a Test a If zero goto Done len Get a a Test a If 0 goto Loop return length Restore edi Restore esi Restore stack pointer Restore frame pointer return to calling routine int len1 int a 2pts int len 1 pt for len 0 a len len 3 pts return len 1 pt find number of elements in a null terminated list 5 pts 2 10 pts Consider the following Y86 Assembly language program pos 0x12345676 xorl edx edx here mrmovl here edx esi halt What value will be in register esi once the program terminates Justify your answer 76060000 or 78563412 5 pts value 5 pts for explanation Solution The first instruction initializes register edx to 0 and hence the mrmovl instruction moves four bytes starting from location here into register esi To know which four bytes these are we need to determine the machine language representation of the mrmovl instruction because that is what here is pointing to Its instruction code is 50 followed by the number corresponding to register rA esi 6 then the number corresponding to register rB edx 2 and finally the value of the label here which is 0x676 i e 0x00000676 and in little endian form 76 06 00 00 So the instruction is encoded to be



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Final 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 Final 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?