Toward%20a%20general%20purpose%20computer - PowerPoint PPT Presentation

About This Presentation
Title:

Toward%20a%20general%20purpose%20computer

Description:

decode(i-1) = 0001000. AND. Line (j) = 00000100. Result = 00000000. Zero cell in ... Decode. tmp. Irrelevant. tmp. The result of the ALU. Micro-Instruction ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 47
Provided by: csHu
Category:

less

Transcript and Presenter's Notes

Title: Toward%20a%20general%20purpose%20computer


1
Toward a general purpose computer
  • Example Game of Life

2
Game of Life
Solve Cell
For Each Cell
For Each Line
3
Game of Life
Matrix
Generation
Line
Cell
Solve Cell
For Each Cell
For Each Line
4
Modularity
  • Generation Module
  • Matrix Module
  • Line Module
  • Cell Module

5
Algorithm for the Generation Module
  • CurrentGen 0
  • Solve for current Matrix
  • CurrentGen
  • If CurrentGen lt MAX_GEN
  • goto 2

6
Solve Matrix
  • 0. j 1
  • 1. Calculate line (j)
  • 2. If j lt MAX_LINE
  • 2.1 j
  • 2.2 goto 1.
  • 3. STOP

7
Calculate Line j
  • 0. i 0, tmp 0
  • 1. Calculate Cell i.
  • 2. If alive, set location i in tmp to alive
  • 3. If i lt MAX_CELL
  • 3.1 i
  • 3.2 goto 1.
  • 4. Store tmp in
  • even generation i16 odd generation i-16

8
CellAlive(cell index i, line index j)
  • 0. N Count_Neighbors(i,j-1,false)
  • 1. N NCount_Neighbors(i,j,true)
  • 2. N NCount_Neighbors(i,j1,false)
  • 3. If N gt MIN N lt MAX
  • 3.1 Return alive
  • 4. Return dead

9
Count_Neighbors (index i,line j, center)
  • 0. N 0
  • 1. If alive in location i-1,j NN1
  • 2. If not center
  • 2.1 If alive in location i,j NN1
  • 3. If alive in location i1,j NN1
  • 4. Return N

10
Algorithm implementation
  • Algorithm

How to do?
What to do?
The operation itself
control
11
The operations in the algorithm
  • Operations
  • Add
  • Subtract

12
The operationDefining interfaces
The Operation itself
(i-1) location
Return Number of Neighbor N
CountNeighbors
Alive 0..010..0
CellAlive
Return
Dead 0000000
Calculate Line
Return the line
Solve Matrix
The matrix
Generation
13
The operationModule Calculate Line, instruction
2
The Operation itself
If alive, set location i in tmp to alive
If dead
If alive
Calculate_Line(j) 0000000 OR tmp 00000000
Calculate_Line(j) 0001000 OR tmp 00000000
Result 000100000
Result 000000000
The j-th location
14
The operationModule Calculate Line, instruction
2
The Operation itself
If alive, set location i in tmp to alive
tmp OR(tmp,Calculate_Line(j))
15
The operations in the algorithm
The Operation itself
  • Operations
  • Add
  • Subtract
  • OR

16
Implementing instructionsModule Count_Neighbors,
instruction 1, 2.1, 3
The Operation itself
If alive in location i-1,j
decode(i-1) 0001000 AND Line (j)
00010100
decode(i-1) 0001000 AND Line (j)
00000100
Result 00000000
Result 00010000
Zero cell in location i is dead
Non Zero cell in location i is alive
17
Implementing instructionsModule Count_Neighbors,
instruction 1, 2.1, 3
The Operation itself
If alive in location i-1,j
Alive if AND(line,decode(i-1)) is not zero
18
The operations in the algorithm
The Operation itself
  • Operations
  • Add
  • Subtract
  • The logic AND Check if zero

19
Small ALU (arithmetic logic unit)
The Operation itself
Op selector Meaning Result
00 Add Res InputAInputB
01 Subract Res InputA NOT(InputB)1
10 AND Res AND(InputA,InputB)
11 Decode Res decode(InputA)
20
Small ALU
The Operation itself
StatusBit
21
Small ALU
The Operation itself
InputB
InputA
ALU
Op
StatusBit
isZero
22
Variables of the algorithmCount_Neighbors
  • Line j The current line
  • i - The index we are processing
  • N - The number of Neighbors so far
  • tmp - temporary processing space

23
Implementation of AND(line,decode(i1))
Reg1
Reg2
Reg3
Regn
24
Implementation of AND(line,decode(i1))
Reg1
1
ReadA
ReadB
Reg2
2
Reg3
Connected like MUX 1
Regn
25
Implementation of AND(line,decode(i1))
Reg1
1
ReadA
ReadB
Reg2
2
Write Address
Reg3
Write Data
Regn
Decoder
Write
Enable
26
Implementation of AND(line,decode(i1))
Registers
Data 1 Address
Data 1
Data 2 Address
Data 2
WriteAddress
Write Data
Write
27
Variables of the algorithmCount_Neighbors
Variable Meaning Address
CurrentLine Hold the current line 0
I The current index 1
N The Neighbor 2
Tmp Temporary space 3
Constant 1 Constant 1 5
ControlVariable A flag to determine if the operation should be performed 6
Center Is it the center 7
28
In generation 0
0
1
Current Generation Matrix, gen0
I?I16
15
16
17
Next generation Matrix
32
29
In generation 1
0
1
Next generation Matrix
I16?I
15
16
17
Current Generation Matrix,gen1
32
30
Variables of the algorithmCount_Neighbors
Variable Meaning Address
CurrentLine Hold the current line 0
I The current index 1
N The Neighbor 2
Tmp Temporary space 3
Constant 1 Constant 1 5
ControlVariable A flag to determine if the operation should be performed 6
Center Is it the center 7
31
Register/ALU circuit
Registers
Data 1 Address
Op
Data 2 Address
WriteAddress
ALU
Extend 1to 16
MUX
R0R1
Write
2
0
ExternalInput
1
32
Control Algorithm is zeroAND(line,decode(i1))
The Operation itself
  • If alive in location i1,j NN1

Algorithm instruction
Instruction
  • Tmp is zeroAND(Currentline,
  • decode(i1))
  • If controlVariable0000001 NN1

33
Control Algorithm is zeroAND(line,decode(i-1))
The Operation itself
  • Tmp is zeroAND(line,decode(i-1))

Instruction
t0. Tmp i-1 t1. Tmp decode(Tmp) t2.
controlVariable is zeroAND(CurrentLine, Tmp)
Micro-Instruction
34
Micro instruction implementation
The Operation itself
  1. Tmp i1
  2. Tmp decode(Tmp)
  3. controlVariable is zeroAND(CurrentLine, Tmp)

Micro-Instruction
t0. Data 1 Address 1Data 2 Address
5 WriteAddress 3 Write 1 Op
01R0R1 01
i
1
tmp
Subtract
The result of the ALU
35
Micro instruction implementation
The Operation itself
  1. Tmp i1
  2. Tmp decode(Tmp)
  3. controlVariable is zeroAND(CurrentLine, Tmp)

Micro-Instruction
t1. Data 1 Address 3Data 2 Address
0 WriteAddress 4 Write 1 Op
11R0R1 01
tmp
Irrelevant
tmp
Decode
The result of the ALU
36
Micro instruction implementation
The Operation itself
  1. Tmp i1
  2. Tmp decode(Tmp)
  3. controlVariable is zeroAND(CurrentLine, Tmp)

Micro-Instruction
t2. Data 1 Address 0Data 2 Address
3 WriteAddress 6 Write 1 Op
10R0R1 00
Line in register i
tmp
controlVariable
And
The zero status bit
37
Instruction Hierarchy
The Operation itself
Algorithmic Instruction
Instruction
Micro-Instruction
Micro-Instruction
Instruction
Micro-Instruction
Micro-Instruction
38
Instruction Hierarchy
Timing Variables
Instruction
t0 Micro-Instruction
tn Micro-Instruction
Each micro instruction 1 cycle
Instruction
t0 Micro-Instruction
tn Micro-Instruction
39
Timing variables (example with 4 time variables)
CP
t0
t1
t2
t3
One instruction
40
Generating Timing variablesexample with 16
timing variables
Register 4bits
CP
t0
t15
1
Decoder
Adder
41
Control of Count_Neighbor
42
Control of Count_Neighbor
0000
0001
0010
0011
0100
0101
0110
0111
1000
43
Control of Count_Neighbor
0000
0001
0010
0011
0100
0101
0110
0111
1000
44
Putting it all togetherimplementing what to do
with ROM
ROM Output
ROM Input
Current State Timing Timing Timing Timing CV C D1 D2 WA W Op R0R1
Current State t0 t1 t2 t3 CV C D1 D2 WA W Op R0R1
Center Register 7 (16bits)
Control variable (16bits)
The current state (4 bits)
The current timing variable(1 bits)
45
Putting it all together implementing what to do
with ROM
ROM Output
ROM Input
Current State Timing Timing Timing Timing CV C D1 D2 WA W Op R0R1
Current State t0 t1 t2 t3 CV C D1 D2 WA W Op R0R1
Data 1 Address
Data 2 Address
Write-Data MUX control
WriteAddress
Write
ALU Operation
46
Putting it all together implementing what to do
with ROM
ROM Output
ROM Input
Current State Timing Timing Timing Timing CV C D1 D2 WA W Op R0R1
Current State t0 t1 t2 t3 CV C D1 D2 WA W Op R0R1
0001 1 0 0 0 ? ? 1 5 3 1 01 01
0001 0 1 0 0 ? ? 3 0 4 1 11 01
0001 0 0 1 0 ? ? 0 3 6 1 10 00
0010 0 0 0 1 ? ? 0 0 0 0 000 01
t0. Tmp i1 t1. Tmp decode(Tmp) t2.
controlVariable is zeroAND(CurrentLine,
Tmp) t3. do nothing
47
Putting it all together implementing what to do
with ROM
ROM Output
ROM Input
Current State Timing Timing Timing Timing CV C D1 D2 WA W Op R0R1
Current State t0 t1 t2 t3 CV C D1 D2 WA W Op R0R1
0001 1 0 0 0 ? ? 1 5 3 1 00 01
0001 0 1 0 0 ? ? 3 0 4 1 11 01
0001 0 0 1 0 ? ? 0 3 6 1 10 00
0010 0 0 0 1 ? ? 0 0 0 0 000 01
t0. Tmp i1 t1. Tmp decode(Tmp) t2.
controlVariable is zeroAND(CurrentLine,
Tmp) t3. do nothing
48
Putting it all together implementing what to do
with ROM
ROM Output
ROM Input
Current State Timing Timing Timing Timing CV C D1 D2 WA W Op R0R1
Current State t0 t1 t2 t3 CV C D1 D2 WA W Op R0R1
0001 1 0 0 0 ? ? 1 5 3 1 00 01
0001 0 1 0 0 ? ? 3 0 4 1 11 01
0001 0 0 1 0 ? ? 0 3 6 1 10 00
0010 0 0 0 1 ? ? 0 0 0 0 000 01
t0. Tmp i1 t1. Tmp decode(Tmp) t2.
controlVariable is zeroAND(CurrentLine,
Tmp) t3. do nothing
49
Putting it all together implementing what to do
with ROM
ROM Output
ROM Input
Current State Timing Timing Timing Timing CV C D1 D2 WA W Op R0R1
Current State t0 t1 t2 t3 CV C D1 D2 WA W Op R0R1
0001 1 0 0 0 ? ? 1 5 3 1 00 01
0001 0 1 0 0 ? ? 3 0 4 1 11 01
0001 0 0 1 0 ? ? 0 3 6 1 10 00
0010 0 0 0 1 ? ? 0 0 0 0 000 01
t0. Tmp i1 t1. Tmp decode(Tmp) t2.
controlVariable is zeroAND(CurrentLine,
Tmp) t3. do nothing
50
Control of Count_Neighbor
0000
0001
0010
Current State 0001
t0. Set Current State 0001 t1. Set Current State
0001 t2. Set Current State 0001 t3. If
ControlVariable1 Set Current State 0010 t3.
If ControlVariable0 Set Current State 0011
0011
0100
0101
0110
0111
1000
51
Putting it all togetherimplmenting control with
ROM
ROM Input
ROM Output
Current State Timing Timing Timing Timing CV C NextState
Current State t0 t1 t2 t3 CV C NextState
0001 1 0 0 0 ? ? 0001
0001 0 1 0 0 ? ? 0001
0001 0 0 1 0 ? ? 0001
0001 0 0 0 1 1 ? 0010
0001 0 0 0 1 0 ? 0011
Here is the branch.
52
Timing Variable
CurrentState
Current State
ROM
Next State
Op
Write
Registers
D1
D2
WA
WriteData
ALU
MUX
R0R1
Extend 1to 16
Result
zerobit
1
Write a Comment
User Comments (0)
About PowerShow.com