moarmango wrote
I haven't started the ALU yet, but was also getting negation mixed up as well when observing the chart. I am assuming for simplicity sake, that negation throughout the chart refers to logical negation? Also regarding arithmetic negation, is this already built into the hardware simulator when running the ALU? Observing the inputs and outputs in decimal notation on other tests, it seems negative and positive designation is already in place.
Yes, although the text only explicitly says "bit-wise" for ny, figure 2.5 is quite clear:
* The ALU operation can be described using the following pseudocode:
* if zx=1 set x = 0 // 16-bit zero constant
* if nx=1 set x = !x // Bit-wise negation
* if zy=1 set y = 0 // 16-bit zero constant
* if ny=1 set y = !y // Bit-wise negation
* if f=1 set out = x + y // Integer 2's complement addition
* else set out = x & y // Bit-wise And
* if no=1 set out = !out // Bit-wise negation
*
Data stored in memory doesn't inherently have a sign. In fact, it doesn't inherently have a numeric value. It's all a matter of how we choose to interpret it. The binary value 1010011100110010 could be interpreted as the unsigned number 42802, the signed number -22734, the characters "ยง2", or maybe none of the above. It might be part of the pixel pattern of a graphic character.
The Hardware Simulator can display values as signed decimal, binary or hexadecimal. The test script controls how values are displayed in the output file. There is a menu that controls how the simulator displays other values.
--Mark