Forever stuck on Loading chip

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

Forever stuck on Loading chip

Dudess
So to begin with, I'm a total beginner to this. I was about to build an AND gate with HDL and test it in the hws but whenever I try to load it, the message "Loading chip..." in the bottom of the hws is shown forever.

This is my code:

CHIP And {

    IN a, b;
    OUT out;

    PARTS:
    // Put your code here:
    And(a=a[1], b=b[1], out=out[1]);
    And(a=a[1], b=b[0], out=out[0]);
    And(a=a[0], b=b[1], out=out[0]);
    And(a=a[0], b=b[0], out=out[0]);
}

Worth mentioning is that if i comment out my code under the existing "//Put tour code here:" it does work and I can load the chip just fine.
Reply | Threaded
Open this post in threaded view
|

Re: Forever stuck on Loading chip

cadet1620
Administrator
The problem is that you are trying to use And chips to make your And. This results in infinite recursion.

You need to make your chips in the order listed in the book: Not, And, Or, etc. When you build your Not chip the only part that you have available to use in the Parts section is Nand. Once you have built and tested your Not chip, then you can build your And chip using Nand and Not parts.

Each chip that you build and test adds another tool to your toolbox of parts that you can use when building the next chip.

Look at figure 1.6 (left column) in section 1.1.4 to see how HDL is a description of part connections.

Read the Hardware Construction Survival Kit, particularly the HDL syntax and the meaning of "a=a" section.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: Forever stuck on Loading chip

Dudess
Alright, thanks! So the Nand gate is pre built?
Reply | Threaded
Open this post in threaded view
|

Re: Forever stuck on Loading chip

cadet1620
Administrator
Yes, the Nand chip built in and is always available. It's the "root" from which all the chips in projects 1 and 2 grow.

In project 3, there is one more pre-built chip, the DFF (D flip-flop). This is the starting point for the sequential (time-based) parts.

--Mark