Re: Have I found a bug in the HardwareSimulator ? (Probably not)

Posted by WBahn on
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Have-I-found-a-bug-in-the-HardwareSimulator-Probably-not-tp4033046p4033048.html

How can this be your code for RAM8 when you USE a bunch of RAM8 parts in it?

I think you mean that this is your code for RAM64.

In your modifications you are progressively reducing the effective size of your memory and making it so that multiple addresses map to the same memory location. The tests can't detect that until you get to a point where you write to one address that overwrites a memory location that was previously written to using a different address and that is subsequently read using that previous address.

For instance, in your first modification (where you just changed line 2), you've made it so that if the person writes to any address where address = ???000 will write to address 000 in that RAM8 block. So if you write

RAM[8] = 8
RAM[16] = 16

and then go back and read RAM[8] you will discover that it is now 16.