PolarBear wrote
I built my ALU, but when I go to run it when the X values are all 0 and the Y values are all 1, it runs fine until the output should be something like 0000000000000001 or 1111111111111110 then it errors out on me.
Also when the X=0000000000010001 Y=0000000000000011 it seems to error out on each one.
I've been racking my brain trying to figure it out. I'm betting it is something easy that I'm just not seeing.
Maybe if someone can explain how the ALU can end up with an out of 0000000000000001 when X=0000000000000000 Y=1111111111111111
For the test line that is failing, all the control bits are TRUE, so the ALU is to compute the "constant 1" function (figure 2.6). The actual computation is ~((~0)+(~0)). If you are having trouble understanding how this computation results in 1, check out
this worksheet.
Also, so that you can concentrate on the computation first,
this post has ALU test files that ignore the status outputs.
--Mark