ALU i.e. Arithmetic & Logic Unit is heart of a processor. The actual 'processing' on the data is carried out by the ALU.
Logic symbol of ALU:
There are two operand inputs to an ALU. The operation performed on them depends on alu-opcode input (not shown in logic symbol). While the operations are performed on both the operands, there are some operations performed on only one operand. The output is result of operation, and there might be a few more outputs like carry-out, overflow-out, auxiliary-carry etc. coming out of ALU.
Although the ALU resides at the core of any processor, it differs across various kinds of processors. The ALU of a general-purpose processor supports a wide range of operations while that of application-specific processor supports only limited operations.
Example : MCS-51 ALU
Refernce :- the opencore mcs-51 design (oc8051).
You can find complete verilog code of 8051 implementation here.
There are large number of inputs & outputs of alu, this is because of various instructions supported by the 8051 family. Mainly, the operations are performed on src1 and src2 depending on op_code and result is out at des_acc (i.e. destination for accumulator register). desCy, desAc, desOv are flag outputs.
The ALU is a combinational circuit, which means it does not need synchronizing clock signal. However, MCS-51 alu is given a clock. This clock is for two operations viz. MUL (multiplication) and DIV (division) which require multiple clock cycles for complete execution. Rest all ALU operations are independant of clock.
Following operations are supported by this ALU (instruction in brackets):
- Addition (ADD)
- Subtraction (SUB)
- Multiplication (MUL)
- Division (DIV)
- Decimal Adjustment (DA)
- logical NOT (NOT) performed on src1 input
- logical AND (AND)
- logical OR (OR)
- logical Ex-OR (XOR)
- Rotate Left (RL)
- Rotate Left with Carry) (RLC)
- Rotate Right (RR)
- Rotate Right with Carry (RRC)
- Increment (INC)
- Exchange lower order nibble (XCH)
For further info about instruction set and in-detail explanation of instructions of MCS-51, click here. Or, download instruction set pdf form keil.
Connect with Digital Byte on facebook to get updates.
Articles and stuff addressing the design issues of a digital processor . . .
Like facebook page to get updates :