Chap 1 - AND gate

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

Chap 1 - AND gate

curio
Can someone supply me with the proper code for the first project?  I just can't get the syntax right, and have only limited time to work on this.  I'm hoping that this will get me jumpstarted as I usually learn pretty good from examples.

Thanks,
Mike D
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

ybakos
It's really important to work things out on your own.

Have you implemented any basic gates?
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

curio
no - I need an example to work with
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

Veneficus
In reply to this post by curio
I am sorry, but as the teacher said, you must do it by yourself. I have pulled out a lot of hair before doing 90% of the work for the first project. But I have the confidence it will be worth it at the end.
The mistake of many books is that they are providing the full code, not allowing the student to evolve by itself.

As for your problem, think simple... You already have an Nand gate. Nand means "NOT And". So, think logically. How do you get AND from NOT AND? DO that. After that, do Not, Or, Xor and from there you will make all of them. It's magic. 1 and 0 have unlimited powers.
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

milythael
I agree, mostly, that the student needs to work through the exercises to grow and understand.  However, there are some gotchas in HDL that can be very easy to miss or not understand after reading the appendix once, or twice, or thrice.  I wish there were one or two annotated examples that don't solve any of the design problems in the projects but that do include examples of the tricky bits of HDL.

Even something silly like the following could go a long way in getting people over the hump with their first HDL specification.

CHIP Reverse {
   IN in[16];
   OUT out[16];

   PARTS:
   And16(a=in, b=in,
         out[0]=out[15],
         out[1]=out[14],
         out[2]=out[13],
         out[3]=out[12],
         out[4]=out[11],
         out[5]=out[10],
         out[6]=out[9],
         out[7]=out[8],
         out[8]=out[7],
         out[9]=out[6],
         out[10]=out[5],
         out[11]=out[4],
         out[12]=out[3],
         out[13]=out[2],
         out[14]=out[1],
         out[15]=out[0]
        );
}
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

Synthart
In reply to this post by curio
I am in agreement with the poster. Just one example
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

cadet1620
Administrator
Synthart wrote
I am in agreement with the poster. Just one example
Are you asking for something?

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

Re: Chap 1 - AND gate

Synthart
CHIP And {

     IN in;
     OUT out;

     PARTS:
    And(a=in,b=in,
     a[0],b[0],out[0],
     a[1],b[0],out[0],
     a[0],b[1],out[0],
     a[1],b[1],out[1],
     );
}
Loading Chip but never loads
Reply | Threaded
Open this post in threaded view
|

Re: Chap 1 - AND gate

ybakos
Hi Synthart,
You can't use And within And itself, the universe will implode!

You need to use the chips that you've built to construct And.