Here is my code:
CHIP PC { IN in[16],load,inc,reset; OUT out[16]; PARTS: Inc16(in = regout, out = incout); Mux16(a = regout, b = incout, sel = inc, out = incdecision); Mux16(a = incdecision, b = false, sel = reset, out = resetdecision); Mux16(a = regout, b = resetdecision, sel = load, out = loaddecision); Register(in = loaddecision, load = true, out = regout, out = out); }
Basically, the value coming out of the register increases, which is accepted only if inc is 1 (checked through Mux), which then passes through another Mux, which can reset, and then another Mux, which may or cannot write its depending on the value of the load. Then any value out of this (whether it is a changed value or a value coming from the old register) is placed in the register.
What am I doing wrong?
source share