Thursday, November 22, 2012

Boolean Logic : Activity 15

Activity 15 : Build a 4 WAY DMUX





/**
 * 4-way demultiplexor.
 * {a,b,c,d} = {in,0,0,0} if sel==00
 *             {0,in,0,0} if sel==01
 *             {0,0,in,0} if sel==10
 *             {0,0,0,in} if sel==11
 */


CHIP DMux4Way {


    IN in, sel[2];

    OUT a, b, c, d;

    PARTS:
    // Put your code here.
    Not(in=sel[0], out=nots1);
    Not(in=sel[1], out=nots2);
    And(a=sel[0], b=sel[0], out=s1);
    And(a=sel[1], b=sel[1], out=s2);



    And(a=nots1, b=nots2, out=a1);
    And(a=nots1, b=s2, out=b1);
    And(a=s1, b=nots2, out=c1);
    And(a=s1, b=s2, out=d1);

    And(a=a1, b=in, out=a);
    And(a=b1, b=in, out=c);
    And(a=c1, b=in, out=b);
    And(a=d1, b=in, out=d);




}

////////////////////////////////////
00-a,
01-b, 
10-c, 
11-d 
where ordering is sel[1]sel[0]..  (After 20 mins of hovering over DMUX diagram) 


Can I use DMUX to make this ??
Using DMUX >


/**
 * 4-way demultiplexor.
 * {a,b,c,d} = {in,0,0,0} if sel==00
 *             {0,in,0,0} if sel==01
 *             {0,0,in,0} if sel==10
 *             {0,0,0,in} if sel==11
 */


CHIP DMux4Way {


    IN in, sel[2];

    OUT a, b, c, d;

    PARTS:
    // Put your code here.
DMux(in=in, sel=sel[1], a=w1, b=w2);
DMux(in=w1, sel=sel[0], a=a, b=b);
DMux(in=w2, sel=sel[0], a=c, b=d);

}





Downloads :




No comments:

Post a Comment