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


Firstly I am quite new to logic gates so pardon my ignorance.  My understanding of NOT gate is that it is the opposite of an input signal and can only take one input so instead of the following:

Nand (a=in, b=in, out = out); I went went with the expression Not(in=in);

Can you please correct me or my logic?  Many thanks

// This file is part of
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/01/Not.hdl

 * Not gate:
 * out = not in

CHIP Not {
    IN in;
    OUT out;

    // Put your code here:
Reply | Threaded
Open this post in threaded view

Re: Not.hdl

jaloysius, you seem to be misunderstanding the problem a little. Imagine you're sitting at a workbench and all you have are Nand gates. Your goal is to implement a Not gate. How would you build a Not gate out of the parts (Nand) that you have?

Once you build a Not gate, now you have two parts on the workbench: Nand and Not. How could you build the next chip, And, out of the parts you have (Nand and Not)?
Reply | Threaded
Open this post in threaded view

Re: Not.hdl

In reply to this post by jaloysius
The IN and OUT lines take care of defining the input and output of the Not gate. They say that it has on input names "in" and one output named "out".

The lines in the PARTS section define how to build the Not gate using known parts. Your HDL says, "to build a Not gate, use a Not gate."

The problem is that when you are building the Not gate, the only part that you have available to use in the PARTS section is Nand.

You should read The Hardware Construction Survival Kit if you have not yet done so.