Monday, October 14, 2013

While At Home

Writing a post after so long!
So what am I doing these days: 
  • Working on Rails and backbone
  • Switching to Emacs 
  • Staring badly at the Rubik's cube ( as if a third eye would open any minute and there'd be tsunamis and volcanoes followed with the cube being solved; heehahhahha.. mmmm sorry!)
  • Making stupid mistakes ( this is a well planned goal ok, someday I got to write a book on 'Stupidity In Programming ;) '  )
Then there is playing guitar, breaking things at home, fighting for the tv remote and of course, accompanying dad in laughing at the daily soaps while mum watches them ;)


Thursday, November 22, 2012

Boolean Logic : Activity 16

Activity 16 : Build an 8 WAY DMUX



WILL SOON PUBLISH NOTES ON THIS !!


/**

 * 8-way demultiplexor.
 * {a,b,c,d,e,f,g,h} = {in,0,0,0,0,0,0,0} if sel==000
 *                     {0,in,0,0,0,0,0,0} if sel==001
 *                     etc.
 *                     {0,0,0,0,0,0,0,in} if sel==111
 */


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

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

DMux(in=w1, sel=sel[1], a=w3, b=w4);
DMux(in=w2, sel=sel[1], a=w5, b=w6);

DMux(in=w3, sel=sel[0], a=a, b=b);
DMux(in=w4, sel=sel[0], a=c, b=d);
DMux(in=w5, sel=sel[0], a=e, b=f);
DMux(in=w6, sel=sel[0], a=g, b=h);


}



Downloads :

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 :




Wednesday, November 21, 2012

Boolean Logic : Activity 14

Activity 14 : Build 16 bit / 8 WAY MUX using the gates previously built




/**
 * 8-way 16-bit multiplexor.
 * out = a if sel==000
 *       b if sel==001
 *       etc.
 *       h if sel==111
 */


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

    PARTS:
    // Put your code here.
Mux16(a=a,b=b,sel=sel[0],out=selab);
Mux16(a=c,b=d,sel=sel[0],out=selcd);
Mux16(a=e,b=f,sel=sel[0],out=selef);
Mux16(a=g,b=h,sel=sel[0],out=selgh);
Mux16(a=selab,b=selcd,sel=sel[1],out=selabcd);
Mux16(a=selef,b=selgh,sel=sel[1],out=selefgh);
Mux16(a=selabcd,b=selefgh,sel=sel[2],out=out);
}



Downloads :

Boolean Logic : Activity 13

Activity 13 : Build 16 bit / 4 WAY MUX using the gates previously built





// This file is part of the materials accompanying the book
// "The Elements of Computing Systems" by Nisan and Schocken,
// MIT Press. Book site: www.idc.ac.il/tecs
// File name: projects/01/Mux4Way16.hdl

/**
 * 4-way 16-bit multiplexor.
 * out = a if sel==00
 *       b if sel==01
 *       c if sel==10
 *       d if sel==11
 */


CHIP Mux4Way16 {


    IN a[16], b[16], c[16], d[16], sel[2];

    OUT out[16];

    PARTS:
    // Put your code here.


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


}




Downloads :


Boolean Logic : Activity 12

Activity 12 : Build 8 WAY OR using any of the gates previously built


Yes, it says 8 Way OR and not 8 bit..
la la la.. open the book !!






/**
 * 8-way or gate: out = in[0] or in[1] or ... or in[7].
 */

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

    PARTS:
    // Put your code here.
Or(a=in[0], b=in[1], out=p0);
Or(a=p0, b=in[2], out=p1);
Or(a=p1, b=in[3], out=p2);
Or(a=p2, b=in[4], out=p3);
Or(a=p3, b=in[5], out=p4);
Or(a=p4, b=in[6], out=p5);
Or(a=p5, b=in[7], out=out);

}



////////////////////////////////

Downloads :
activity 12


Boolean Logic : Activity 11

Activity 11 : Build 16 bit Mux using (NAND, AND, OR, XOR, MUX, DMUX, 16-AND, 16-OR, 16-NOT)


hmm.. boring !!



/**
 * 16 bit multiplexor. If sel==1 then out=b else out=a.
 */

CHIP Mux16 {
    IN a[16], b[16], sel;
    OUT out[16];

    PARTS:
    // Put your code here.
Mux(a=a[0], b=b[0], sel=sel, out=out[0]);
Mux(a=a[1], b=b[1], sel=sel, out=out[1]);
Mux(a=a[2], b=b[2], sel=sel, out=out[2]);
Mux(a=a[3], b=b[3], sel=sel, out=out[3]);
Mux(a=a[4], b=b[4], sel=sel, out=out[4]);
Mux(a=a[5], b=b[5], sel=sel, out=out[5]);
Mux(a=a[6], b=b[6], sel=sel, out=out[6]);
Mux(a=a[7], b=b[7], sel=sel, out=out[7]);
Mux(a=a[8], b=b[8], sel=sel, out=out[8]);
Mux(a=a[9], b=b[9], sel=sel, out=out[9]);
Mux(a=a[10], b=b[10], sel=sel, out=out[10]);
Mux(a=a[11], b=b[11], sel=sel, out=out[11]);
Mux(a=a[12], b=b[12], sel=sel, out=out[12]);
Mux(a=a[13], b=b[13], sel=sel, out=out[13]);
Mux(a=a[14], b=b[14], sel=sel, out=out[14]);
Mux(a=a[15], b=b[15], sel=sel, out=out[15]);
}


Downloads :