# ALU description ambiguity

2 messages
Open this post in threaded view
|
Report Content as Inappropriate

## ALU description ambiguity

 In the ALU.hdl file, the description says the following: // Implementation: the ALU logic manipulates the x and y inputs // and operates on the resulting values, as follows: // if (zx == 1) set x = 0        // 16-bit constant // if (nx == 1) set x = !x       // bitwise not It is not clear to me should the second operation (bitwise not) depend on previous value of x or the first one. If both flags are 1 what should the result be? !x or !0 ? Thank you for your time, this is one of most useful courses in CS ever! :)
Open this post in threaded view
|
Report Content as Inappropriate

## Re: ALU description ambiguity

 Administrator insan-e wrote // Implementation: the ALU logic manipulates the x and y inputs // and operates on the resulting values, as follows: // if (zx == 1) set x = 0        // 16-bit constant // if (nx == 1) set x = !x       // bitwise not It is not clear to me should the second operation (bitwise not) depend on previous value of x or the first one. This is a program-like description of the ALU. If x was a variable, the first "if" will replace the value of x, so the second "if" will affect the new value of x. If zx = nx = 1, then x = ! 0. (0xFFFF or -1.) --Mark