Tues, 16 Sept 2014, 05:38

```
My students,

It occurs to us that when you look at the starter code for lab 2, you may
be confused that MEMORY is a two-dimensional array, having 2^15 rows and
two columns.  Certainly each location contains one byte, and there are
2^16 locations, but why not 2^16 rows by one column, as we normally think

As an aside, let's ignore the fact that this memory should not have locations
xFFE0 to xFFFF, since these addresses correspond to I/O space and not memory
locations.  In lab 2, we are simulating the I/O space with these memory
locations in our two dimensional array.

Our reason for having two columns is to reflect the fact that memory is
organized in chips, and we can only access one location in a chip at a time.
So, for example, if we had 2^16 rows by one column, and we wanted to LDW with
address x0008, we would need two memory accesses, the first one to get the
byte from x0008 and the second one to get the byte from x0009.  Two accesses
is much too slow.  Is there a way to get both bytes in a single memory access?

Answer: Yes, if we store memory in two chips, and we access both chips
at the same time.  We store the contents of all even addresses in one chip
and the contents of all odd addresses in the other chip.  That is, the first
location of chip 1 has address x0000, the first location of chip 2 has
address x0001, the second location of chip 1 has address x0002, the second
location of chip 2 has address x0003, and so forth.

Again, we wish to LDW with address x0008.  That is, we want the bytes having
addresses x0008 and x0009.  We note that address x0008 refers to the 5th
location of chip 1 and x0009 refers to the 5th location of chip 2.  So, if
we remove the low bit of the address (which, by the way differentiates even
from odd), and send the resulting address x0004 to both chips, we will get
simultaneously the contents of the 5th location of both chips.  ...in ONE
access.

(Just to be sure we are on the same page: x0008 is 0000 0000 0000 1000.
When I remove the low bit, I get 0000 0000 0000 100, which is
000 0000 0000 0100.  ...and similarly for x0009, which is 0000 0000 0000 1001.)

Note the address is now 15 bits, which corresponds to the fact that each
chip has 2^15 locations.  It is MAR[15:1}

If you wanted to LDB with address A, you would again first remove the low bit
to know which address to send to the memory.  Here you would use that low bit
that has been removed to tell you which of the two chips you needed to
access.  That is, MAR[15:1] addresses the chips, and MAR[0] tells you which
chip you are looking for, the one with odd addresses or the one with even