Timing and Control
Timing and Control
.
TOPIC:
1
Timing and Control
• The timing for all register in computer is controlled by a master
clock generator.
• Control signals are generated in the control unit and provide
control inputs for the multiplexers, common bus, processor
registers, and accumulator.
• Two major types of control organizations:
-Hardwired Control
- Microprogrammed Control
• Hardwired control is implemented with gates, flip-flops,
decoders, and other digital circuits.
• In microprogrammed control, control information is stored in
control memory, and any required change or modification can
be done by updating the microprogram in the control memory.
2
Hardwired Control unit of basic Computer
.
3
Instruction Cycle
• A program residing in the memory unit of computer consists of
a sequence of instructions.
• The program is executed in the computer by going through a
cycle for each instruction.
• Each instruction cycle is subdivided into sequence of subcycles
of phases.
– 1. Fetch an instruction from memory
– 2. Decode the instruction
– 3. Read the effective address from memory if the information has an
indirect address.
– 4. Execute the instruction
• Upon completion of step 4, control goes back to step 1 to fetch, decode and
execute the next instruction.
• This process continues indefinitely unless a HALT instruction is encountered.
4
Example of Control Timing Signals
. At time T4, SC is cleared to 0 if decoder output D3 is active.
D3T4: SC🡨0
5
Fetch and Decode
• Initially program counter PC is loaded with the address of first
instruction in the program. And sequence counter (SC) is
cleared to 0.
• After each clock pulse, SC is incremented by 1.
• The micro operations for the fetch and decode phase can be
specified by following register transfer statement.
6
Cont…
.
• Transfer the
content of the bus
to AR.
7
Determine the Type of Instruction
• During time T3, the control unit determines the type of instruction that
was just read from the memory.
8
Determine the Type of
Instruction- Flow Chart
9
Memory reference instruction
Memory reference instruction
STA
STA saves the content of the register into the memory word that
is defined by the effective address. The output is next used to
the common bus and the data input is linked to the bus. It
needed only one micro-operation.
Memory reference
instruction
BUN
The Branch Unconditionally (BUN) instruction can send the instruction that is
determined by the effective address. They understand that the address of the next
instruction to be performed is held by the PC and it should be incremented by one
to receive the address of the next instruction in the sequence. If the control needs
to implement multiple instructions that are not next in the sequence, it can
execute the BUN instruction.
BSA
BSA stands for Branch and Save return Address. These instructions can branch a part
of the program (known as subroutine or procedure). When this instruction is
performed, BSA will store the address of the next instruction from the PC into a
memory location that is determined by the effective address.
ISZ
The Increment if Zero (ISZ) instruction increments the word determined by effective
address. If the incremented cost is zero, thus PC is incremented by 1. A negative
value is saved in the memory word through the programmer. It can influence the
zero value after getting incremented repeatedly. Thus, the PC is incremented and
the next instruction is skipped.
1. AND to AC
1 bit input flag FGI is a control flip-flop. The flag bit is 1 when new information
is available in input device and cleared to zero when accepted by computer.
Flag is used to synchronize the timing rate difference between input device
and computer.
Initially FGI is set to 0. when a key is struck in the keyboard, an 8-bit
alphanumeric code is shifted in to INPR and the input flag FGI is set to 1.
The output register OUTR works similarly but the direction of information flow
is reversed.
Initially, the output flag FGO is set to 1.
Computer checks FGO, and if it is 1, the information from AC is transferred in
a parallel to OUTR and FGO is cleared to 0.
Input-Output
Instructions.
⚫ For this type of information I=1, and
D7 (i.e. IR(12-14)=111)
⚫ For basic Computer only 6 input-output instruction.
Program Interrupt
⚫ An alternative to the programmed controlled procedure is
to let the external device inform the computer when it is
ready for the transfer.
⚫ In the meantime computer can be busy with other tasks.
⚫ This type of transfer use the interrupt facility. While
computer is running the program, it does not check the
flags, however when a flag is set then computer receives an
interrupt.
⚫ The interrupt enable flip-flop IEN can be set and cleared
with two instructions.
⚫ When IEN is cleared to zero (with IOF instruction), the
flag can not interrupt the computer.
⚫ When IEN is cleared to 1 (with ION instruction), the
computer can be interrupted.
Flowchart of
Interrupt cycle
Interrupt E.g.
M[0] <- PC
PC <-M[1]
Interrupt cycle
32
Question Practice
33
Question Practice
3. A computer uses a memory unit with 65536 words of 32 bits each. A binary
instruction code is stored in one word of memory. The instruction has four
parts: an indirect bit, an operation code, a register code part to specify one
of 1024 registers and an address part.
(i). How many bits are there in the operation code, the register part, indirect bit
and the address part?
(ii). Draw an instruction word format and indicate the number of bits in each
part. •Memory unit with word size 65536, So number of address bits = 16
Resister 1024, Register code 10 bits.
Indirect bit 1 bit.
So, operation code = (32-10-16-1)=5 bits
•
Total 32 bits.
1 5 10 16
I Opcode Register Address
34
4. A 4-bit shift register circuit configured for right-shift operation is shown in
the figure below. Given that the present state of the shift register is 1110,
then how many clock cycles are required to again reach the state 1110. List
the sequence of states of the four flip-flops after each shift. Illustrate the
same with a timing diagram.
5. An instruction at address 021 in the basic computer has an address part
equal to 083 (all numbers are in hexadecimal). The memory word at
address 083 contains the operand C73A and the content of AC
(Accumulator) is B239. Determine the contents of the registers at the end
of the execute phase: PC (Program Counter), AR (Address Register), AC and
IR (Instruction Register). Implement the problem using following operation
codes (Hexadecimal code):
i) AND (0083)
ii) CMA (7200)
iii) INC (7800)
iv) BUN (4520)
35
Ans. 5
Step 1
PC AR DR AC IR
Initial 021 083 C73A B239 0083
AND
CMA
INC
BUN
36
Ans. 5
PC AR DR AC IR
Initial 021 083 C73A B239 0083
AND 022 083 --- 8238 0083
CMA 022 083 ---- 4DC6 7200
INC 022 083 ---- B23A 7800
BUN 083 083 B239 4520
37
6. JK Flip Flop and Discuss Race around condition. Master Slave Flip Flop.
7. Serial and Parallel transmission. 4 bit SIPO and PISO
8. Design a MOD counter which will count up to 1011 and restart from 0000
when we give clear to T or J-K flip-flop.
9. Instruction cycle
10. Interrupt cycle
11. Hardwired control unit
12. Instruction format
13. Common bus system
38
Ans. 5
PC AR AC IR
Initial 021 083 B239 0083
AND 022 083 8238 0083
CMA 022 083 4DC6 7200
39
Ans. 5
PC AR AC IR
Initial 021 083 B239 0083
AND 022 083 8238 0083
CMA 022 083 4DC6 7200
40