Below are some of the resources we are usinghttp://highered.mheducation.com/sites/0072467509/student_view0/appendices_a__b__c__d____e.html
The language used to program is the lc3 Assembly.Thank you
0 Notes: 1. For the written questions show all of your work and submit either a PDF or text file. 2. When drawing circuits in a text file you do not have to draw the shapes of the gates. Instead, simply use the word NAND, NOR, AND, OR, or NOT. e.g. A----NAND---C B----/ stands for C = A NAND B 3. For programming questions hand in your source program (.asm file). 4. Name you programs LastnameFirstnameAxQy.asm, replace x with the assignment number and y with the question number. 5. Please comment appropriately for programming question. Please read the “programming standards” for COMP . Marks are allocated for good documentation. 6. Hand in your assignment through the ulearn Written Part Question 1 [4 marks] Design a circuit that adds together 8X and 4X to give 12X, where X is X2X1X0, and gives a 7-‐ bit sum S6S5S4S3S2S1S0. This can be done using 2 half adders and 1 full adder, no additional gates are required. � Question 2 [8 marks] X Y Z OUT 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 (a) [4 marks] Using only a 4-to-1 multiplexor and one inverter (NOT gate) design a circuit that implements the truth table given above. Do not draw the individual gates of the multiplexor, use the logic symbol from the course notes. Hint: Use X and Y as the select lines. OUT can be represented as a function of Z or as 0 or as 1 for each pair of values of X and Y. (b) [4 marks] Using only a 3-to-8 decoder and an OR gate with any many inputs as necessary design, a circuit that implements the truth table given above. Do not draw the individual gates of the decoder, use the logic symbol from the course notes. Hint: Use X, Y and Z as the select lines. � Question 3 [8 marks] Give the truth table for the following circuit. Write a sum of products expression for Z in terms of X and Y. (A) Write out a truth table for S, R and Q where S and R are functions of X, Y, and Z and Q is a function of S and R. The headings for the columns in the truth table should be X, Y, Z, S, R and Q. X, Y and Z are inputs, and S, R and Q are outputs. (B) Write the expressions for S and R in terms of X, Y and Z. You can do this either from the truth table or the circuit diagram. In either case write the simplest sum-of-products expressions possible. (C) State the value of Q for each combination of X, Y, Z. In each case give the value of Q after there are no more changes due to gate delays. I. Set X = 0, Y = 0, Z = 0. After all the changes due to gates delays what is Q? II. Change Z to 1. After all the changes due to gate delays what is the value of Q? III. Change Y to 1. After all the changes due to gate delays what is the value of Q? IV. Change X to 1. After all the changes due to gate delays what is the value of Q? V. Change Z to 0. After all the changes due to gate delays what is the value of Q? VI. Change Y to 0. After all the changes due to gate delays what is the value of Q? VII. Change Z to 1. After all the changes due to gate delays what is the value of Q? VIII. Change X to 0. After all the changes due to gate delays what is the value of Q? � Question 4 [20 marks] Write a subroutine that performs a linear search on an unsorted array of 16-bit 2's compliment integers. • The subroutine has three parameters, o The address of the array o 'N' which is the number of elements in the array o A target value to search for in the array. • The parameters must be on the stack. • If the target value is found in the array return the position at which it is found, otherwise return -1. • The first element is at position 0 and the last element is at position n-1. • The result must be returned to the caller via the stack. • Use R5 as the frame pointer and R6 as the stack pointer. • Save and restore all registers used in the subroutine using the stack. • Include a register dictionary and a map of the activation record for the subroutine. • The mainline must include the following declarations: ASCII .fill x30 FOUNDMSG .stringz "\nFound at position: " NOTFOUNDMSG .stringz "\nNot found." EOPMSG .stringz "\nEnd of Processing" N .fill 10 SOURCE .fill 99 .fill -33 .fill 57 .fill 0 .fill 29 .fill -123 .fill 17 .fill 79 .fill -1 .fill 22 NUNMTARGETS .fill 4 TARGETS .fill 99 .fill -123 .fill 22 .fill 88 • You may add any other declarations you require. • As in the subroutine R6 must be used as the stack pointer. • The array TARGETS contains target values to be searched for in the array SOURCE. • 'N' is the number of elements in the array SOURCE � • NUMTARGETS is the number of elements in the array TARGETS. For each element in the array TARGETS call the linear search subroutine to determine if the element / target is found in the SOURCE array and display the appropriate message as shown in the sample output given below. • Before calling the subroutine push the arguments onto the stack in the following order: o Address of the array SOURCE o The value of N o The current target value. • Reserve space on the stack for the value returned by the subroutine. The target -123 is found at position 5 within the SOURCE array so 5 is displayed as the position, but the target 88 is not found in the SOURCE array so "Not found." is displayed. Using the declarations given above the output must be: Found at position: 0 Found at position: 5 Found at position: 9 Not found. �