I'm a bit confused on the Zr/Ng part of the ALU. I was able to construct the part with all 6 Mux16's, based on what I was told in class and what I read on other posts. I think I have the zx, nx,...,no inputs figured out. If someone would like to see that, I can email it or something.
Based on what I saw from
another post, it seems like you take the output f(x,y). If it is zero, zr = 1, otherwise it is 0. And if output f(x,y) < 0, then ng = 1, otherwise it's 0.
The only thing the book says about zr and ng is this:
if out=0 then zr = 1 else zr = 0 // 16-bit eq. comparison
if out<0 then ng = 1 else ng = 0 // 16-bit neg. comparison
I'm not exactly sure where to go from here. The last thing I have done is negating the output. After that, I feel lost.
// Negate the output
Not16(in=xyOut, out=xyNot);
Mux16(a=xyOut, b=xyNot, sel=no, out=out);
// Zr/Ng