Unit II
Unit II
The 8085 MPU architecture: 8085 bus organization, demultiplexing the bus AD7-AD0, generating
control signals. ALU, timing and control unit, instruction register and decoder, register array,
decoding and executing an instruction.
The bus organization of the 8085 microprocessor is the way in which the microprocessor
communicates with other devices in a computer system. The 8085 microprocessor has a 16-bit address
bus, an 8-bit data bus, and various control signals that are used to manage data transfer and other
operations.
The address bus is used to specify the memory location or device with which the microprocessor
wants to communicate. It is 16 bits wide, which allows the microprocessor to address up to 64K bytes
of memory. The address bus is unidirectional, which means that data can only flow in one direction
from the microprocessor to the addressed device.
The data bus is used to transfer data between the microprocessor and other devices. It is 8 bits wide,
which means that data can be transferred in byte-sized chunks. The data bus is bidirectional, which
means that data can flow in either direction between the microprocessor and other devices.
In addition to the address and data buses, the 8085 microprocessor has various control signals that are
used to manage data transfer and other operations. These control signals include the read (RD), write
(WR), and hold (HLDA) signals, among others. The RD and WR signals are used to control data
transfer to and from memory or other devices, while the HLDA signal is used to indicate that the
microprocessor is in a hold state and cannot execute instructions.
Bus is a group of conducting wires which carries information, all the peripherals are connected to
microprocessor through Bus. Diagram to represent bus organization system of 8085 Microprocessor.
Multiplexed AD BUS The signal lines AD0 to AD7 in 8085 microprocessors used for dual purpose. They
carry address bits as well as data bits. This is called multiplexed address/data bus. This bus is used as
low order address bus and data bus. The address bus and data bus are multiplexed to reduce
number of pins in the IC package.
Latch To avoid mixing up of address and data bits this must be de-multiplexed. This can be done with
the help of a latch (74LS373). This bus is connected as input to the latch.
Address Latch Enable (ALE) The Address Latch Enable (ALE) signal is connected to the enable pin (G)
of the latch and output control (OC) pin is grounded.
When ALE goes high, the latch is transparent and it enables lower order address bits (A0 to A7).
When ALE goes low, the latch enables lower order data bits (D0 to D7)
3:8 Decoder A 3 to 8 line decoder IC 74138 is used. It has 3-inputs and 8-outputs. Three signals
from the 8085 microprocessor namely read (RD’), write (WR’) and Input Output/Memory
(IO/M’) are connected as input to the decoder. Four output signals are taken from output pins of
decoder.
Control Signals The table list input conditions required or different inputs. • S1, S0 – These are
status signals. They distinguish the various types of operations such as halt, reading, instructions
fetching or writing. • RD’, WR’ – Read and write are two basic control signals for reading and
writing operations respectively.
Functions of the control signals
• MEMR’ – It indicates Memory Read operation
• MEMW’ – It indicates Memory Write operation
• IOR’ – It indicates Input Read operation
• IOW’ – It indicates Output Write operation
The following diagram shows the location of the ALU in the 8085. 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 bits wide, made up of pairs of 8-bit registers. Surprisingly, the register file has the high-order
bit on the right, the opposite order from the ALU.
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.
The ALU consists of 8 mostly-identical slices, one for each bit. For addition, each slice of the
ALU adds the appropriate input bits, 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, A OR X, A XOR X. Shift-right simply outputs
the A bit from the slice to the right.
ALU schematic
The following schematic shows one bit of the ALU. The schematic 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 to left, and bits shifted
right flow from left to right.
Negation
Starting at the bottom of the schematic, is the complex gate labeled Negation. This gate
optionally selects a negated second argument by selecting either XN or /XN. (XN is the Nth bit of
the second argument, which I'll call X. The / indicates the 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 that perform the desired 2-
input operation. The NAND gate on the left generates either A NAND X or 1 based on
the select_op1 control line. The OR gate on the right generates either A OR X or 1, based on
the select_op2 control line. Combining these in the NAND gate yields four different possibilities:
select_op select_op
Result
1 2
0 0 A NOR X
0 1 0
1 0 A NXOR X
1 1 A AND X
Note that instead of OR and XOR, the complemented value is produced by this circuit. This will
be fixed in the next step.
To understand this circuit, first consider the following simple XOR circuit, which is used a couple
times in the ALU. It can be understood fairly simply: if both inputs are 0 (top) or both inputs are
1 (bottom) then the output is 0.
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 is the low-order bit of adding A, X, and CARRY.
The key point of this circuit is that the incoming carry is generated with the proper value to
convert the operation output into the desired final result. The incoming carry /carry(N-1) is either
0, 1, or the complemented carry from bit N-1 as appropriate.
or A NOR X 1 A OR X
complemen
A NOR /X 1 A OR /X
t
Note that the carry-in line must have the right value in order to generate the appropriate output.
For addition it passes the inverted carry from one bit to the next. But for OR, XOR, the line is set
to 1. And for AND and SHIFT_RIGHT it is set to 0. As will be seen below, the carry circuitry
generates the right value for the right operation.
The final aspect of this circuit is the shift-right circuit. With a 0 op input, 0 carry input, and
shift_right set, the output is simply the bit from the right: A(N+1).
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 bit 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.
INR,DCR,RLC,DAD,RAL,DAA,A
add 0 1 0 0 0 DD,ADC,ADI,ACI (and
undocumented LDSI,LDHI,RDEL)
xor 0 1 0 0 1 XRA,XRI
and 0 1 1 0 1 ANA,ANI
shift
0 0 1 1 1 RRC,RAR (ARHL)
right
comple
1 0 0 0 1 CMA
ment
SUB,SBB,SUI,SBI,CMP,CPI
subtract 1 1 0 0 0
(DSUB)
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
in my article on the PLA. The ALU has additional control lines to set up the registers, initialize
the carry bits, and set the flags.
2. While in “Shift-IR” state, keep TMS = 0 for the next 3 clock cycles to serially shift-in the data
(1100) through TDI.
NOTE: 3 clock cycles to shift 4 bits data because the LSB (logic 0) of data 1100 was made available
in the TDI port after 4th clock, thus in the 5th clock itself the LSB was loaded when the FSM entered
the “Shift-IR” state. The MSB (logic 1) of data 1100 was shifted in 8 th clock. You can refer the
example shown here for a better understanding.
3. Move to “Update-IR” state from the “Shift-IR” state by applying –
TMS = 1 (9th clock)
TMS = 1 (10 clock)
th
When the FSM entered the “Update-IR” state, the data (1100) in the Shift Register was loaded to the
Hold Register in parallel. Thus the instruction is now made available for the instruction decoder.
Instruction Decoder
The instruction from the Instruction Register (IR) is fed to a decoder logic, which selects the Data
Register for JTAG operation. We assign a unique value (or opcode) to each and every Data Register in
the JTAG. In order to select a Data Register, we load the IR with the corresponding opcode and the
Instruction Decoder decodes the value and establishes an access path between the TDI/TDO and the
required Data Register.
Suppose we have two Data Registers DR-1 and DR-2, and a 4 bits Instruction Register in our JTAG.
So we will assign opcodes to the Data Registers and specify the same to the IR –
DR-1 (say opcode = 4’b0010)
DR-2 (say opcode = 4’b0011)
NOTE: 4 bits opcode, because the IR is 4 bits.
If we want to access DR-2 for any JTAG operation, then we have to load the instruction register with
a value 4’b0011 and the instruction decoder will be able to decode this value to select the DR-2.
The CPU executes the instructions regarding a program stored in the memory. There’s one general
rule applied to all these instructions being carried out in the processors. The execution definition is
outlined by a cycle of instructions conducted in the particular execution. This cycle, better known as
the instruction cycle, has three stages – fetch, decode and execute.