Docsity

Exception Processing and Types - Computer Architecture - Lecture Slides, Slides of Computer Architecture and Organization

Partial preview of the text

Download Exception Processing and Types - Computer Architecture - Lecture Slides and more Slides Computer Architecture and Organization in PDF only on Docsity!

1

General Purpose Registers

IR

R

R

A B

ALU

C

C bus A bus^ B bus

All three buses are “Internal processor buses”

A 3-bus

implementation

for the SRC

To External CPU Bus

PC

MBR

MAR

The register file must have 2 read ports and one write port Docsity.com

2

Step RTL

T0 MAR←PC; MBR ← M[MAR], PC ← PC + 4;

T1 IR ← MBR;

T2 R[ra] ← R[rb] - R[rc];

Structural RTL for the sub instruction

using the 3-bus data path implementation

Instruction Fetch

Instruction Execute

Format: sub ra, rb, rc

At the end of each sequence, the timing step generator is initialized to T

cannot use edge-triggered FFs to implement MAR as done before

4

Step (^) RTL for ld

T0 MAR←PC; MBR ← M[MAR], PC ← PC + 4;

T1 IR←MBR;

T2 MAR ←((rb=0):0,(rb!=0):R[rb]+ (16αIR<16> ©IR<15..0>), MBR←M[MAR] T3 R[ra] ←MBR

Structural RTL for the ld instruction

5

Reset operation in SRC

• The reset signal in SRC is assumed

to be external and asynchronous.

• Hard Reset

The SRC should perform a hard reset

upon receiving a start (Strt) signal. This

initializes the PC and the general

registers.

• Soft Reset

Soft reset results in initialization of PC only

7

Behavioral RTL for SRC Reset

The modified RTL after adding the

reset capability is

instruction_interpretation:=(! Run&Strt:(Run ← 1,

PC,R[0..31] ← 0),

Run&!Rst:(IR ← M[PC],

PC ← PC+4,instruction_exec),

Run&Rst:(Rst ← 0;PC ← 0);

instruction_interpretation)

8

Structural RTL for SRC Reset

Following modifications are required to add the

reset operation to the structural RTL for SRC

  • A check for the reset signal on each clock cycle
  • A control signal for clearing the PC
  • A control signal to load zero to control step

counter

10

Example: The sub instruction with RESET processing

Step RTN Control Sequence

TO !Rst:(MA ← PC,C ← PC+4),

Rst:(Rst ← 0,PC ← 0,T ← 0)

!Rst:(PC (^) out’ LMAR, INC4, LC (^) ’ MRead), Rst:(ClrPC, Goto0);

T1 !Rst:(MD ← M[MA]:PC ← C),

Rst:(Rst ← 0:PC ← 0:T ← 0)

!Rst:(C (^) out’ LPC (^) ’ Wait), Rst ←(ClrPC, Goto0);

T2 !Rst:(IR ← MD),

Rst:(Rst ← 0: PC ← 0:T ← 0)

!Rst:(MBR (^) out’ LIR), Rst ← (ClrPC, Goto0);

T3 !Rst:(A ← R[rb]),

Rst:(Rst ← 0: PC ← 0: T ← 0)

!Rst:(RBE, R2BUS, LA), Rst : (ClrPC, Goto0);

T4 !Rst:(C ← A + R[rc]),

Rst:(Rst ← 0: PC ← 0:T ← 0)

!Rst:(RCE, R2BUS, ADD, LC), Rst :(ClrPC, Goto0);

T5 !Rst:(R[ra] ← C),

Rst:(Rst ← 0:PC ← 0: T ← 0)

!Rst:(LC’ RAE, BUS2R’ End), Rst :(ClrPC, Goto0);

Clears PC

Reset the control Step counter

11

Exception Processing

A generalized exception handler should include

the following mechanisms

1. Logic to resolve priority conflicts

2. Identification of interrupting device

3. Saving the processor state

4. Exception disabling during critical operation

5. Saving the general purpose registers

13

Types of Exception

• Program Exceptions

• Hardware Exceptions

• Trace and debugging Exceptions

• Nonmaskable Exceptions

• Interrupts (External Exceptions)