Lecture 7
Lecture 7
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
Timing and Control:
The timing for all registers in the basic computer is controlled by a master clock generator.
The clock pulses are applied to all flip-flops and registers in the system including the flip-flops
and registers in the control unit. The clock pulses do not change the state of a register unless the
register is enabled by a control signal. The control signals are generated in the control unit and
provide control inputs for multiplexers in the common bus, control inputs in processor registers,
and Microoperation for the accumulator. There are two major types of control organizations
hardwired control and microprogrammed control. In the hardwired organization, the control logic
is implemented with gates, flip-flops, decoders, and other digital circuits. It has the advantage that
it can be optimized to produce a fast mode of operation. In the micro-programmed organization,
the control information is stored in the control memory. The control memory is programmed to
initiate the required sequence. A hardwired control, as the name implies, requires changes in the
wiring among the various components if the design has to be modified or changed. In the
microprogrammed control, any required changes or modifications can be done by updating the
microprogramming in the control memory. A hardwired control for the basic computer is presented
here. The block diagram of the control unit is shown in the figure below;
Other options
15 14 13 12 11-0
3x8
I Decoder
7 6543210
D0
D7 Control
. Logic Control
. Gates Outputs
T15
.
.
T0 .
.....
15 14 2 1 0
4 x 16
Decoder
-53-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
It consists of two decoders, a sequence counter, and a number of control logic gates. An instruction
read from memory is placed in the instruction register IR, the position of this register in the common bus
system. This instruction register is divided into three parts: The I-bit, the operation code, and bits (0)
through (11). The opcode in bits (12) through (14) is decoded with a 3x8 decoder. The eight outputs of
the decoder are designated by the symbols D0 through D7.
The subscripted decimal number is equivalent to the binary value of the corresponding operation
code. Bit 15 of the instruction is transferred to a flip-flop designated by the symbol (I). Bits (0) through
(11) are applied to the control logic gates. The 4-bit sequence counter can count in binary from (0) through
(15). The outputs of the counter are decoded into 16 timing signals T0 through T15. The sequence counter
SC can be incremented or cleared synchronously. Most of the time, the counter is incremented to provide
the sequence of timing signals out of the 4 x 16 decoder. As an example, consider the case where SC is
incremented to provide timing signals T0, T1, T2, T3, and T4 in sequence. At time Ti SC is cleared to (0) if
decoder output D3 is active. This is expressed symbolically by the statement:
D3T4 : SC 0
T0 : AR PC
Specifies a transfer of the content of the PC into AR if timing signal T0 is active. T0 is active during an
entire clock cycle interval. During this time the content of the PC is placed onto the bus (with S2S1S0 =
010) and the LD (load) input of AR is enabled. The timing diagram of Fig. 5-7 shows the time relationship
of the control signals. The sequence counter SC responds to the positive transition of the clock. Initially,
the CLR input of SC is active. The first positive transition of the clock clears SC to 0, which in tum
activates the timing signal T0 out of the decoder. T0 is active during one clock cycle.
The positive clock transition abled connected T0 in the diagram will trigger only those registers
whose control inputs are transition, to timing signal T0. SC is incremented with every positive clock unless
transition unless its CLR input is active. This produces the sequence of timing signals T0. T1, T2, T3, T4,
and so on, as shown in the diagram. (Note the relationship between the timing signal and its corresponding
positive clock transition.) If SC is not cleared, the timing signals will continue with T5, T6, up to T15, and
back to T0
-54-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
The last three waveforms in Fig. 5-7 show how SC is cleared when D3T4 = I. Output D3
from the operation decoder becomes active at the end of timing signal T2• When timing signal T4
becomes active, the output of the AND gate that implements the control function D3T4 becomes
active. This signal is applied to the CLR input of SC. On the next positive clock transition (the one
marked T, in the diagram) the counter is cleared to 0. This causes the timing signal T0 to become
active instead of T5 which would have been active if SC were incremented instead of cleared. A
memory read or write cycle will be initiated with the rising edge of a timing signal. It will be
assumed that a memory cycle time is less than the clock cycle time.
According to this assumption, a memory read or write cycle initiated by a timing signal
will be completed by the time the next clock goes through its positive transition. The clock
transition will then be used to load the memory word into a register. This timing relationship is not
valid in many computers because the memory cycle time is usually longer than the processor clock
cycle. In such a case it is necessary to provide wait cycles in the processor until the memory word
is available. To facilitate the presentation, we will assume that a waiting period is not necessary
for the basic computer. To fully comprehend the operation of the computer, it is crucial that one
understands the timing relationship between the clock transition and the timing signals.
-55-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
For example, the register transfer statement
T0: AR PC
specifies a transfer of the content of the PC into AR if timing signal T0 is active. T0 is active during
an entire clock cycle interval During this time the content of the PC is placed onto the bus (with
525150 = 010) and the LD (load) input of AR is enabled. The actual transfer does not occur until
the end of the clock cycle when the clock goes through a positive transition. This same positive
clock transition increments the sequence counter SC from 0000 to 0001. The next clock cycle has
T1 active and T0 inactive.
Instruction Cycle:
A program residing in the memory unit of the 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 in turn is subdivided into a sequence of sub-cycles or phases. In the basic computer, each
instruction cycle consists of the following phases:
Upon the completion of step 4, the control goes back to step 1 to fetch, decode and execute the
next instruction. This process continues indefinitely unless a HALT instruction is encountered.
T0 : AR PC
T1 : IR M[AR], PC PC + 1
T2 : D0 ,..., D7 Decode IR (12 - 14), AR IR(0 - 11), I IR(15)
Since only AR is connected to the address inputs of memory, it is necessary to transfer the
address from PC to AR during the clock transition associated with timing signal T0. The instruction
read from memory is then placed in the instruction register IR with the clock transition associated
with signal T1. At the same time, PC is incremented by one to prepare it for the address of the next
instruction in the program. At T2, the opcode in IR is decoded, the indirect bit is transferred to flip-
flop (I) and the address part of the instruction is transferred to AR. Note that SC is incremented
after each clock pulse to produce the sequence T0, T1, and T2
-56-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
-57-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
Type of Instructions:
The figure below presents an initial configuration for the instruction cycle and shows how
the control determines the equal to (1) if the opcode is equal to binary (111) and if D7 =1. The
instruction must be a register-reference or input-output type if D7=0 the opcode must be one of the
other seven values (000) through (110), specifying a memory-reference instruction control then
inspects the value of the first bit of the instruction which is now available in flip-flop I. if D7 =0
and I=1. We have a memory-reference instruction with an indirect address. It is then necessary to
read the effective address from memory. The microoperation for the indirect address condition can
be symbolized by the register transfer statement:
AR M[AR]
Initially, AR holds the address part of the instruction. This address is used during the
memory read operation. The word at the address given by AR is read from memory and placed on
the common bus. The LD input of AR is then enabled to receive the indirect address that resided
in the 12 least significant bits of the memory word.
Register-Reference Instructions:
Register-reference instructions are recognized by the control when D7 =1 and I=0. These
instructions use bits (0) through (11) of the instruction code to specify one of (12) instructions.
These 12 bits are available in IR (0-11). They were also transferred to AR during time T2. The
control functions and the register-reference instructions are listed in the table below:
Memory-Reference Instructions:
The table below lists the seven memory-reference instructions. The decoded O/P Di for i = 0, 1, 2,
3, 4, 5, and 6 from the operation decoder that belongs to each instruction is in the address register.
AR was placed there during timing signal T2 when I=0, during timing signal T2 when I=0, or during
timing signal T3 when I=1. The execution of the memory-reference instructions starts with timing
signal T4 we now explain the operation of each instruction and list the control functions needed
for their execution.
3) LDA: load to AC This instruction transfers the memory word specified by the effective address to AC.
The needed to execute this instruction are:
D 2 T4 : DR M[AR]
D 2 T5 : AC DR, SC 0
Looking back at the bus system previously, we note that there is no direct path from the bus to AC. The
address and logic circuit Receive information from DR which can be transferred into AC. Therefore, it is
necessary to read memory words into DR first 7 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
4) STA: Store AC
This instruction stores the content of AC into a memory word specified by the effective address. Since the
O/P of AC is applied to the bus and the data I/P of memory is connected to the bus, we can execute this
instruction with one microoperation.
D3T4 : M[AR] AC, SC 0
-60-
Computer Architecture
Baghdad University
Asst. Prof. Dr. Muna Hadi Third stage
College of Engineering
2023-2024
Electrical Engineering Department
Lecture-7
7) ISZ: Increment and Skip if Zero
This instruction increments the word specified by the effective address, and if the incremented value is
equal to 0, PC is incremented by 1. The programmer usually stores a negative number (in 2’s complement)
in the memory word. As this negative number is repeatedly incremented by one, it eventually reaches the
value of zero. At that time, PC is incremented by one in an address to skip the next instruction in the
program. Since is not possible to increment a word inside the memory it is necessary to read into DR,
increment DR and store the word back into memory. This is done with the following sequence:
D6T4 : DR M[AR]
D6T5 : DR DR + 1
D6T6 : M[AR] DR, if (DR = 0) then (PC PC + 1), SC 0
Example: A numerical example that demonstrates how BSA instruction is used with a subroutine
is shown in figure below:
20
0 BSA 135 20 0 BSA 135
PC=21 Next instruction 21 Next instruction
AR=135 135 21
Subroutine PC = 136 Subroutine
Timing signal T4 initiates a memory write operation places the content of PC onto the bus and enables the
INR input of AR. The memory write operation is completed and AR is incremented by the time the next
clock transition occurs. The bus is used at T5 to transfer the content of AR to PC.
Control Flowchart:
A flowchart showing all the execution of the seven memory-reference instructions is shown in the
figure below. The microperations that are performed during times T4, T5, and T6 depend on the operation
code value. Note that we need only seven timing signals to execute the longest instruction (ISZ).
D6T5
D5T5
D6T6