RAM8:is a memory unit of 8 registers joined together to store 16*8 bits (16 byte). Based on the address (3bits) ,the Dmux8way device control the load signal for each Registers.
CHIP RAM8 {
IN in[16], load, address[3];
OUT out[16];
PARTS:
// load given as input of 8 way Demultipelxer so that 'load' is seperated to control each Registers
DMux8Way(in=load, sel=address, a=a, b=b, c=c, d=d, e=e, f=f, g=g, h=h);
/* 16-Bit register, load is given as each seperated lines
* If load[t-1]=1 then out[t] = in[t-1]
*/
Register(in=in, load=a, out=aa);
Register(in=in, load=b, out=bb);
Register(in=in, load=c, out=cc);
Register(in=in, load=d, out=dd);
Register(in=in, load=e, out=ee);
Register(in=in, load=f, out=ff);
Register(in=in, load=g, out=gg);
Register(in=in, load=h, out=hh);
// 16bit outputs from each Registers connected through 16bit 8 way multiplexer in order to get the outputs based on the Address
Mux8Way16(a=aa, b=bb, c=cc, d=dd, e=ee, f=ff, g=gg, h=hh, sel=address, out=out);
}