Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JackDraak's HACK project (NAND2Tetris) [22 Feb 2018]
- CHIP PC {
- IN in[16],load,inc,reset;
- OUT out[16];
- PARTS:
- Register(load=rload, in=loriorr, out=regout, out=out); // Increment
- Inc16(in=regout, out=incout); // Throw away overflow
- Mux16(sel=load, a=incout, b=in, out=lori); // Load
- Mux16(sel=reset, a=lori, b=false, out=loriorr); // Reset
- Nand(a=true, b=load, out=aout);
- Nand(a=true, b=inc, out=bout);
- Nand(a=true, b=reset, out=cout);
- Nand(a=aout, b=bout, out=about);
- Nand(a=true, b=about, out=abnot);
- Nand(a=abnot, b=cout, out=rload); // load + inc + reset
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement