CH 04
CH 04
1
Instruction set architecture
2
Cont….
3
Instruction Codes
Instruction codes together with data are stored in
memory(=Stored Program Concept)
The computer reads each instruction from memory and places it
4
Cont….
5
Cont….
6
Cont….
7
Computer Instructions
The basic computer has three instruction code formats. The Operation code (opcode) part
of the instruction contains 3 bits and remaining 13 bits depends upon the operation code
encountered.
8
Cont…
2. Register Reference Instruction
These instructions are recognized by the opcode 111 with a 0 in the left most bit of
instruction. The other 12 bits specify the operation to be executed.
3. Input-Output Instruction
These instructions are recognized by the operation code 111 with a 1 in the left most bit
of instruction. The remaining 12 bits are used to specify the input-output operation
9
Timing and control
• A master clock generator controls the timing for all registers in
the basic computer
• The clock pulses are applied to all flip-flops and registers in
system.
• 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.
• The function of control unit is to generate relevant timing and
control signals to all operations in the computer.
• The control unit co-ordinates activities of the other two
units(ALU and main memory) as well as all peripherals and
auxiliary storage devices linked to the computer.
10
Cont….
• Microprogrammed Control :
The control information is stored in a control memory, and the control
memory is programmed to initiate the required sequence of
microoperations.
Control logic is implemented with microprogram.
+ Any required change can be done by updating the microprogram in
control memory.
- Slow operation b/c time taken to fetch microinstruction from memory
11
Cont…
Block diagram of Hardwired Control :
12
Cont…
As an example, consider the case where SC is incremented to provide timing signals T0, T1,
T2, T3, and T4 in sequence. At time T4, SC is cleared to 0 if decoder output D3 is active. This
D3T4: SC <- 0
The following diagram shows of control timing signals for this example.
13
Cont…
14
Instruction Processing
• The fetch-decode-execute cycle is the series of steps that a
computer carries out when it runs a program.
• We first have to fetch an instruction from memory, and
place it into the IR.
• Once in the IR, it is decoded to determine what needs to be
done next.
• If a memory value (operand) is involved in the operation, it
is retrieved and placed into the MBR.
• With everything in place, the instruction is executed.
16
A Simple Program
17
Cont….
18
Cont….
19
Cont….
20
Interrupt
22
Cont…
• Interrupts can be : hardware interrupts and software
interrupts.
• Hardware interrupts: The interrupt signal generated from
external devices like i/o devices
– Example − In a keyboard if we press a key to do some action this
pressing of the keyboard generates a signal that is given to the
processor to do action
• software interrupt is caused either by an exceptional
condition in the processor itself, or a special instruction in
the instruction set which causes an interrupt when it is
executed.
Example - divide-by-zero exception
23
Cont….
24
Cont….
26
A Discussion on Assemblers
27
Cont….
28
Cont….
29
Cont….
30
Cont….
31
Cont….
32