Professional Documents
Culture Documents
Unit 4
Unit 4
Unit 4
The data register (DR) holds the operand read from memory.
The accumulator (AC) register is a general purpose processing register.
The instruction read from memory is placed in the instruction register (IR).
The temporary register (TR) is used for holding temporary data during the
processing.
The memory address register (AR) has 12 bits.
The program counter (PC) also has 12 bits and it holds the address of the next
instruction be read from memory.
The input register (INPR) receives an 8-bit character from an input device.
The output register (OUTR) holds an 8-bit character for an output device.
Give the list of Memory Reference Instruction. Explain
any Three of It
AND to AC
This is an instaruction that perform the AND logic operation on pairs of bits in AC
and the memory word specified by the effective address. The result of the operation
is transferred to AC . The microoperations that execute this instruction are:
D0T4:DR<-M[AR]
D0T5:AC<-AC/\DR, SC<---0
The control function for this instruction uses the operation decoder D0 since this
output of the decoder is active when the instruction has an AND operation whose
binary code value 000. Two timing signals are needed to execute the instaruction.
The clock transition associared with timing signal T4 transfers the operand from
memory into DR . The clock transition associated with the next timing signal T5
transfers to AC the result of the AND logic operation between the contents of DR
and AC. The same clock transition clears SC to 0, transferring control to timing
signal T0 to start a new instruction cycle.
ADD to AC
This instruction adds the content of the memory word specified by the effective
address to the value of AC . The sum is transferred into AC and the output carry
Cout is transferred to the E (extended accumulator) flip-flop. The rnicrooperations
needed to execute this instruction are
D1T4:DR←M[AR]
D1T5: AC← AC + DR, E← Cout , SC ← 0
Same Two timing signals, T, and T5, are used again but with operation decoder D1
instead of D0, which was used for the AND instruction. After the instruction is
fetched from memory and decoded, only one output of the operation decoder will be
active, and that output determines the sequence of microoperations that the control
follows during the execution of a memory-reference instruction.
LDA: Load to AC
This instruction transfers the memory word specified by the effective address to AC.
The microoperations needed to execute this instruction are
Looking back at the bus system shown in Fig. 5-4 we note that there is no direct path
from the bus into AC . The adder and logic circuit receive information from DR which
can be transferred into AC . Therefore, it is necessary to read the memory word into
DR first and then transfer the content of DR into AC . The reason for not connecting
the bus to the inputs of AC is the delay encountered in the adder and logic circuit. It
is assumed that the time it takes to read from memory and transfer the word through
the bus as well as the adder and logic circuit is more than the time of one clock cycle.
By not connecting the bus to the inputs of AC we can maintain one clock cycle per
microoperation.
STA: Store AC
This instruction stores the content of AC into the memory word specified by the
effective address. Since the output of AC is applied to the bus and the data input of
memory is connected to the bus, we can execute this instruction with one
microoperation:
The result of this operation is shown in part (b) of the figure. The return address 21
is stored in memory location 135 and control continues with the subroutine program
starting from address 136. The return to the original program (at address 21) is
accomplished by means of an indirect BUN instruction placed at the end of the
subroutine. When this instruction is executed, control goes to the indirect phase to
read the effective address at location 135, where it finds the previously saved address
21. When the BUN instruction is executed, the effective address 21 is transferred to
PC . The next instruction cycle finds PC with the value 21, so control continues to
execute the instruction at the return address.
Draw the Flow-Chart of Memory Reference
Instruction
The input register INPR consists of eight bits and holds an alphanumeric input
information. The 1-bit input flag FGI is a control flip-flop. The flag bit is set to 1 when
new information is available in the input device and is cleared to 0 when the
information is accepted by the computer. The flag is needed to synchronize the timing
rate difference between the input device and the computer. The process of
information transfer is as follows. Initially, the input flag FGI is cleared to 0. When a
key is struck in the keyboard, an 8-bit alphanumeric code is shifted into INPR and
the input flag FGI is set to 1. As long as the flag is set, the information in INPR cannot
be changed by striking another key. The computer checks the flag bit; if it is 1, the
information from INPR is transferred in parallel into AC and FGI is cleared to 0. Once
the flag is cleared, new information can be shifted into INPR by striking another key.
The output register OUTR works similarly but the direction of information flow is
reversed. Initially, the output flag FGO is set to 1. The computer checks the flag bit; if
it is 1, the information from AC is transferred in parallel to OUTR and FGO is cleared
to 0. The output device accepts the coded information, prints the corresponding
character, and when the operation is completed, it sets FGO to 1. The computer does
not load a new character into OUTR when FGO is 0 because this condition indicates
that the output device is in the process of printing the character.
Draw and explain Control unit of Basic computer
system
The block diagram of the control unit is shown in above figure. Components of
Control unit are
Two decoders
A sequence counter
Control logic gates
A Hard-wired Control consists of two decoders, a sequence counter, and a number of logic gates.
An instruction fetched from the memory unit is placed in the instruction register (IR).
The component of an instruction register includes; I bit, the operation code, and bits 0
through11.
The operation code in bits 12 through 14 are coded with a 3 x 8 decoder.
The outputs of the decoder are designated by the symbols D0 through D7.
The operation code at bit 15 is transferred to a flip-flop designated by the symbol I.
The operation codes from Bits 0 through 11 are applied to the control logic gates.
The Sequence counter (SC) can count in binary from 0 through 15.
Draw and Explain The Timing Signal of Control
Unit
Generated by 4-bit sequence counter and 416 decoder
The SC can be incremented or cleared.
Example: T0, T1, T2, T3, T4, T0, T1, . . .
Assume: At time T4, SC is cleared to 0 if decoder output D3 is active.
D3T4: SC 0
As display in the figure, the halt condition appears when the device receive turned off,
on the circumstance of unrecoverable errors, etc.
Fetch Cycle
The address instruction to be implemented is held at the program counter. The
processor fetches the instruction from the memory that is pointed by the PC.
Next, the PC is incremented to display the address of the next instruction. This
instruction is loaded onto the instruction register. The processor reads the instruction
and executes the important procedures.
Execute Cycle
The data transfer for implementation takes place in two methods are as follows −
Processor-memory − The data sent from the processor to memory or
from memory to processor.
Processor-Input/Output − The data can be transferred to or from a
peripheral device by the transfer between a processor and an I/O device.
In the execute cycle, the processor implements the important operations on the
information, and consistently the control calls for the modification in the sequence of
data implementation. These two methods associate and complete the execute cycle.
State Diagram for Instruction Cycle
The figure provides a large aspect of the instruction cycle of a basic computer, which
is in the design of a state diagram. For an instruction cycle, various states can be null,
while others can be visited more than once.
Immediate mode: In this mode, the operand is specified in the instruction itself.
E.g. Move #200,R0
The above instruction places the value 200 in the register R0.Clearly Immediate mode
can be used only to specify the source operand.
Figure 1 shows the above concept i.e. the operand is a part of the instruction
Register mode: The operand is the contents of a register. We specify the operand in
this case by specifying the name of the register in the instruction. Processor registers
are often used for intermediate storage during arithmetic operations. This addressing
mode is used at that time to access the registers.
E.g. Move R0, R1
Contents of the R0 register are moved to R1 register.
As shown in Figure 2, the instruction names the register that holds the operand.
Absolute mode: The operand is in a memory location; the address of the operand is
passed explicitly in the instruction. Global variables are represented using this
addressing mode.
E.g. Move LOC, R0
Here LOC corresponds to the address from where the contents will be accessed by the
processor and placed in R0.
Indirect mode: The effective address (E.A.) of the operands is the contents of a
register (see Figure 3(b)) or the memory location whose address appears in the
instruction (see Figure 3(a)). The name of the register or the memory address is placed
in parentheses to denote indirection or in other words that the contents are addresses
of the operands.
This instruction fetches the operand from the address, pointed by the contents of the
register R1 or of the memory location ‘B’ and adds them to R0.
Index mode: The effective address of the operand is calculated by adding a constant
value to the contents of a register, which is clearly shown in Figure 4. The address can
be in a register used specially for this purpose or any of the general purpose registers.
In either case it is called as an index register.
E.g. Move X (R0), R1
Here, Contents at address X+R0 are moved to R1 .X contains a constant value.
Base with index mode: The effective address is the sum of contents of two registers.
The first register as before is called the index and the second register is called the base
register. This mode provides more flexibility since both the components are registers
and can thus be changed.
E.g. Move (R0, R1), R2
Here, Contents at address R0+R1 are moved to R2.
Base with index and offset mode: The effective address is the sum of contents of
two registers and a constant. The constant value in this case is often called the offset
or the displacement.
E.g. Move X (R0, R1), R2
Contents at address X+R0+R1 are moved to R2.
Relative mode: For relative addressing, also called PC-relative addressing, the
implicitly referenced register is the program counter (PC). That is, the next instruction
address is added to the address field to produce the EA. typically, the address field is
treated as a twos complement number for this operation. Thus, the effective address
is a displacement relative to the address of the instruction as shown in the example
below.
Relative addressing exploits the concept of locality.
E.g. Move X (PC), R1
Here, Contents at address X+PC are moved to R1 .X contains a constant value.
Auto increment mode: The effective address of the operand is the contents of a
register specified in the instruction. After accessing the operand, the contents of this
register are automatically incremented to the next value. This increment is 1 for byte
sized operands, 2 for 16 bit operands and so on.
E.g. Add (R2) +, R0
Here are the contents of R2 are first used as an E.A. then they are incremented.
Auto decrement mode: The effective address of the operand is the contents of a
register specified in the instruction. Before accessing the operand, the contents of this
register are automatically decremented and then the value is accessed.
E.g. Add - (R2), R0
Here are the contents of R2 are first decremented and then used as an E.A. for the
operand which is added to the contents of R0. The auto increment addressing mode
and the auto decrement addressing mode are widely used for the implementation of
data structures like Stack. There may be other addressing modes that are unique to
some processors.
Explain Direct Addressing mode
Direct Addressing Mode is also known as “Absolute Addressing Mode”.In this
mode the address of data(operand) is specified in the instruction itself.That
is, in this type of mode, the operand resides in memory and its address is given
directly by the address field of the instruction. Means, in other words, in this
mode, the address field contain the Effective Address of operand .
EA=A
In this mode, the address field contains the In this mode, the address field contains the
1.
effective address of the operand. effective address of the operand.
This addressing mode requires one memory It requires two memory references.
2.
reference only.
There is no further classification in this mode. It can be further classified into two
4.
categories.