hw_4_solution - Homework #4 solution 1. We want to increase...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #4 solution 1. We want to increase the number of registers that we can specify in the LC-3 AND instruction to 16. Do you see any problem with that? Explain. Ans) YES, there’s a problem. Not enough bits in the instruction to have 4 bit registers. 2. Implement a XOR gate (A XOR B) using the LC3 instruction set. Assume that the 2 numbers are given at R0 and R1. (Hint: Use DeMorgan’s Laws. LC3 doesn’t have an OR function) A XOR B = ( AB’ + A’B) = (( AB’ + A’B)’)’ = ((AB’)’ * (A’B)’)’ A is in R0 and B is in R1 NOT R2,R0 ; A’ NOT R3, R1 ; B’ AND R4,R0,R3 ; AB’ AND R5,R2,R1 ; A’B NOT R4,R4 ;(AB’)’ NOT R5,R5 ; (A’B)’ AND R6,R4,R5 ; (AB’)’ * (A’B)’ NOT R6,R6 ; ((AB’)’ * (A’B)’)’ 3. Write the condition code at the end of each instruction (assume the program starts at memory location x3000): Instruction N Z P Initial case 0 0 1 0 0 1 LEA R2, #100 0 0 1 LD R2, #0 You are loading “ADD R3, R2,0x5” into R2, so it should be possitive
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/07/2008 for the course EE 306 taught by Professor Ambler during the Fall '07 term at University of Texas at Austin.

Page1 / 4

hw_4_solution - Homework #4 solution 1. We want to increase...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online