Hi guys I'm getting an error trying to load my ALU.
The error I'm getting is:
An internal pin may only be fed once by a parts output...
My Parts are as follows:
PARTS:
// Put you code here:
//Zero the x input
Mux16(a = x, b[0..15] = false, sel = zx, out = zdx);
//Negate the x input
Not16(in = x, out = notx);
Mux16(a = x, b = notx, sel = nx, out = ndx);
//Zero the y input
Mux16(a = y, b[0..15] = false, sel = zy, out = zdy);
//Negate the y input
Not16(in = y, out = noty);
Mux16(a = y, b = noty, sel = ny, out = ndy);
//compute out = x + y (if f = 1) or x & y (if f = 0)
Or16(a = zdx, b = ndx, out = selx);
Or16(a = zdy, b = ndy, out = sely);
Or16(a = selx, b = sely, out = AddXY);
And16(a = selx, b = sely, out = AndXY);
Mux16(a = AndXY, b = AddXY, sel = f, out = selXY);
//16-bit output
Not16(in = selXY, out = nxy);
Mux16(a = selXY, b = nxy, sel = no, out = c2);
//zr 1 if out == 0
Or16Way(in = c2, out = c3);
Not(in = c3, out = zr);
//ng 1 if out < 0
Splitter16(in = c2, out[1..15] = drop, out[0] = c4);
Mux16(a = c2, b[0..15] = false, sel = c4, out[0..14] = drop, out[15] = ng);
//finally output
Or16(in = c2, b[0..15] = false, out = out);
I also built the chip in Logisim so I could visualize the chip. The picture is below.
Please help with this problem.
Edit:
Also I realized I'm getting the wrong outputs. I think my Or16() gates aren't doing a good job. Gonna have to edit and check.