Tuesday, September 29, 2009 5:02 AM,
A student writes, and in so doing, teaches me that regardless how many things I got to get done tonight, I should not send email to the class unless I am paying attention to what my fingers are typing. The student is absolutely correct. Dr. Patt I'm confused with your reply to the email below. In your extended solution, you load R5 with value 1, yet during your load instruction your offset is 000000000.. How can that be? Isn't the offset the difference between the memory you're loading and the PC? <<name withheld to protect the student who is absolutely correct>> Thank you for letting me know, so I can correct it before most students check their email in the morning. I laid out the bit fields of the load instruction and then never went back to fill in the correct offset. Please do not do that on one of my exams. The load instruction should have been: 0010 101 000000010. Thank you for pointing it out. Yale Patt On Tue, Sep 29, 2009 at 3:05 AM, Yale N Patt <patt@ece.utexas.edu> wrote: > A student writes: > > Dear Dr. Patt, > This is **********, one of your students in 306. > I was working on my program, and I have a question > that deals with constants. Hint 1 states that bit > masks are to be used after the HALT instruction of > the program. Can we use constants within the program? > Or do they have to be after the HALT instruction? > Thanks for your time, > <<name withheld to protect the student who prefers to have > his constants in the program, rather than in memory>> > > I assume you are asking whether you can add 1 to R0 by executing > > 0001 000 000 1 00001 > > rather than > > 0010 101 000000000 ; load the value 1 into R5 > 0001 000 000 0 00 101 ; add the contents of R5 to R0, > putting result in R0 > 1111 0000 0010 0101 ; halt the machine > 0000000000000001 ; the value 1, which is stored in > the next memory location > > Sure, makes a lot sense to have the value 1 in the instruction, > rather than have to get it from memory. > > HOWEVER, what do you know about the magnitude of that constant > that could prevent you from doing that? > > Good luck finishing the program on time. > > Yale Patt