order of operations in ALU

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

order of operations in ALU

John Douma
The specification of the ALU seems to be vague concerning the negation and zeroing of bits. For example, if x is -1, i.e. 16 bits all equal to 1 and we specify zx = 1 and nx =1, which should occur first? If I zero, then negate I get -1 but if I negate and then zero I get 0.
Reply | Threaded
Open this post in threaded view
|

Re: order of operations in ALU

culchie
The zero is done before the negate.

ie zy is applied before ny as this extract from page 35 says

The zx and nx bits are 0, so the x input is neither zeroed nor negated.
The zy and ny bits are 1, so the y input is first
zeroed, and then negated bit-wise
.
Also if you look at the truth table for the ALU in figure 2.6 (page 37) and at look at the output for the various inputs
you can see that the zeroing must come first