Rect.hack draws 2 rectangles instead of 1

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

Rect.hack draws 2 rectangles instead of 1

sharan013
Hi,
  I finished my Computer.hdl . All the test scripts were successfully run.
  But in the ComputerRect-external.tst and ComputerRect.tst instead of 1 rectangle  being drawn as explained by the script, I have 2 rectangle being drawn,  Heres an img of it .
Any clues as to where the bug may be.


Thanks,
  Sharan  
Reply | Threaded
Open this post in threaded view
|

Re: Rect.hack draws 2 rectangles instead of 1

sharan013
Update
According to fig 5.11, RAM[0] should be set to 50,  but my RAM[0] is set to 4. Everything else matches.

Thanks,
 Sharan
Reply | Threaded
Open this post in threaded view
|

Re: Rect.hack draws 2 rectangles instead of 1

cadet1620
Administrator
In reply to this post by sharan013
sharan013 wrote
Hi,
  I finished my Computer.hdl . All the test scripts were successfully run.
  But in the ComputerRect-external.tst and ComputerRect.tst instead of 1 rectangle  being drawn as explained by the script, I have 2 rectangle being drawn
It looks like you have an address decoding problem in your Memory.hdl chip.

Here is a test for Memory.hdl I've been working on that does some extensive address bit testing.
    Memory-new.tst
    Memory-new.cmp

If you can't find the problem, you can email me your CPU, Memory and Computer files I'll be happy to take a look at them.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: Rect.hack draws 2 rectangles instead of 1

sharan013
Hi,
 Thanks Mark, I fixed my Memory.hdl . I had missed corner case. Everything  things working fine. Thanks again.

 Is there any way to see how efficient your design is  ? ( No of Nand gates used). I was thinking of writing a program which will recursively find the total number of nand gates used by the design. Would that be useful for the community ?

You guys have done an awesome work with this. This is really cool.  I cant wait for the next part, Thanks again.

 Sahran

 
Reply | Threaded
Open this post in threaded view
|

Re: Rect.hack draws 2 rectangles instead of 1

cadet1620
Administrator
sharan013 wrote
Is there any way to see how efficient your design is  ? ( No of Nand gates used). I was thinking of writing a program which will recursively find the total number of nand gates used by the design. Would that be useful for the community ?
The tools don't provide any way to do this. I wrote a simple C program to do this for my implementation:
    nand = 1;
    not = nand;
    and = nand+not;
etc. to determine the number of Nands in each part. Search the forum for "gate count" to find related posts.

Trying to optimize 2-input Nand gate count isn't too useful. CMOS, the technology in most modern ICs has N-input "and-or-invert" and "or-and-input" as primitive gates (meaning 1 transistor switching time delay). Nand, Nor and Not are just degenerate cases of these gates.

The skill to learn from this course is abstraction and hierarchical design, not specifically design with Nands.

You can spend way too much time trying to get just one more gate out of a design. Look what Koen and I managed to do with my all Nand ALU.

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

Re: Rect.hack draws 2 rectangles instead of 1

zenspider
In reply to this post by sharan013
It is probably too late for you, but in case others are interested, I wrote golf.rb for my study group. It runs in two different ways:

% ./golf.rb 01 | cut -f1,8 -d\|
gate\user : zenspider | itscaleb 
total     :       725 |     1603 

Not       :         1 |        1 
And       :         2 |        2 
Or        :         3 |        3 
Mux       :         4 |        8 
Xor       :         4 |        9 
DMux      :         5 |        5 
DMux4Way  :        15 |       15 
Not16     :        16 |       16 
Or8Way    :        21 |       21 
And16     :        32 |       32 
DMux8Way  :        35 |       35 
Or16      :        48 |       48 
Mux16     :        49 |      128 
Mux4Way16 :       147 |      384 
Mux8Way16 :       343 |      896 

Which gives you a user-by-user golf (ie, lower is better) score per chip.

% ./golf.rb zenspider/02/ALU.hdl 
Or              =  1 *   3 =   3
Not             = 17 *   1 =  17
And16           =  1 *  32 =  32
And             = 16 *   2 =  32
Or8Way          =  2 *  21 =  42
Not16           =  3 *  16 =  48
Add16           =  1 * 144 = 144
FullAdder       = 16 *   9 = 144
Mux16           =  6 *  49 = 294
ALU             =  1 * 564 = 564

Which gives you a detailed breakdown of a single chip.

The script is written specific to the way we set up our project (multiple people in one directory w/ golf.rb at the top), but can be easily tweaked for your setup.