4 Basic Computer Org Design
4 Basic Computer Org Design
Instruction Code
• An instruction code is a group of bits that instruct the computer to perform a specific
operation.
• The operation code of an
instruction is a group of bits
that define operations such as
addition, subtraction, shift,
complement, etc.
• An instruction must also
include one or more operands,
which indicate the registers
and/or memory addresses from
which data is taken or to which
data is deposited.
• For a memory unit with 4096 words- 12 bits are required to specify the address of the
operand. (16-bit memory word)
1
9/22/2023
AC AC + M [457]
AR M [300]
AC AC + M [AR]
where AR = 1350
Computer Registers
• We need registers which can hold
the address at which a memory
operand is stored as well as the
value itself.
• We need a place where we can
store
– temporary data
– the instruction being executed,
– a character being read in
– a character being written out.
• Computer instructions are stored in
consecutive locations and are
executed sequentially; this requires
a register which can stored the
address of the next instruction; we
call it the Program Counter.
2
9/22/2023
3
9/22/2023
Computer Instructions
The basic computer has three instruction code formats:
Memory-reference format – where seven
3-bit op-codes are followed by a 12-bit
memory address and preceded by a bit
which indicates whether direct or indirect
addressing is being used.
Register-reference format – where 01112 is
followed by 12 bits which indicate a register
instruction.
Input-output format – where 11112 is
followed by 12 bit which indicate an input-
output instruction. Basic Computer Instruction formats
The bit at position 15 in the instruction code is not used as a mode bit when the operation code is equal to 111.
4
9/22/2023
Memory Reference
Instruction (7)
Register Reference
Instruction (12)
Input-output
Instruction (6)
5
9/22/2023
Control Unit
• Control unit block diagram:
• Two decoder
• A sequence counter
• Number of control logic gates
• Instruction register (IR)
• The operation code in bits 12 through 14
are decoded with 3 x 8 decoder.
• 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
to T15 which are used to control the sequence
of operations.
• The sequence counter SC can be
incremented (to provide the next active
timing signals T0 , T1, T2……) or cleared
synchronously.
6
9/22/2023
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
• The instructions of a program are carried out
by a process called the instruction cycle.
• The instruction cycle consists of these phases:
1. Fetch an instruction from memory
2. Decode the instruction.
3. Read the effective address from memory
if the operand has an indirect address.
4. Execute the instruction.
5. Repeat the steps until the HALT
instruction is encountered.
7
9/22/2023
At Time T0:
1. Place the content of PC onto the bus by
making the bus selection inputs S2 S1 S0 =
010.
2. Transfer the content of the bus to AR by
enabling the LD input of AR.
At Time T1:
1. Enable the read input of memory.
2. Place the content of memory onto the bus
by making S2 S1 S0 = 111.
3. Transfer the content of the bus to IR by
enabling the LD input of IR.
4. Increment PC by enabling the INR input of
PC.
8
9/22/2023
Instruction Cycle
At time T3:
• The control unit determines if this is a memory-
reference, register-reference or input/output
instruction.
• The D7 output line of the decoder is used to
discriminate the type of the instruction.
• The latter two are distinguished by the I (indirect)
bit.
• If it is a memory-reference instruction, the I bit
will determine direct or indirect addressing.
• The four separate paths are:
• D7’ I T3 : AR M[AR]
T4
• D7’ I’ T3 : Nothing
• D7 I’ T3: Execute a register-reference
instruction
• D7 I T3 : Execute an input-output instruction
Memory-Reference Instructions
• All memory-reference instructions have to wait until T4 so that the timing
is the same whether the operand is direct or indirect.
• AND, ADD and LDA must all be performed in two steps because AC can
only be access via DR:
9
9/22/2023
Memory-Reference Instructions
STA : stores the contents of the AC, which can be applied directly to the bus:
BUN: transfers control unconditionally to the effective address indicated by the effective
address:
D4T4: PC AR, SC 0
BSA: is used to branch to a subprogram. This requires saving the return address, which is
saved at the operand’s effective address with the beginning one word later in memory:
10
9/22/2023
11
9/22/2023
Input-Output Configuration
Basic input- output communication
with a terminal unit Keyboard and
printer:
• The terminal sends and receive serial
information.
• The serial information from the
keyboard is transmitted to INPR.
• The serial information for the printer is
stored in OUTR.
• INPR and OUTR communicate with
the terminal serially and with the AC in
parallel.
• The flags are needed to synchronize the
timing difference between I/O device Programmed control transfer
and the computer.
Input-Output Configuration
12
9/22/2023
Interrupt Cycle
• Programmed control transfer for implementing the input-output communication is inefficient
because computer is always busy for checking the status of flag bit.
• An alternative approach to use the external device which inform to computer when it is ready for
the transfer, in a meantime the computer can be busy with other tasks. (interrupt facility)
• During the program running mode, computer does not check the flags.
Interrupt Cycle
• The interrupt cycle is added in the
instruction cycle to handle the interrupt
(input-output transfer).
• The interrupt cycle is a HW implementation
of a branch and save return address
operation.
• Interrupt enable FF (IEN) can be made set
and reset (with the use IOF instruction). If
IEN=0 then flags cannot interrupt the
computer, otherwise (IEN=1) computer can
be interrupted.
13
9/22/2023
14
9/22/2023
15
9/22/2023
16
9/22/2023
17