diff --git a/projects/05/CPU.hdl b/projects/05/CPU.hdl index 658f47a..dfd8a63 100644 --- a/projects/05/CPU.hdl +++ b/projects/05/CPU.hdl @@ -41,7 +41,25 @@ CHIP CPU { PARTS: // Put your code here: - // 1. A/C-Instruction - Not(in=instruction[15],out=inst) - Mux(a=outM,) + + //Controlbus + // A/C-Instruction and Controlbus + Not(in=instruction[15],out=on); + OR(a=on,b=instruction[5],out=); + AND(a=instruction[15],b=instruction[12],out=); + AND(a=instruction[15],b=instruction[4],out=); + AND(a=instruction[15],b=instruction[3],out=); + AND(a=instruction[15],b=instruction[0],out=); + AND(a=instruction[15],b=instruction[1],out=); + AND(a=instruction[15],b=instruction[2],out=); + Not(in=zr,out=notzr); + Not(in=ng,out=notng); + AND(a=notzr,b=notng,out=); + AND(a=,b=,out=); + AND(a=,b=,out=); + AND(a=,b=,out=); + OR(a=,b=,out=); + OR(a=,b=,out=); + + Mux16(a=outM,b=instruction,sel=on,out=) } \ No newline at end of file