Move

Selamat Datang Ke Blog Kami

Renung-Renungkan Dan Selamat Membaca

Sunday, October 21, 2012


What is ALU?

The arithmetic logic unit (ALU) is at the “heart” of a processor—you could say that everything else in the computer is there to support the ALU. ALU is the device that performs
the arithmetic operations like addition and subtraction or logical operations
like AND and OR. This section constructs an ALU from four hardware
building blocks (AND and OR gates, inverters, and multiplexors) and illustrates
how combinational logic works. In the next section, we will see how addition can
be sped up through more clever designs.

  • That circuit has two four-bit data inputs X and Y, and a function selection input Sub.
  • The four-bit output G is either X + Y or X –Y, depending on the value of the Subinput.

  • This circuit is based on a four-bit unsigned adder, which always outputs the sum of its inputs,                S = A + B + CI.
  • To perform addition or subtraction, all we did was vary adder inputs A, Band CI according to the arithmetic unit inputs X, Y and Sub.
  • The output G of the arithmetic unit comes right out of the adder.

Sub
Adder inputs
  A      B      CI
Adder output
S
0
1
  Y      X      0
  Y’     X      1
X+Y
X-Y

 



  • Here is a diagram of our arithmetic unit so far.




      S2     S1
   A
0             0
0             1
1             0
1             1
0000
  Y
  Y’
1111
  • We’ve already set the adder inputs B to X and CI to S0, as explained on the previous page.
  • All that’s left is to generate adder input A from the arithmetic unit input Y and the function selection code bits S2 and S1.
  • From the table above, we can see that adder input A should be set to 0000, Y, Y’or 1111, depending on S2 and S1.

  • Most computers also support logical operations like AND, OR and NOT, but extended to multi-bit words instead of just single bits.
  • We’ve already seen this informally in two’s complement arithmetic, when we talked about complementing all the bits in a number.

























No comments:

Post a Comment