CPE300: Digital System Architecture and Design: Fall 2011 MW 17:30-18:45 CBC C316 Control, Reset, Exceptions 10312011
CPE300: Digital System Architecture and Design: Fall 2011 MW 17:30-18:45 CBC C316 Control, Reset, Exceptions 10312011
Outline
Review Datapath/Control 2- and 3-Bus SRC Processor Design Machine Reset Machine Exceptions
Implementation independent
Registers and operations
Concrete RTN
Detailed register transfer steps in datapath to produce overall effect
Dependent on implementation details
Control Sequences
Register transfers are the concrete RTN Control sequence are the control signals that cause the RT
Step T0 T1 Concrete RTN MAPC: CPC+4; MDM[MA]: PCC Control Sequence PCout, MAin, Inc4, Cin Read, Cout, PCin, Wait
T2
T3
IRMD
instruction_execution
MDout, IRin
Wait prevents control sequence from advancing to step T2 until memory asserts Done
Memory read should start as early as possible to reduce wait time MA must have correct value before being used for a read
Level sensitive latch flipflops in example tR2valid is the period from begin of gate signal till inputs at R2 are valid tcomb is delay through combinational logic, such as ALU or cond logic
Data can be strobed into R2 after this time tR2valid = tg + tbp + tcomb + tsu Diagram shows strobe signal in the form for a latch. It must be high for a minimum timetw There is a hold time, th, for data after strobe ends
10
The minimum clock period is determined by finding longest path from flip-flop output to flipflop input
This is usually a path through the ALU Conditional signals add a little gate delay Minimum clock period is
11
This can influence even the kind of concrete RTs that can be written for a data path If the C register is implemented with latches, then C C + MD; is not legal If the C register is implemented with master-slave or edge triggered flip-flops, it is OK
12
The components of the control unit are: a time state generator, instruction decoder, and combinational logic to generate control signals
13
Exception signals
14
ST Control Sequence Grb, BAout, Ain c2out, ADD, Cin Cout, MAin Gra, Rout, MDin, Write Wait, End
15
ST Control Sequence Grb, BAout, Ain c2out, ADD, Cin Cout, MAin Gra, Rout, MDin, Write Wait, End
16
17
Clocking Logic
Generates Run signal Generate synchronized done signal SDone Generates R, W from Read, Write control Generates Enable which controls counter
18
19
20
21
Note the appearance of Grc to gate the output of the register rc onto the B bus and Sra to select ra to receive data strobed from the A bus Two register select decoders will be needed Transparent latches will be required for MA at step T0
22
2-Bus Performance
Speedup = = execution time =
is 1- or 2-bus
1 2
Assumptions
and dont change in going from 1 bus to 2 buses goes from 8 to 7 clocks (nave assumption)
1 2 8 7 8 7
Speedup =
= = 1.143 = 14.3%
23
3-Bus Design
A 3-bus architecture allows both operand inputs and the output of the ALU to be connected to buses
Shortens control sequences even further than 2bus design
Both the C output register and the A input register are eliminated Careful connection of register inputs and outputs can allow multiple RTs in a step
24
25
T1 T2
Note the use of 3 register selection signals in step T2: GArc, GBrb, and Sra In step T0, PC moves to MA over bus B and goes through the ALU Inc4 operation to reach PC again by way of bus C
PC must be edge triggered or master-slave
26
3-Bus Performance
Speedup = = execution time =
is 1- or 2-bus
1 3
Assumptions
and dont change in going from 1 bus to 3 buses goes from 8 to 4 clocks (nave assumption) increases by 10%
Speedup =
1 3
8 41.1
8 4.4
= 1. 818 = 81.8%
27
Machine Reset
Reset sets program counter to a fixed value
May be a hardwired value Contents of a memory cell whose address is hardwired
The control step counter is reset Pending exceptions are prevented, so initialization code is not interrupted It may set condition codes (if any) to known state It may clear some processor state registers A soft reset makes minimal changes
PC, T (T-step counter)
28
29
instruction_interpretation := ( RunStrt(Run1: PC, R[0..31]0); RunRst(IRM[PC]: PCPC+4; instruction_execution): RunRst(Rst0: PC0); instruction_interpretation):
30
Resets in the Middle of Instruction Execution The abstract RTN implies that reset takes effect after the current instruction is done To describe reset during an instruction, we must go from abstract to concrete RTN Why might we want to reset in the middle of an instruction?
Long instructions
31
T3 T4 T5
Same RTN/control as before but must check Rst ClrPC clears the program counter to all zeros ClrR clears the one bit Reset flip-flop
Reset actions are the same for every step of every instruction control signals are independent of time step or opcode
32
Machine Exceptions
An exception is an event that causes a change in the program specified flow of control
Internal are usually synchronous (overflow) External often asynchronous (keyboard)
33
34
Address of the handler is called the exception vector and is a hardware function of the exception type Exceptions must access a save area for PC and other hardware saved items
Choices are special registers or a hardware stack
35
If processor state is stored in special registers on an exception, instructions are needed to save and restore these registers
36
Types of Exceptions
System reset Exceptions associated with memory access
Machine check memory failure Data access memory not available Instruction access instruction not available (similar to data access) Alignment improperly aligned access Illegal instruction instruction not in IS Unimplemented instruction legal but not in IS Privileged instructions instruction not available Arithmetic errors
Program exceptions
Miscellaneous hardware exceptions (e.g. watchdog) Trace and debugging exceptions Non-maskable exceptions (NMI) very bad cases External exceptionsinterrupts
37
The PC and information about the source of the interrupt are stored in special registers
Any other state saving is done by software
The interrupt source supplies 8 bits that are used to generate the interrupt vector It also supplies a 16 bit code carrying information about the cause of the interrupt
38
31 0
12 11 Isrc_vect<7..0>
4 3 0000
39
If interrupts are enabled, PC and interrupt info. are stored in IPC and II, respectively
With multiple requests, external priority circuit (discussed in later chapter) determines which vector & info. are returned
40
41
Concrete RTN
(ireqIE) (ireqIE)(MAPC: CPC+4): (ireqIE) (ireqIE)(IPCPC: IIIsrc_info: IE0: PC20@#Isrc_vect<7..0>#00: iack1; iack0; End);
T1 T2 T3
PC could be transferred to IPC over the bus II and IPC probably have separate inputs for the externally supplied values Iack is pulsed, described as 1; 0, which is easier as a control signal than in RTN
42
We will see that this problem is acute with pipeline designsalways in middle of instructions.
43
44
Chapter 4 Summary
Chapter 4 has done a non pipelined data path, and a hardwired controller design for SRC The concepts of data path block diagrams, concrete RTN, control sequences, control logic equations, step counter control, and clocking have been introduced The effect of different data path architectures on the concrete RTN was briefly explored We have begun to make simple, quantitative estimates of the impact of hardware design on performance Hard and soft resets were designed A simple exception mechanism was supplied for SRC