This preview shows page 1. Sign up to view the full content.
Unformatted text preview: imulator on the CPU again.
Add the s ame s ignals to the waveform that we had before.
Ty pe do sta rt.do and then run 1000 at the prompt again. Your waveform s hould now s how that R0 c hanged, but to the
wrong value of x 300X with red lines around the value of x 300X. In ModelSim, the c apital X means that ModelSim does not
k now what value the s ignal s hould be at that time. W e have found another error!
Us e the analy s is and table above to help y ou find the two remaining errors in the ADD ins truc tion. Remember that R0 s hould
c hange to x 3012 after the add ins truc tion finis hes ex ec uting. Creating a New Instruction
In this part of the lab, y ou will add the NEG or negate ins truc tion to the LC-3. To c reate this new ins truc tion, y ou will need to write a
s hort mic roprogram or add a s eries of new s tates to y our c ontrol s tate mac hine. You will add thes e new s tates by c hanging a
c ouple mic roins truc tions in the Control ROM. Designing the new instr uction The NEG ins truc tion negates the c ontents of a regis ter by performing the two's c omplement operation on the regis ter. The NEG is
written with the following as s embly c ode and RTL ins truc tions .
NEG DR, SR; DR< - -(SR)
For ex ample, s uppos e R1 c ontains the value 15 and R2 c ontains the value 24. The ins truc tion NEG R1, R2 would c hange the value
of R1 to -24 and would not c hange the value of any other regis ter.
The LC-3 has one unus ed opc ode: opc ode 13. The LC-3 als o has s everal unus ed s tates in its c ontrol ROM: 13, 55-58 and 60-63.
W e will us e this opc ode and thes e unus ed s tates to implement the NEG ins truc tion Step 1: Write the microprogram
Before determining the form of y our mic roins truc tions or the format of the mac hine c ode for y our as s embly ins truc tion, y ou need to
determine how y ou c an implement the mic roprogram generally . Us e the work s heet to des ign two s tates that c an us e the LC-3
arc hitec ture to implement the negate mic roins truc tion. Ste...
View Full Document
This document was uploaded on 03/22/2014.
- Fall '14