cs313-2006-t2-problemset5 - addl , subl , andl , and xorl ....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 313, Winter 2006 - Term 2 Assignment 5: HCL and y86 Assigned: February 26, Due: Sunday, March 4, 11:59PM (with the usual 13 hour grace period) Instructions: Hand in all solutions on paper. 1. Write an HCL expression for a boolean signal implies , true whenever input a implies input b , using only the boolean operators (and), || (or), and ! (not). 2. Write an HCL expression that accomplishes the sorting of 4 integer inputs. Since each HCL ex- pression can have only one output, we will do this by defining 4 HCL expressions sort0 , sort1 , sort2 , and sort3 , each with 4 inputs a , b , c , and d . sort0 should select the smallest element, sort1 the next smallest and so forth with sort3 selecting the largest element. 3. The Y86 instruction set only contains 4 arithmetic and logical instructions:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: addl , subl , andl , and xorl . Suppose you were converting an X86 program to Y86 and found that it used the notl (bitwise complement) instruction. How can you accomplish the effect of this instruction using only Y86 instructions? To make this specific, suppose that the instruction that you wanted to replace was: notl %eax Give a sequence of Y86 instructions that have the identical effect. Feel free to use the %ecx or %edx registers if you need another register. 4. Repeat question 3 above but with the instruction orl . Specifically, accomplish the same effect as: orl %ebx, %eax 1...
View Full Document

This note was uploaded on 10/09/2011 for the course CPSC 344 taught by Professor Karen during the Fall '10 term at The University of British Columbia.

Ask a homework question - tutors are online