all repos — nand2tetris @ d9dc9bbc7e6402497a0a6889257dcea37a813cd9

my nand2tetris progress

Implement Memory.hdl, add PROGRESS.md
x1phosura x1phosura@x1phosura.zone
Sun, 06 Mar 2022 16:22:50 -0800
commit

d9dc9bbc7e6402497a0a6889257dcea37a813cd9

parent

00037ad962c9c1078a5ba08bd2c627bee5b8ccf7

2 files changed, 32 insertions(+), 2 deletions(-)

jump to
M projects/05/Memory.hdlprojects/05/Memory.hdl

@@ -27,5 +27,25 @@ IN in[16], load, address[15];

OUT out[16]; PARTS: - // Put your code here: -}+ // Note: I just realized that pin names can be mixed-case, so I've changed + // my pin naming convention (I'd _still_ prefer to use underscores if they + // were allowed...) + + // chooses whether value of load goes to RAM16 or memory-mapped screen + DMux(in=load, sel=address[14], a=loadToRAM, b=loadToScreen); + + RAM16K(in=in, address=address[0..13], load=loadToRAM, out=ramOut); + Screen(in=in, address=address[0..12], load=loadToScreen, out=screenOut); + Keyboard(out=keyboardOut); + + // choose between screen and keyboard (selection determined by whether both + // address[13] and address[14] are set + // (An aside: this approach has the added benefit that accessing "invalid + // addresses", which are above 0x6000, simply results in accessing the + // keyboard. I feel clever) + And(a=address[13], b=address[14], out=screenOrKeyboard); + Mux16(a=screenOut, b=keyboardOut, sel=screenOrKeyboard, out=peripheralOut); + + // choose between RAM and screen/keyboard (determined by address[14]); + Mux16(a=ramOut, b=peripheralOut, sel=address[14], out=out); +}
A projects/05/PROGRESS.md

@@ -0,0 +1,10 @@

+ +# Progress + +## TODO +Computer +CPU + +## DONE +Memory +