Sie sind auf Seite 1von 30

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

CENTRAL PROCESSING UNIT (CPU)


n n n n

The solution algorithm consists of series of steps These steps are broken into smaller steps 1 steps = 1 machine instruction Each instruction is executed by carrying out a sequence of rudimentary/basic operations These operations anda how they are generated is one of the main topic of this course

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

FUNDAMENTAL CONCEPT
n

The instructions are loaded in the sequential locations in main memory Instructions are fetch from successive memory locations PC (program counter) keeps track address of the next memory location containing next instruction (PC= PC +1)

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

THREE STEPS OF EXECUTION 1 INSTRUCTION


n

n n

1. Fetch the contents of memory location pointed by PC, then loaded into IR (instruction register) IR [[ PC ]] 2 . Increment PC : PC PC +1 3 . Carry out the action by the instruction in the IR If the instruction more the 1 word, step 1 and 2 must be repeated as necessary
3

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

SINGLE BUS ORGANIZATION

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

OPERATION FUNCTIONS
n

Fetch content of memory location and load into a CPU register (M R) Store data from CPU register into memory location (R M) Transfer from 1 register to another register (R R) Perform arithmetic & logic operation and store the result in CPU register How each function is implemented in detail ?
5

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Fetching a word from Memory


n

n n

Specify the address of memory location containing the instruction or operand, sent from CPU MAR memory CPU send Read control signal After completing the operation, memory send the WMFC (wait for Memory Function Completed) signal to CPU, it means instruction/operand (requested) is available in the MDR
6

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Sequence of Read operation


n

n n n n n

Assumed memory address is in R1 and data from memory to be loaded into R2 1. MAR [R1] 2. Read 3. Wait for MFC signal 4. R2 [MDR] This type of data transfer is asynchronous transfer (combination of read request and MFC signal)
7

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Storing a Word in Memory


n n n n

Address is loaded into MAR Data (to be written) is loaded into MDR Write signal is issued After completion of the operation, the memory will send the MFC signal

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Sequence of Write operation


n

n n n

Assumed data to be stored is in R2 and memory address is in R1 1. MAR [R1] 2. MDR [R2], Write 3. Wait for MFC

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Register Transfer
n

n n n

To control the gate for input the data into Ri is used control signal Ri in To control the gate for output the data to the bus is used control signal Ri out To transfer contents of R1 to R4 : R1 out is set to 1 output to the bus R4 in is set to 1 load from the bus into R4
10

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Arithmetic & Logic operation


n

To add two numbers :


n n

First operand is hold on register Y Second operand is gated into the bus

n n

The result is store temporarily in reg Z Example : Add the contents of R1 to R2 and store the result in R3

11

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Signal control to ADD 2 numbers


n n n n n n

Step Action 1. R1out, Yin 2. R2out, Add, Zin 3. Zout, R3in The signal whose name are given, is set to 1 All other signals are inactive
12

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Execution a Complete Instruction


n n n

The actions : 1. Fetch the instruction 2. Executions :


n n n

Fetch operand(s) Perform the operations (Move, Add, etc.) Store the result to register or memory

13

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Sequence control for instruction ADD LOC, R1


1.

2. 3. 4. 5. 6. 7.

Pcout, MARin, Read, Clear Y, Set_carry_in_to ALU, Add, Zin Zout, PCin, Wait_for_MFC MDRout, IRin Address_field_of_IRout, MARin, Read R1out, Yin, Wait_for_MFC MDRout, Add, Zin Zout, R1in, End.
14

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

DOUBLE BUS ORGANIZATION (1)

15

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

DOUBLE BUS ORGANIZATION (2)


n

n n

Register output connect to bus A, register input connect to bus B Two buses connected through bus tie G, normally open, to close use control signal Genable When bus tie G disable, two buses disconnected Do not need register Z, because output from reg Z can be placed on bus B, no possible conflict with the data on bus A
16

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

DOUBLE BUS ORGANIZATION (3)


n

n n n

n n

Ex : the operation R3 <- [R1] + [R2] can be perform as follows : 1. R1out, Genable, Yin 2. R2out, Add, ALUout, R3in The operation R2 <- [R1] + [R2] can be perform as follows : 1. R2out, Genable, Yin 2. R1out, Add, ALUout, R2in
17

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Branching
n

n n

Branching : replacing contents of PC by branch address Branch address = update PC + offset X Offset X is given in the address field of the branch instruction 2 type of branching :
n n

Unconditional Conditional
18

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Sequence control : Branch Unconditional


1.

2. 3. 4. 5. 6.

Pcout, MARin, Read, Clear Y, Set carry-in to ALU, Add, Zin Zout, PCin, Wait_for_MFC MDRout, IRin PCout, Yin Address_field_of_IRout, ADD, Zin Zout, PCin, End.
19

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

CONDITION CODE
n

n n n

Condition code flag is represent by a bit in the status register of the processor, to know the result of the last computing operation , there are : N (negative) : set to 1 if the result is negative, otherwise is 0 Z (zero) : set to 1 if the result is 0, otherwise is 0 V (overflow) : set to 1 of overflow occurs C (carry) : set to 1 if there are carry out result
20

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

STATUS REGISTER

21

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Conditional Brach : Branch on Negative


Pcout, MARin, Read, Clear Y, Set carry-in to ALU, Add, Zin Zout, PCin, Wait_for_MFC 2. 3. MDRout, IRin PCout, Yin, If N then End. 4. Address_field_of_IRout, ADD, Zin 5. 6. Zout, PCin, End. Step 4 : N is cheked, if N= 0 then End, if N=1, do step 5 and 6
1.
22

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Generating control signal to execute instructions


n n n

2 categories : A) Hardwired B) Microprogrammed Control

23

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Hardwired Control
n

The main part are decoder/encoder, simpy a combinational circuit to generate signal control, depending on the state of all its input :
n n n

Contents of control counter contents of instruction register Contents of condition code and other status flags
24

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Hardwired Control

25

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Hardwired (cont.)
n

For any instruction loaded into IR, one of the output lines INS1 to INSm is set to 1 All input signal to encoder block will be combined to generate individual control signal as Yin, PCout etc.

26

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Encoder

Zin = T1 + T6.ADD + T5.BR + ..

End = T7.ADD + T6.BR + (T6.N + T4.N).BRN + ..

27

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Microprogrammed Control
n

Control signal are generated by a program similar to machine language program Each control signal is represent by individual bit stored in programmed memory/control store Control unit generate control signal by reading sequentially control word from control store using PC
28

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Basic Organization of Microprogrammed Control Unit

29

Generated by Foxit PDF Creator Foxit Software http://www.foxitsoftware.com For evaluation only.

Example of Microinstruction in programmed memory

30

Das könnte Ihnen auch gefallen