Thu, 12 Feb 2009, 04:58

A student writes, and as always, when a student writes I try to answer.

However, I think I need to strongly encourage you to send all questions
about the Lab assignments to my TAs.  They are far more closely immersed
in the lab assignments than I am.  And, while it is true that I came up
with these lab assignments, my TAs have written the helpful code, know the
details of the simulator far better than I, and can give you much better
responses than I can.

Having said that, of course I will try to respond to all email questions
directed at me.  And if none of the TAs can answer your question, of course
you should come to me.  BUT you will get much more from the TAs when it comes
to the lab assignments.

With respect to material discussed in class, problem sets, general
computer architecture questions, etc., I encourage you to continue to
send questions to me.

Now then, since this came to me tonight, and I am sure the student wants
an answer right now :-)  ...

	Dr. Patt,

	On the 2nd assignment I found an issue with writing code for two 
	opcodes.  When we write the code to execute LDB and STB, since the 
	memory created in the shell is word addressable, which byte do we 
	load from as it's not specified, or is there something that I have 

	Thank you,
	<<name withheld to protect the student who needs to look at lc3bsim2.c>>

Have you looked at the the file lc3bsim2.c, identified under "What to do"
in the Lab Assignment 2 blurb?  The heading is Main Memory.

The memory array is set up in the simulator shell that we provided. 
As is pointed out, it is set up as a two dimensional array, the first 
dimension being the word number (from 0 to 0x7FFF), and the second being 
the number of the byte in the word (0 or > 1).
Ergo, the memory array is in fact *byte* addressable.
For example, MEMORY[0x1000][0] contains the value of the low byte of
word 0x1000 which is the memory location 0x2000, and MEMORY[0x1000][1]
contains the value of the memory location 0x2001.


Yale Patt