Chapter 1 - MultiWay Gates

This page continues the first chapter of the Elements of computing Systems creating multi bit gates.

This is the workflow problems of Chapter 1 of the "The Elements of Computing Systems" by Noam Nisan and Shimon Schocken. These are my own solutions for my own reference, The Elements of Computing Systems.

Multi-Way Or Or8Way

An n-way Or gate outputs 1 when at least one of its n bit inputs is 1 and 0 otherwise. out=Or(in[0],in[1],[7]).

CHIP Or8Way {
    IN in[8];
    OUT out;


Multi-Way/Multi-Bix MultiPlexor

An m-way n-bit multiplexor selects one of m n-bit input buses and outputs it to a single n-bit output bus. The selection is specified by a set of k control bits, where k = log2m. The computer platform that will be designed requires two various of this chip a 4 way 16 bit multiplexor and an 8-way 16 bit multiplexor.

What does it all mean basil. If sel = 00, then out = a else if sel = 01 then out = b else if sel = 10 then out c else if sel = 11 then out d

CHIP Mux4Way16 {
    IN sel[2], a[16], b[16], c[16], d[16];
    OUT out[16];

    Mux16(a=a, b=b, sel=sel[0], out=c1);
    Mux16(a=c, b=d, sel=sel[0], out=c2);
    Mux16(a=c1, b=c2, sel=sel[1], out=out);

If Sel=000 then out=a else if Sel=001 then out=b else if Sel=010 then out=c....else if sel=111 out h

CHIP Mux8Way16 {
    IN sel[3], a[16], b[16], c[16], d[16], e[16], f[16], g[16], h[16];
    OUT out[16];

    Mux4Way16(sel[0]=sel[0], sel[1]=sel[1], a[16], b[16], c[16], d[16], out=c1);
    Mux4Way16(sel[0]=sel[0], sel[1]=sel[1], e[16], f[16], g[16], h[16], out=c2);
    Mux16(a=c1, b=c2, sel=sel[2], out=out);

Multiway/multibit demultiplexor

An m-way n-bit demultiplexor channels a single n-bit input into one of m possible n-bit outputs. The selection is specified by a set of k control bits, where k=log2m. The specific computer platform that is built requires two various of this 4-way 1-bit demultiplexor and an 8 way 1-bit demultiplexor.

Dmux4Way - if Sel=00 then {a=in, b=c=d=0}, else if Sel=01 then {b=in, a=c=d=0} else if Sel=10 then {c=in, a=b=d=0} else if Sel=11 then {d=in, a=b=c=0}

CHIP DMux4Way {
    IN in, sel[2];
    OUT a, b, c, d;

    Dmux(in=in, sel=sel[1], a=c1, b=c2);
    Dumx(in=c1, sel=sel[0], a=a, b=b);
    Dmux(in=c2, sel=sel[1], a=c, b=d);

Dmux8WWay - if Sel=000 then {a = in, b=c=d=e=f=g=h=0}, Sel=001 then {b = in, a=c=d=e=f=g=h=0} ... Sel=111 then {h = in, a=b=c=d=e=f=g=0}

CHIP DMux8Way {
    IN in, sel[2];
    OUT a, b, c, d, e, f, g, h;

    DMux(in=in, sel=sel[2], a=c1, b=c2);
    DMux4Way(in=c1, sel[0]=sel[0], sel[1]=sel[1], a=a, b=b, c=c, d=d);
    DMux4Way(in=c2, sel[0]=sel[0], sel[1]=sel[1], a=e, b=f, c=g, d=h);