From 7ce33ecd1734f5a83afb55b8311b541d17cbbd6f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 8 Dec 2017 13:51:31 +0100 Subject: finished project 3 --- projects/03/a/PC.hdl | 16 ++++++++++++---- projects/03/a/PC.out | 28 +++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 5 deletions(-) (limited to 'projects/03') diff --git a/projects/03/a/PC.hdl b/projects/03/a/PC.hdl index 817ff67..aba68d1 100644 --- a/projects/03/a/PC.hdl +++ b/projects/03/a/PC.hdl @@ -17,8 +17,16 @@ CHIP PC { PARTS: // Put your code here: - Register (in=in, load=load, out=regout); - Inc16 (in=regout, out=incout); - Mux16 (a=incout, b=regout, sel=load, out=regincout); - Mux16 (a=regout, b=false, sel=reset, out=out); + Mux16 (a=out5, b=in, sel=load, out=out0); + Inc16 (in=out0, out=out1); + Mux16 (a=out1, b=out0, sel=load, out=out2); + Mux16 (a=out0, b=out2, sel=inc, out=out3); + Mux16 (a=out3, b=false, sel=reset, out=out4); + Register (in=out4, load=true, out=out5, out=out); + + //Inc16 (in=out4, out=out0); + //Mux16 (a=out4, b=out0, sel=inc, out=out1); + //Mux16 (a=out1, b=in, sel=load, out=out2); + //Mux16 (a=out2, b=false, sel=reset, out=out3); + //Register (in=out3, load=true, out=out4, out=out); } diff --git a/projects/03/a/PC.out b/projects/03/a/PC.out index 8bd9bf5..5eca76b 100644 --- a/projects/03/a/PC.out +++ b/projects/03/a/PC.out @@ -2,4 +2,30 @@ | 0+ | 0 | 0 | 0 | 0 | 0 | | 1 | 0 | 0 | 0 | 0 | 0 | | 1+ | 0 | 0 | 0 | 1 | 0 | -| 2 | 0 | 0 | 0 | 1 | 0 | +| 2 | 0 | 0 | 0 | 1 | 1 | +| 2+ | -32123 | 0 | 0 | 1 | 1 | +| 3 | -32123 | 0 | 0 | 1 | 2 | +| 3+ | -32123 | 0 | 1 | 1 | 2 | +| 4 | -32123 | 0 | 1 | 1 | -32123 | +| 4+ | -32123 | 0 | 0 | 1 | -32123 | +| 5 | -32123 | 0 | 0 | 1 | -32122 | +| 5+ | -32123 | 0 | 0 | 1 | -32122 | +| 6 | -32123 | 0 | 0 | 1 | -32121 | +| 6+ | 12345 | 0 | 1 | 0 | -32121 | +| 7 | 12345 | 0 | 1 | 0 | 12345 | +| 7+ | 12345 | 1 | 1 | 0 | 12345 | +| 8 | 12345 | 1 | 1 | 0 | 0 | +| 8+ | 12345 | 0 | 1 | 1 | 0 | +| 9 | 12345 | 0 | 1 | 1 | 12345 | +| 9+ | 12345 | 1 | 1 | 1 | 12345 | +| 10 | 12345 | 1 | 1 | 1 | 0 | +| 10+ | 12345 | 0 | 0 | 1 | 0 | +| 11 | 12345 | 0 | 0 | 1 | 1 | +| 11+ | 12345 | 1 | 0 | 1 | 1 | +| 12 | 12345 | 1 | 0 | 1 | 0 | +| 12+ | 0 | 0 | 1 | 1 | 0 | +| 13 | 0 | 0 | 1 | 1 | 0 | +| 13+ | 0 | 0 | 0 | 1 | 0 | +| 14 | 0 | 0 | 0 | 1 | 1 | +| 14+ | 22222 | 1 | 0 | 0 | 1 | +| 15 | 22222 | 1 | 0 | 0 | 0 | -- cgit v1.2.3