forked from ccccourse1/co110a
-
Notifications
You must be signed in to change notification settings - Fork 0
week6
Soober9260 edited this page Jan 12, 2022
·
1 revision
CHIP RAM64 {
IN in[16], load, address[6];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load,sel=address[3..5],a=DM0,b=DM1,c=DM2,d=DM3,e=DM4,f=DM5,g=DM6,h=DM7);
RAM8(in=in,load=DM0,address=address[0..2],out=r0);
RAM8(in=in,load=DM1,address=address[0..2],out=r1);
RAM8(in=in,load=DM2,address=address[0..2],out=r2);
RAM8(in=in,load=DM3,address=address[0..2],out=r3);
RAM8(in=in,load=DM4,address=address[0..2],out=r4);
RAM8(in=in,load=DM5,address=address[0..2],out=r5);
RAM8(in=in,load=DM6,address=address[0..2],out=r6);
RAM8(in=in,load=DM7,address=address[0..2],out=r7);
Mux8Way16(a=r0,b=r1,c=r2,d=r3,e=r4,f=r5,g=r6,h=r7,sel=address[3..5],out=out);
}
CHIP RAM512 {
IN in[16], load, address[9];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load,sel=address[6..8],a=DM0,b=DM1,c=DM2,d=DM3,e=DM4,f=DM5,g=DM6,h=DM7);
RAM64(in=in,load=DM0,address=address[0..5],out=r0);
RAM64(in=in,load=DM1,address=address[0..5],out=r1);
RAM64(in=in,load=DM2,address=address[0..5],out=r2);
RAM64(in=in,load=DM3,address=address[0..5],out=r3);
RAM64(in=in,load=DM4,address=address[0..5],out=r4);
RAM64(in=in,load=DM5,address=address[0..5],out=r5);
RAM64(in=in,load=DM6,address=address[0..5],out=r6);
RAM64(in=in,load=DM7,address=address[0..5],out=r7);
Mux8Way16(a=r0,b=r1,c=r2,d=r3,e=r4,f=r5,g=r6,h=r7,sel=address[6..8],out=out);
}
CHIP RAM4K {
IN in[16], load, address[12];
OUT out[16];
PARTS:
// Put your code here:
DMux8Way(in=load,sel=address[9..11],a=DM0,b=DM1,c=DM2,d=DM3,e=DM4,f=DM5,g=DM6,h=DM7);
RAM512(in=in,load=DM0,address=address[0..8],out=r0);
RAM512(in=in,load=DM1,address=address[0..8],out=r1);
RAM512(in=in,load=DM2,address=address[0..8],out=r2);
RAM512(in=in,load=DM3,address=address[0..8],out=r3);
RAM512(in=in,load=DM4,address=address[0..8],out=r4);
RAM512(in=in,load=DM5,address=address[0..8],out=r5);
RAM512(in=in,load=DM6,address=address[0..8],out=r6);
RAM512(in=in,load=DM7,address=address[0..8],out=r7);
Mux8Way16(a=r0,b=r1,c=r2,d=r3,e=r4,f=r5,g=r6,h=r7,sel=address[9..11],out=out);
}
CHIP RAM16K {
IN in[16], load, address[14];
OUT out[16];
PARTS:
// Put your code here:
DMux4Way(in=load,sel=address[12..13],a=DM0,b=DM1,c=DM2,d=DM3);
RAM4K(in=in,load=DM0,address=address[0..11],out=r0);
RAM4K(in=in,load=DM1,address=address[0..11],out=r1);
RAM4K(in=in,load=DM2,address=address[0..11],out=r2);
RAM4K(in=in,load=DM3,address=address[0..11],out=r3);
Mux4Way16(a=r0,b=r1,c=r2,d=r3,sel=address[12..13],out=out);
}
CHIP PC {
IN in[16],load,inc,reset;
OUT out[16];
PARTS:
// Put your code here:
Inc16(in=PC,out=PCI);
Mux16(a=PC,b=PCI,sel=inc,out=PCN);
Mux16(a=PCN,b=in,sel=load,out=Load);
Mux16(a=Load,b=false,sel=reset,out=Re);
ter(in=Re,load=true,out=PC,out=out);
}