Inside 8085 Alu
Inside 8085 Alu
Inside 8085 Alu
The following diagram shows the location of the ALU in the 8085.
Labels The ALU is 8 bits wide, with the high-order bit on the left. The
register file is the large block below the ALU. The registers are 16
6502 8085 apple arc arduino bits wide, made up of pairs of 8-bit registers. Surprisingly, the
c# calculator css electronics f# register file has the high-order bit on the right, the opposite order
fractals genome haskell html5 ipv6 ir from the ALU.
java javascript math oscilloscope
photo power supply random
sheevaplug snark spanish theory Z-
80
The ALU takes two 8-bit inputs, which I'll call A and X, and performs
one of five basic operations: ADD, OR, XOR, AND, and SHIFT-RIGHT.
As well, if the input X is inverted, the ALU can perform subtraction
and complement operations. You might think SHIFT-LEFT is missing
from this list. However, it is simply performed by adding the
number to itself, which shifts it to the left one bit in binary. Note
that the 8085 arithmetic operations are very basic. There is no
multiplication or division operation - these were added in the 8086.
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013
Ken Shirriff's blog: Inside the ALU of the 8085 microprocessor Page 2 of 7
The ALU consists of 8 mostly-identical slices, one for each bit. For
addition, each slice of the ALU adds the appropriate input bits,
The webpage cannot be found
computing the sum A + X + carry-in, generating a sum bit and a
carry-out bit. That is, each bit of the ALU implements a full adder.
The logic operations simply operate on the two input bits: A AND X,
Most likely causes: A OR X, A XOR X. Shift-right simply outputs the A bit from the slice
to the right.
• There might be a typing
• If you clicked on
ALU schematic
The following schematic shows one bit of the ALU. The schematic
What you can has roughly the same layout as the implementation on the chip,
flowing from bottom to top. Eight of these circuits are stacked side-
by-side, with the low-order bit on the right. Carries flow from right
Retype the address.
to left, and bits shifted right flow from left to right.
More information
Popular Posts
Apple iPhone charger teardown:
quality in a tiny expensive package
A Multi-Protocol Infrared Remote
Library for the Arduino
A dozen USB
chargers in the lab:
Apple is very good,
but not quite the
best
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013
Ken Shirriff's blog: Inside the ALU of the 8085 microprocessor Page 3 of 7
Inside the ALU of the 8085 second argument, which I'll call X. The / indicates the
microprocessor complement.) For most of the discussion below I'll assume XN is
uncomplemented to keep things simpler.
Operation
Above the complement selector are a few gates labeled Operation
Kids Who Carry Our that perform the desired 2-input operation. The NAND gate on the
Pain left generates either A NAND X or 1 based on the select_op1 control
Robert Hemfelt,
line. The OR gate on the right generates either A OR X or 1, based
Pa...
Best $0.01 on the select_op2 control line. Combining these in the NAND gate
yields four different possibilities:
Privacy Information
Ignoring the shift_right circuit for a moment, the block of gates is
simply the XOR circuit above. Note that XOR with 0 is a no-op,
while XOR with 1 complements the value. And A XOR X XOR CARRY
Blog Archive is the low-order bit of adding A, X, and CARRY.
▼ 2013 (21) The key point of this circuit is that the incoming carry is generated
► September(3) with the proper value to convert the operation output into the
► August(4) desired final result. The incoming carry /carry(N-1) is either 0, 1, or
► July(4) the complemented carry from bit N-1 as appropriate.
► June(2)
► April(1) Op Operation output Carry Result
► March(2)
► February(2)
or A NOR X 1 A OR X
▼ January(3) add A NXOR X /carry A XOR X XOR CARRY
Inside the ALU of the 8085
microprocessor xor A NXOR X 1 A XOR X
Notes on the PLA on the 8085
chip and A AND X 0 A AND X
The 6502 CPU's overflow flag
explained at the sili... shift right 0 0 A(N+1)
► 2012 (10)
complement A NOR /X 1 A OR /X
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013
Ken Shirriff's blog: Inside the ALU of the 8085 microprocessor Page 4 of 7
Generate carry
The circuit on the left, labeled Generate carry generates the carry
out. It can generate three different outputs: 1, 0, or the
(complemented) carry from the sum. If select_op2 is set, it will
force the carry to 0. Otherwise if force_ncarry_1 is set, it will force
the carry to 1. Otherwise, the carry is generated for the sum of A +
X + carry-in through straightforward logic: If the carry-in is set, and
one of the inputs is set, there will be a carry out. If both input bits
are set, there will be a carry out.
Flags
The 8085 has a parity flag, which is 1 if the number of 1 bits is
even, and 0 if the number of parity bits is odd. The parity flag is
generated by XORing all the result bits together (and
complementing). Each bit is XORed with the lower-order parity
value by the parity circuit near the top of the schematic. The XOR
circuit is the same circuit described above.
The zero flag is computed by a simple circuit: each result bit drives
a transistor that will pull the zero line low if the bit is set. This
forms an 8-input NOR gate, spread across the ALU.
or 0 0 0 0
add 0 1 0 0
xor 0 1 0 0
and 0 1 1 0
shift right 0 0 1 1
complement 1 0 0 0
subtract 1 1 0 0
The ALU control lines are generated from the opcode by the
programmable logic array. Specifically, they are outputs from PLA
F, which is to the right of the ALU. More details are inmy article on
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013
Ken Shirriff's blog: Inside the ALU of the 8085 microprocessor Page 5 of 7
the PLA. The ALU has additional control lines to set up the
registers, initialize the carry bits, and set the flags. These control
the differences between different op codes, beyond the categories
above. the I will explain those in a future article.
I took the transistor net and used it to figure out how the ALU
works. First, I converted the transistor net into gates. Next I figured
out which gates are part of the ALU and put them into a schematic.
Then I examined how the circuit worked for different operations
and eventually figured out how it works.
Conclusion
The ALU of the 8085 is an interesting circuit. At first it seemed like
an incomprehensible pile of gates with mysterious control lines, but
after some investigation I figured it out. The 8085 ALU is
implemented very differently from the 6502's ALU (which I'll write
up later). The 6502's ALU uses fairly straightforward circuits to
generate the SUM, AND, XOR, OR, and SHIFT values in parallel, and
then uses a simple pass-transistor multiplexor to pick the desired
operation. This is in contrast to the 8085 ALU, which generates only
the desired value.
8 comments:
Edsaid...
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013
Ken Shirriff's blog: Inside the ALU of the 8085 microprocessor Page 6 of 7
Anonymous said...
en hirri said...
Anonymous said...
en hirri said...
Anonymous said...
en hirri said...
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013
Ken Shirriff's blog: Inside the ALU of the 8085 microprocessor Page 7 of 7
Anonymous said...
Ken Thanks a lot for the answer given. I will check for
other instructions also which have flags reset or set
but not in a very logical way. In the mean time thanks
again and information you have put here is very nice
indeed. From Prad
Post a Comment
http://www.righto.com/2013/01/inside-alu-of-8085-microprocessor.html 04-09-2013