Blog‎ > ‎

Absolute Value Finder Circuit

posted Mar 20, 2018, 7:09 AM by MUHAMMAD MUN`IM AHMAD ZABIDI   [ updated Mar 20, 2018, 7:13 AM ]
An absolute value finder circuit always give a positive output.

Algorithm:

if (x<0)
  y = -x;
else
 y = x;



For an n-bit input word, bit xn-1 is the sign bit. This bit control the (n-1) units of 2:1 multiplexers.
If xn-1 = 0, the input bits xn-2:0 are passed unchanged to the adder. If xn-1 = 1, the input bits xn-2:0 are inverted before going to the adder. Effectively, xn-1 selects either the original x or the one's complement of x.

The carry in to the adder get xn-1 itself.  Therefore, if xn-1 = 0, the adder performs X + 0, and if xn-1 = 1, the adder performs X'+1. Since X' or the ones' complement plus 1 is the two's complement of X, the output of the adder is -X if the original input X is negative.

The sign bit of the output is always 0. So yn-1 is permanently connected to GND.








Comments