User:Megan Yu/Sandbox: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Megan Yu
(Created page with "Arithmetic Logic Unit Arithmetic Logic Unit (ALU) is the component of the CPU circuit which does the arithmetic calculations and Boolean comparisons. The ALU is a fundamental co...")
 
imported>Megan Yu
No edit summary
Line 1: Line 1:
Arithmetic Logic Unit
== Arithmetic Logic Unit ==
Arithmetic Logic Unit (ALU) is the component of the CPU circuit which does the arithmetic calculations and Boolean comparisons.  The ALU is a fundamental component of a microprocessor and controls basic operations such as maintaining timers to more complex operations of calculation like complex math.


Arithmetic Logic Unit (ALU) is the component of the [[CPU]] which does the [[arithmetic]] calculations and [[Boolean]] comparisons.  The ALU is a fundamental component of a [[microprocessor]] and controls basic operations such as maintaining timers to more complex operations of calculation like complex math.


Numerical System
 
'''Numerical System'''


----
----
Line 11: Line 12:
The one’s complement or two’s complement system allows the ALU to represent negative numbers.  In ALU’s, a number’s complement is determined by the numerical system used; for example, in two’s complement, the binary number is negated and one is added[NB 4].  By using the complement, the ALU does not need a separate subtraction unit; instead, the ALU adds the negated number to perform subtraction.
The one’s complement or two’s complement system allows the ALU to represent negative numbers.  In ALU’s, a number’s complement is determined by the numerical system used; for example, in two’s complement, the binary number is negated and one is added[NB 4].  By using the complement, the ALU does not need a separate subtraction unit; instead, the ALU adds the negated number to perform subtraction.


Inputs and Outputs
'''Inputs and Outputs'''


----
----
Line 26: Line 27:
The ALU outputs include status bits and the data output.  These outputs can be stored in the CPU’s stack memory.
The ALU outputs include status bits and the data output.  These outputs can be stored in the CPU’s stack memory.


Operations
'''Operations'''


----
----
Line 41: Line 42:




Related Units
'''Related Units'''


----
----
Line 47: Line 48:
The floating-point unit (FPU) is performs operations using floating-point numbers.  A floating-point number is any number that requires a decimal point to represent it.  Prior to the invention of FPUs, earlier computers had to use a slow process of integer execution units to perform floating point operations.  Some earlier computer models had a second chip called a math coprocessor that was dedicated to performing floating point calculations.  Most modern computers also include a FPU in addition to an ALU.
The floating-point unit (FPU) is performs operations using floating-point numbers.  A floating-point number is any number that requires a decimal point to represent it.  Prior to the invention of FPUs, earlier computers had to use a slow process of integer execution units to perform floating point operations.  Some earlier computer models had a second chip called a math coprocessor that was dedicated to performing floating point calculations.  Most modern computers also include a FPU in addition to an ALU.


See Also
'''See Also'''


----
----
Line 58: Line 59:
• Stacks
• Stacks


Notes
'''Notes'''


----
----


1. A 1-bit ALU can create a more conventional 8-bit ALU, the 1-bit unit needs to be repeated eight times with the Carry-Out linked to the Carry-In of the next ALU each time.
1. A 1-bit ALU can create a more conventional 8-bit ALU, the 1-bit unit needs to be repeated eight times with the Carry-Out linked to the Carry-In of the next ALU each time.
2. The diagram is an example of 32 one-bit ALUs cascaded together.  SRC1 and SRC2 are the data inputs bits for two numbers, C is the control input, ST is the carry out bits, and DST is the output bits.   
2. The diagram is an example of 32 one-bit ALUs cascaded together.  SRC1 and SRC2 are the data inputs bits for two numbers, C is the control input, ST is the carry out bits, and DST is the output bits.   
3. Multiplication and division are accomplished by shifting and addition.
3. Multiplication and division are accomplished by shifting and addition.
4. Two’s complement takes the original positive value and flips the bits (if the value of a bit was 0 it is now 1 and vice versa) and then adds 1 to the new number.  The most significant bit indicates the number’s sign.  For example, 00001111 represents 15 in base two, the signed value of -15 is represented as 11110001.
4. Two’s complement takes the original positive value and flips the bits (if the value of a bit was 0 it is now 1 and vice versa) and then adds 1 to the new number.  The most significant bit indicates the number’s sign.  For example, 00001111 represents 15 in base two, the signed value of -15 is represented as 11110001.
5. The circuit uses basic logic gates (AND, OR, NOT, XOR) to compose three components: 1) a Logical Unit; 2) a Decoder; and 3) a Full Adder.
5. The circuit uses basic logic gates (AND, OR, NOT, XOR) to compose three components: 1) a Logical Unit; 2) a Decoder; and 3) a Full Adder.
6. The carry-in bit is an input while the carry-out bit is an output.  If two one-bit ALUs were cascaded, the carry-out bit from the first one-bit ALU would be connected to the carry-in bit of the second one-bit ALU.
6. The carry-in bit is an input while the carry-out bit is an output.  If two one-bit ALUs were cascaded, the carry-out bit from the first one-bit ALU would be connected to the carry-in bit of the second one-bit ALU.


References
'''References'''


----
----


1. Arithmetic Logic Units (online source)
1. Arithmetic Logic Units (online source)
2. Arithmetic Logic Unit (ALU) Design (online source)
2. Arithmetic Logic Unit (ALU) Design (online source)
3. ALU (online source)
3. ALU (online source)
4. 32-bit ALU with 5 Functions (online source)
4. 32-bit ALU with 5 Functions (online source)
5. Hwang, Enoch (2006). Digital Logic and Microprocessor Design with VHDL. Thomson. ISBN 0-534-46593-5.
5. Hwang, Enoch (2006). Digital Logic and Microprocessor Design with VHDL. Thomson. ISBN 0-534-46593-5.
6. Floating Point Unit (FPU) (online source)
6. Floating Point Unit (FPU) (online source)
{{Image|Example.jpg|right|250px|Image Caption}}

Revision as of 19:24, 22 November 2011

Arithmetic Logic Unit

Arithmetic Logic Unit (ALU) is the component of the CPU which does the arithmetic calculations and Boolean comparisons. The ALU is a fundamental component of a microprocessor and controls basic operations such as maintaining timers to more complex operations of calculation like complex math.


Numerical System


The numerical system is the format of representation the ALU uses to represent data. The system used in the ALU must match the numerical system used in the rest of the microprocessor (i.e. binary, decimal, hexadecimal, etc.). That is, if an ALU uses binary, then the rest of the microprocessor must also use binary to represent information. Most ALUs use the two’s complement binary number representation, but some older models used one’s complement or sign-magnitude format.

The one’s complement or two’s complement system allows the ALU to represent negative numbers. In ALU’s, a number’s complement is determined by the numerical system used; for example, in two’s complement, the binary number is negated and one is added[NB 4]. By using the complement, the ALU does not need a separate subtraction unit; instead, the ALU adds the negated number to perform subtraction.

Inputs and Outputs


A basic arithmetic logic unit has an adder unit and control inputs. The adder unit performs the mathematical and Boolean operations. The adder can be a half adder, but is usually a full adder.

A half adder has two inputs and has two outputs. Two numbers are inputted into a half adder and the sum and the carry bit are outputted. The carry-bit represents overflow and should be connected to a carry-in bit, but the half adder does not have the capacity for a carry-in bit. Because half adders lack a carry-in bit, half adders cannot be used compositely.

A full adder includes a carry-in bit and a carry-out bit[NB 6]. The carry-in bit can be thought of as the carry over in basic addition (i.e. in 9+2, base ten can carry a maximum value of 9 in each index, so there is overflow in position 100 and one is carried over to the ten’s position, 101).

The ALU cannot generate any control commands. Other components of the CPU create and send commands to the ALU. The ALU reads these commands into its command inputs. The input instruction comes in the form of bits. The ALU processes these bits and, using logic gates, determines the operation the ALU will perform.

The ALU outputs include status bits and the data output. These outputs can be stored in the CPU’s stack memory.

Operations


Simple Operations Most ALUs can perform simple operations such as bitwise logic operations (AND, NOT, OR, XOR), bit-shifting operations, and integer arithmetic operations (addition and subtraction). A fundamental ALU only reads and writes one bit, but these units can be cascaded to facilitate operations[NB 1].

Complex Operations Complex operations can be performed by ALU but require modification of basic ALUs and can be time consuming and expensive to implement. Processor speed, size, and part complexity are limiting factors.

Integer multiplication and division can be implemented on ALUs[NB 3]. These operations are variations of addition functions. Other complex operations can also be implemented. These operations include but are not limited to square roots and cosine.


Related Units


The floating-point unit (FPU) is performs operations using floating-point numbers. A floating-point number is any number that requires a decimal point to represent it. Prior to the invention of FPUs, earlier computers had to use a slow process of integer execution units to perform floating point operations. Some earlier computer models had a second chip called a math coprocessor that was dedicated to performing floating point calculations. Most modern computers also include a FPU in addition to an ALU.

See Also


• CPU • Control Unit • Bitwise logic • Adder (electronics) • Two’s complement • Stacks

Notes


1. A 1-bit ALU can create a more conventional 8-bit ALU, the 1-bit unit needs to be repeated eight times with the Carry-Out linked to the Carry-In of the next ALU each time.

2. The diagram is an example of 32 one-bit ALUs cascaded together. SRC1 and SRC2 are the data inputs bits for two numbers, C is the control input, ST is the carry out bits, and DST is the output bits.

3. Multiplication and division are accomplished by shifting and addition.

4. Two’s complement takes the original positive value and flips the bits (if the value of a bit was 0 it is now 1 and vice versa) and then adds 1 to the new number. The most significant bit indicates the number’s sign. For example, 00001111 represents 15 in base two, the signed value of -15 is represented as 11110001.

5. The circuit uses basic logic gates (AND, OR, NOT, XOR) to compose three components: 1) a Logical Unit; 2) a Decoder; and 3) a Full Adder.

6. The carry-in bit is an input while the carry-out bit is an output. If two one-bit ALUs were cascaded, the carry-out bit from the first one-bit ALU would be connected to the carry-in bit of the second one-bit ALU.

References


1. Arithmetic Logic Units (online source)

2. Arithmetic Logic Unit (ALU) Design (online source)

3. ALU (online source)

4. 32-bit ALU with 5 Functions (online source)

5. Hwang, Enoch (2006). Digital Logic and Microprocessor Design with VHDL. Thomson. ISBN 0-534-46593-5.

6. Floating Point Unit (FPU) (online source)