Professional Documents
Culture Documents
5/2/2014
Sequential Machine
A digital computer is a sequential machine. The CPU (microprocessor) executes instructions in a sequence as specified by the program. In general terms the instructions are executed in the sequence they are written. However a certain class of instruction can vary the instruction execution sequence.
5/2/2014
Provide a storage facility for the data that is to be manipulated by those instructions.
5/2/2014 3
5/2/2014
Instruction Fetch
Processor places address of where the instruction is stored onto address bus Processor asserts the read control line The memory device places the data at the addressed location onto the data bus The processor reads the instruction byte.
5/2/2014 5
Instruction Format
Instructions are stored in program memory in binary coded form. Since an instruction must represent a complete and unambiguous statement of the operation required of the processor then 8-bits (the number of bits of a single memory location) is often insufficient to specify the complete instruction. Depending on the particular instruction, 8085A instructions occupy one, two or three successive memory locations.
5/2/2014 6
The Opcode
The first byte of an instruction is called the Opcode It describes :
The operation to be carried out e.g move data, arithmetic operation, logical operation etc
Example of Opcode
Consider the instruction: STA addr Opcode in assembly language form STA Opcode in machine language form (i.e. the bits that are actually stored in memory) 00110010 (32H)
The opcode specifies : Data is to be moved The source of the data is the CPU register A The destination for the data is external memory The complete instruction is three bytes long
Bytes 2 & 3 of the instruction specify the address of the memory location where the data is to be written.
5/2/2014 8
5/2/2014
; PC incremented
; address of byte 2
5/2/2014
5/2/2014
13
5/2/2014
14
5/2/2014
15
Can be concatenated to form 3X 16-bit registers with addresses BC, DE & HL.
Note : 16-bit register HL used as a memory pointer with many 8085A instructions.
(e.g MOV A, M which copies the contents of the memory location whose address is specified by the contents of the HL register pair to the CPU register A)
(Note the assembly language instruction format MOV <destination> <source>)
16-bit register SP. It contains the address of the memory location of the top of the stack area of memory. It is automatically controlled by the processor but can be initialised by software. 5/2/2014
16
LXI
SP, data 16
17
Data is automatically transferred from the stack area of memory to the program counter whenever the processor executes a return (ret) instruction.
5/2/2014 18
The stack pointer is decremented by 1 (sp=2097) and the contents of L are written to this location.
Note : When data is written to the stack the stack pointer is first decremented and then the data is written
19
5/2/2014
5/2/2014
21
5/2/2014
22
The decimal adjust unit allows the ALU to perform BCD arithmetic. (rarely used as it is usual to use binary, as opposed to BCD, arithmetic)
5/2/2014 23
The Sign Flag (S) reflects the contents of bit-7 of the accumulator
The Zero Flag (Z) is set to 1 if the accumulator contains all zeros The Auxiliary Carry (AC) is a 1 if the arithmetic operation caused a carry out from the bit-3 to the bit-4 position. (The auxiliary carry flag is used in BCD arithmetic) The Parity Flag (P) is a 1 if the accumulator has an even number of 1s The Carry Flag (CY) is set if the arithmetic operation caused a carry overflow (from addition) or a borrow (from subtraction).
24
5/2/2014
; A contains 88 (H)
10001000 10011001
_____________
B contains 99 (H)
136 153
_____ decimal decimal decimal
100100001
289
Bit D7 = 0 after addition The accumulator contains other than zero after addition There is a carry out of bit D3 to bit D4 during addition The accumulator contains an even number of 1s after addition There is an overflow as a result of the addition
25
5/2/2014
It has associated with it a number of inputs and outputs, both from other subsystems of the CPU and from external devices.
It operates with respect to a stable clock reference signal provided by a crystal source. Typical clock frequencies for an 8085A microprocessor are in the order of 5-MHz. The internal clock for the control logic is half the frequency of the external crystal source (i.e internally the crystal source clock is divided by 2)
5/2/2014 26
5/2/2014
27
WR (o)
A logic 0specifies that the processor has placed data (write) onto the data bus for an external device to read. processor is performing. (e.g 110 specifies the processor is fetching an opcode from program memory).
5/2/2014
28
HOLD (i) HLDA (o) An external device can request use of the system
busses by driving the HOLD input to logic 1. The 8085A acknowledges the request by asserting the HLDA output to logic 1. It only does after it has relinquished control of the bus structure.
ALE (o) When this signal is logic 1 the processor specifies that
it has valid address information on the CPU pins AD07
5/2/2014
30
Address Latches
Peripheral devices ( memory and IO ) require stable address data throughout a read or write operation. The processor only provides A0 - A7 during the period ALE is in the logic 1 state after which the multiplexed lines AD0 - AD7 assume the role of the data bus. ( D0 - D7 )
To provide external devices with stable address data throughout a read or write operation it is necessary to latch the low byte of the address using the ALE control signal.
By this mechanism it is possible for the 8085A computer system to have a 16-bit address bus and an 8-bit data bus whilst only using 16 processor connections ( AD0 - AD7 and A8 - A15 )
5/2/2014
31
Note : See through latches ( eg 74LS573 ) are the preferred type of latch. When clk (ALE) is logic 1 the latch outputs follow the inputs and on the negative edge of clk the data is latched.
5/2/2014 32