Search code examples
hardwarelogiccircuitdigital-design

How to think about digital circuit design


How does one go about thinking about designing digital logic chips in an abstract way?

I'm currently working through "The Elements of Computing Systems" I'm in the first chapter, and I've implemented the following gates, starting from Nand.

Not

And

Or

Xor

Mux

DMux

16bit Not

16bit And

16bit Or

16bit Mux

8 way Or

I'm now stuck trying to implement a 16 bit four way Mux.

I've tried converting the truth table into canonical notation, but I end up with a gigantic mess. Using canonical representation worked well for "smaller" chips, but is now immensely complicated. How can I think about putting together a "complicated" chip in a way that doesn't involve just mashing together random chips?

Edit:

I'm not really confused about the 16 bit part of the four way Mux. I planned on just using a bunch of four way Muxes in an array. The 4 way mux is the part I'm stuck on.


Solution

  • Lets start with a two input mux.

    Two inputs A & B and a select line S. The output will be '1' when the A or B is '1' and the select line selects that input, else it's '0'. So either:

    A=1 and S=0
    B=1 and S=1
    

    Writing that out as gates:

    (A and (not S)) or (B and S)
    

    Expand that up to a 4 way (S is now 2 bits):

    A = 1 and S=0
    B = 1 and S=1
    C = 1 and S=2
    D = 1 and S=3
    
    (A and (not S1) and (not S0)) or
    (B and (not S1) and (    S0)) or
    (C and (    S1) and (not S0)) or
    (D and (    S1) and (    S0))
    

    We can see a pattern emerging which is that every input is AND'ed with some "enabling term" which switches that input on or off. As the enabling terms are exclusive (only one can be true at any time) the effect is to switch the output to the desired input.

    This can be extended up to any size of MUX.