rect.hack

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

rect.hack

Nick
I just finished the computer chip and it passed the add.hack and max.hack test, however it failed the rect.hack test.  I'm wondering if there's something else going on here though because the DRegister and ARegister store the correct values and the PC also outputs the correct value. Furthermore a rectangle is drawn on the screen if I drudge through the comparison failure error.  The only discrepancy is that the comparison file puts a 4 in the RAM16K where my file stores a -1, which from my experience with fill.asm makes more sense.  Anyhow, any guidance is greatly appreciated.  Thanks again for all your past help.
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

cadet1620
Administrator
The 4 in RAM[0] is written by the test script and controls the height of the rectangle (number of lines).

If your Computer is writing a -1 to RAM 0, there must be a problem with writeM, most likely in the CPU.

If you would like me to take a look at them, email me your CPU.hdl, Memory.hdl and Computer.hdl. (More>reply to author).

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

ysh443
Hi Mark
i experienced much the same problem
when running ComputerRect-external.tst test on hw_simul on my computer.hdl
the test seem to pass ok (and 16x4 rect printed to screen)
but
when running it with the ComputerRect.tst test , the test fail comparison on line 14 claiming the RAM16K[0]
has value -1 instead 4

my writeM looks ok to me:
And(a=instruction[15] ,b=instruction[3] ,out=writeM ); // writeM when i bit is true and when d3 bit is true


can you help with this?

regards
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

ysh443
HI
i got my error
as youer sugestion, it had somthing to do with the mem write
i had to refine mt memory chip
so the 16K mem range witth be loaded iff both load thn the add[14]=0
10x

now moving to chap6 as last!!
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

Marek
Maybe for other readers who are stuck at the same problem where R[0] is -1 instead of 4. Your CPU is running fine if it passed the first three test. however the first three tests only address the 16k memory module and not the screen. So if you simply set load of RAM16k and Screen to load=load you have a logical error in your Memory.hdl. Think about when you really want to load each indevidual module (RAM16K or Screen, normaly not both)

I'm sure you can solve it now
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

Maesltrom
I'm having the same issue. My screen and RAM16K are been loaded independently in the Memory.hdl file.
Using the ComputerRectExternal.tst the square is printed in the screen correctly.
I don't figure out what could be wrong. RAM and Screen don't have how to be loaded at the same time

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

cadet1620
Administrator
Depending upon how long ago you downloaded the Nand2Tetris files, you may have old Memory.tst and Memory.cmp files.  Try the versions from this post.

If you can't figure out what's going wrong, you can email me your CPU, Memory and Computer HDL files and I'll take a look at them.

--Mark


Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

Maesltrom
Thanks Folks! I've just solved the tiny trouble in the Memory chip. Now go ahead!
Just on more thing, I had to test the rect program in other view instead of the screen because it was freezing the program
Reply | Threaded
Open this post in threaded view
|

Re: rect.hack

sgaweda
In reply to this post by Marek
Marek wrote
Maybe for other readers who are stuck at the same problem where R[0] is -1 instead of 4. Your CPU is running fine if it passed the first three test. however the first three tests only address the 16k memory module and not the screen. So if you simply set load of RAM16k and Screen to load=load you have a logical error in your Memory.hdl. Think about when you really want to load each indevidual module (RAM16K or Screen, normaly not both)

I'm sure you can solve it now
This helped me immensely in completing this chapter. Thank you Marek. I hope that other people read this post as it will undoubtedly help someone else complete this project.