advice needed

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

advice needed

pwolf
I have been trying to implement the chips in the first chapter, but its becoming abundantly clear i really dont know whati m doing. what is the process i should be using to solve the problems? at the moment i have implemented the not,and,or and xor gates, and i am trying to implement the mux next. I started by writing down the truth table for the mux but then i just could not think what to do next. I would really liek to learn this stuff so any advice is appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: advice needed

pwolf
Would i be right to imagine im supposed to be taking the canonical representation and simplifying it with algebra?  then turning the simplified boolean expression into logic gates?
Reply | Threaded
Open this post in threaded view
|

Re: advice needed

cadet1620
Administrator
In reply to this post by pwolf
Start by reading this post. Also reread the section "Canonical Representation" in chapter 1.

You'll find more related info by searching the forum for "canonical mux" and "canonical karnaugh".

(Karnaugh maps are a tool to simplify canonical representations.)

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

Re: advice needed

pwolf
Is it better to use k maps or algebra to simplify the expressions?
Reply | Threaded
Open this post in threaded view
|

Re: advice needed

cadet1620
Administrator
Karnaugh maps let you find optimizations much faster than Boolean algebra. They don't depend on the "aha!" moments of inspiration that are often required in algebraic proofs and reductions.

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

Re: advice needed

pwolf
so i should focus on k maps rather the boolean algebra then?
Reply | Threaded
Open this post in threaded view
|

Re: advice needed

cadet1620
Administrator
I don't think that it's productive to focus on either k-maps or algebra. They are both useful skills, but for Nand2Tetris, you are soon going to be beyond circuits that are simple enough to easily apply either method.

For Nand2Tetris, it is better to approach more complex circuit design by using the circuits that you have already built and tested to design more complex circuits. For instance, think about how to design the Mux4Way16 from Mux16s.

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

Re: advice needed

ybakos
In reply to this post by pwolf
I'll tell you what I did, pwolf. I used the truth tables to generate the canonical form, and simply implemented the chip based on that. I did not spend time simplifying the canonical form / optimizing the chip (until later, for fun).
Reply | Threaded
Open this post in threaded view
|

Re: advice needed

pwolf
In reply to this post by cadet1620
i cant help but want to learn this before moving on, but i seem to be struggling to get my head around it.

i dont know how to simplify this

(not a and b) or (a and not b)

but i know there is a simpler circuit because the xor gate i made uses only four nand gates, and this circuit costs 9 nand gates. can you show me how to simplify this or point me in the direction of some good resources to learn ?
Reply | Threaded
Open this post in threaded view
|

Re: advice needed

cadet1620
Administrator
pwolf wrote
i cant help but want to learn this before moving on, but i seem to be struggling to get my head around it.

i dont know how to simplify this

(not a and b) or (a and not b)

but i know there is a simpler circuit because the xor gate i made uses only four nand gates, and this circuit costs 9 nand gates. can you show me how to simplify this or point me in the direction of some good resources to learn ?
You can use De Morgan's law, x + y = ~(~x ~y),  to simplify this as follows:

        (~a b) + (a ~b)
~(  ~(~a b)    ~(a ~b)  )

Notice that this is now 2 Nands terms that are Nanded together.
Use Nand gates for ~a and ~b, and this gets you to a 5 Nand solution for Xor.

The classic 4 Nand Xor circuit is rather difficult to formally derive using techniques that I know. You can use Boolean algebra to prove that it is the same as your Xor, but I leave that as an excercise for you.

--Mark