ALU Order of Operations

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

ALU Order of Operations

AntigrainWarhead
I'm not sure in what order exactly the nx and zx orders are supposed to be carried out. Does the result of nx get fed into zx, or the other way around? Or does nx, zx, and x (regular, without being operated on) all process, and then a DMux4Way16 chooses between those three options?

The same question applies to ny and zy.
Reply | Threaded
Open this post in threaded view
|

Re: ALU Order of Operations

WBahn
Administrator
AntigrainWarhead wrote
I'm not sure in what order exactly the nx and zx orders are supposed to be carried out. Does the result of nx get fed into zx, or the other way around? Or does nx, zx, and x (regular, without being operated on) all process, and then a DMux4Way16 chooses between those three options?

The same question applies to ny and zy.
This is one thing that the text could have made clearer by not using the same name for what are, in reality, different signals. But the text does make it clear that the inputs to the ALU are modified in sequence and what that sequence is:

In the First Edition of the text, this is done by example:

1Ed: Section 2.2.2 (p35)
"For example, let us consider the twelfth row of figure 2.6, where the ALU is instructed to compute the function x-1. 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."

In the Second Edition of the text, they made this more explicit:

2ed: Section 2.5.2 (p39)
"These six directives are to be performed in order: first, we either set the x and y inputs to 0, or not; next, we either negate the resulting values, or not; next, we computer either + or & on the preprocessed values; and finally, we either negate the resulting value, or not."

A clearer description, from an implementation standpoint, would have been:

ALU inputs are x and y, output is z:

IF (zx = 1) THEN x1 = 0 ElSE x1 = x
IF (nx = 1) THEN x2 = !x1 ElSE x2 = x1

IF (zy = 1) THEN y1 = 0 ElSE y1 = y
IF (ny = 1) THEN y2 = !y1 ElSE y2 = y1

IF (f = 0) THEN z0 = x2+y2 ELSE z0 = x2&y2

IF (no = 0) THEN z = !z0 ELSE z = z0