feat: small inline things

This commit is contained in:
2026-02-01 22:27:36 +01:00
parent 63ba6439ac
commit de9a24a50a

View File

@@ -27,15 +27,15 @@
// if (no == 1) sets out = !out // bitwise not // if (no == 1) sets out = !out // bitwise not
CHIP ALU { CHIP ALU {
IN IN
x[16], y[16], // 16-bit inputs x[16], y[16], // 16-bit inputs
zx, // zero the x input? zx, // zero the x input?
nx, // negate the x input? nx, // negate the x input?
zy, // zero the y input? zy, // zero the y input?
ny, // negate the y input? ny, // negate the y input?
f, // compute (out = x + y) or (out = x & y)? f, // compute (out = x + y) or (out = x & y)?
no; // negate the out output? no; // negate the out output?
OUT OUT
out[16], // 16-bit output out[16], // 16-bit output
zr, // if (out == 0) equals 1, else 0 zr, // if (out == 0) equals 1, else 0
ng; // if (out < 0) equals 1, else 0 ng; // if (out < 0) equals 1, else 0
@@ -64,12 +64,12 @@ CHIP ALU {
// no // no
Not16(in=fOut, out=notF); Not16(in=fOut, out=notF);
Mux16(a=fOut, b=notF, sel=no, Mux16(a=fOut, b=notF, sel=no,
// variable wire // variable wire
out[0..7]=finalResultp1, out[0..7]=finalResultp1,
out[8..15]=finalResultp2, out[8..15]=finalResultp2,
// out // out
out=out, out=out,
out[15]=ng out[15]=ng
); );
//zr //zr
@@ -82,9 +82,4 @@ CHIP ALU {
//ng //ng
// output from Mux16 in no // output from Mux16 in no
}
//// Replace this comment with your code.
}