// 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/03/b/RAM512.hdl /** * Memory of 512 registers, each 16 bit-wide. Out holds the value * stored at the memory location specified by address. If load==1, then * the in value is loaded into the memory location specified by address * (the loaded value will be emitted to out from the next time step onward). */ CHIP RAM512 { IN in[16], load, address[9]; OUT out[16]; PARTS: // Put your code here: DMux8Way(in=load, sel[0..2]=address[6..8], a=load0, b=load1, c=load2, d=load3, e=load4, f=load5, g=load6, h=load7); RAM64(in[0..15]=in[0..15], load=load0, address[0..5]=address[0..5], out[0..15]=out0); RAM64(in[0..15]=in[0..15], load=load1, address[0..5]=address[0..5], out[0..15]=out1); RAM64(in[0..15]=in[0..15], load=load2, address[0..5]=address[0..5], out[0..15]=out2); RAM64(in[0..15]=in[0..15], load=load3, address[0..5]=address[0..5], out[0..15]=out3); RAM64(in[0..15]=in[0..15], load=load4, address[0..5]=address[0..5], out[0..15]=out4); RAM64(in[0..15]=in[0..15], load=load5, address[0..5]=address[0..5], out[0..15]=out5); RAM64(in[0..15]=in[0..15], load=load6, address[0..5]=address[0..5], out[0..15]=out6); RAM64(in[0..15]=in[0..15], load=load7, address[0..5]=address[0..5], out[0..15]=out7); Mux8Way16(a[0..15]=out0, b[0..15]=out1, c[0..15]=out2, d[0..15]=out3, e[0..15]=out4, f[0..15]=out5, g[0..15]=out6, h[0..15]=out7, sel[0..2]=address[6..8], out[0..15]=out[0..15]); }