Toward a general purpose computer
This presentation is the property of its rightful owner.
Sponsored Links
1 / 46

Toward a general purpose computer PowerPoint PPT Presentation


  • 51 Views
  • Uploaded on
  • Presentation posted in: General

Toward a general purpose computer. Example: Game of Life. Game of Life. Solve Cell. For Each Cell. For Each Line. Game of Life. Matrix. Generation. Line. Cell. Solve Cell. For Each Cell. For Each Line. Modularity. Generation Module Matrix Module Line Module Cell Module.

Download Presentation

Toward a general purpose computer

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Toward a general purpose computer

Toward a general purpose computer

Example: Game of Life


Game of life

Game of Life

Solve Cell

For Each Cell

For Each Line


Game of life1

Game of Life

Matrix

Generation

Line

Cell

Solve Cell

For Each Cell

For Each Line


Modularity

Modularity

  • Generation Module

  • Matrix Module

  • Line Module

  • Cell Module


Algorithm for the generation module

Algorithm for the Generation Module

  • CurrentGen = 0

  • Solve for current Matrix

  • CurrentGen++

  • If CurrentGen < MAX_GEN

    goto 2


Solve matrix

Solve Matrix

0. j = 1

1. Calculate line (j)

2. If j < MAX_LINE

2.1 j++

2.2 goto 1.

3. STOP


Calculate line j

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 < MAX_CELL

3.1 i++

3.2 goto 1.

4. Store tmp in :

even generation: i+16odd generation : i-16


Cellalive cell index i line index j

CellAlive(cell index i, line index j)

0. N = Count_Neighbors(i,j-1,false)

1. N = N+Count_Neighbors(i,j,true)

2. N = N+Count_Neighbors(i,j+1,false)

3. If N > MIN && N < MAX

3.1 Return alive

4. Return dead


Count neighbors index i line j center

Count_Neighbors(index i,line j, center)

0. N = 0

1. If alive in location [i-1,j]: N=N+1

2. If not center:

2.1 If alive in location [i,j]: N=N+1

3. If alive in location [i+1,j]: N=N+1

4. Return N


Algorithm implementation

Algorithm implementation

Algorithm

How to do?

What to do?

The operation itself

control


The operations in the algorithm

The operations in the algorithm:

Operations:

  • Add

  • Subtract


The operation defining interfaces

The Operation itself

The operation:Defining interfaces

(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


Implementing instructions module count neighbors instruction 1 2 1 3

The Operation itself

Implementing instructionsModule Count_Neighbors, instruction 1, 2.1, 3

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

Non Zero – cell in

location i is alive

Zero – cell in

location i is dead


Implementing instructions module count neighbors instruction 1 2 1 31

The Operation itself

Implementing instructionsModule Count_Neighbors, instruction 1, 2.1, 3

If alive in location [i-1,j]

Alive if AND(line,decode(i-1))

is not zero


The operations in the algorithm1

The Operation itself

The operations in the algorithm:

Operations:

  • Add

  • Subtract

  • The logic AND + Check if zero


Small alu arithmetic logic unit

The Operation itself

Small ALU (arithmetic logic unit)


Small alu

The Operation itself

Small ALU

StatusBit


Small alu1

The Operation itself

Small ALU

InputB

InputA

ALU

Op

StatusBit

isZero


Implementation of and line decode i 1

Implementation of AND(line,decode(i+1))

Reg1

Reg2

Reg3

Regn


Implementation of and line decode i 11

Implementation of AND(line,decode(i+1))

Reg1

1

ReadA

ReadB

Reg2

2

Reg3

Connected like MUX 1

Regn


Implementation of and line decode i 12

Implementation of AND(line,decode(i+1))

Reg1

1

ReadA

ReadB

Reg2

2

Write Address

Reg3

Write Data

Regn

Decoder

Write

Enable


Implementation of and line decode i 13

Implementation of AND(line,decode(i+1))

Registers

Data 1 Address

Data 1

Data 2 Address

Data 2

WriteAddress

Write Data

Write


Variables of the algorithm count neighbors

Variables of the algorithmCount_Neighbors


Variables of the algorithm count neighbors1

Variables of the algorithmCount_Neighbors


Register alu circuit

Register/ALU circuit

Registers

Data 1 Address

Op

Data 2 Address

WriteAddress

ALU

Extend 1to 16

MUX

R0R1

Write

2

0

ExternalInput

1


Control algorithm is zero and line decode i 1

The Operation itself

Control Algorithm is zero[AND(line,decode(i+1))]

If alive in location [i+1,j]: N=N+1

Algorithm instruction

Instruction

  • Tmp = is zero[AND(Currentline,

    • decode(i+1))]

  • If controlVariable=0000001: N=N+1


  • Control algorithm is zero and line decode i 11

    The Operation itself

    Control Algorithm is zero[AND(line,decode(i-1))]

    Tmp = is zero[AND(line,decode(i-1))]

    Instruction

    t0. Tmp = i-1

    t1. Tmp = decode(Tmp)

    t2. controlVariable = is zero[AND(CurrentLine, Tmp)]

    Micro-Instruction


    Micro instruction implementation

    The Operation itself

    Micro instruction implementation

    • Tmp = i+1

    • Tmp = decode(Tmp)

    • controlVariable = is zero[AND(CurrentLine, Tmp)]

    Micro-Instruction

    i

    t0. Data 1 Address = 1Data 2 Address = 5

    WriteAddress = 3

    Write = 1

    Op = 01R0R1 = 01

    1

    tmp

    Subtract

    The result of the ALU


    Micro instruction implementation1

    The Operation itself

    Micro instruction implementation

    • Tmp = i+1

    • Tmp = decode(Tmp)

    • controlVariable = is zero[AND(CurrentLine, Tmp)]

    Micro-Instruction

    tmp

    t1. Data 1 Address = 3Data 2 Address = 0

    WriteAddress = 4

    Write = 1

    Op = 11R0R1 = 01

    Irrelevant

    tmp

    Decode

    The result of the ALU


    Micro instruction implementation2

    The Operation itself

    Micro instruction implementation

    • Tmp = i+1

    • Tmp = decode(Tmp)

    • controlVariable = is zero[AND(CurrentLine, Tmp)]

    Micro-Instruction

    Line in register i

    t2. Data 1 Address = 0Data 2 Address = 3

    WriteAddress = 6

    Write = 1

    Op = 10R0R1 = 00

    tmp

    controlVariable

    And

    The zero status bit


    Instruction hierarchy

    The Operation itself

    Instruction Hierarchy

    Algorithmic Instruction

    Instruction

    Micro-Instruction

    Micro-Instruction

    Instruction

    Micro-Instruction

    Micro-Instruction


    Instruction hierarchy1

    Instruction Hierarchy

    Timing Variables

    Instruction

    t0: Micro-Instruction

    tn: Micro-Instruction

    Each micro

    instruction = 1 cycle

    Instruction

    t0:Micro-Instruction

    tn: Micro-Instruction


    Timing variables example with 4 time variables

    Timing variables (example with 4 time variables)

    CP

    t0

    t1

    t2

    t3

    One instruction


    Generating timing variables example with 16 timing variables

    Generating Timing variablesexample with 16 timing variables

    Register 4bits

    CP

    t0

    t15

    1

    Decoder

    Adder


    Control of count neighbor

    Control of Count_Neighbor


    Control of count neighbor1

    Control of Count_Neighbor

    0000

    0001

    0010

    0011

    0100

    0101

    0110

    0111

    1000


    Control of count neighbor2

    Control of Count_Neighbor

    0000

    0001

    0010

    0011

    0100

    0101

    0110

    0111

    1000


    Putting it all together implementing what to do with rom

    Putting it all together:implementing what to do with ROM

    ROM Output

    ROM Input

    Center

    Register 7 (16bits)

    Control variable (16bits)

    The current state

    (4 bits)

    The current timing variable(1 bits)


    Putting it all together implementing what to do with rom1

    Putting it all together: implementing what to do with ROM

    ROM Output

    ROM Input

    Data 1 Address

    Data 2 Address

    Write-Data MUX control

    WriteAddress

    Write

    ALU Operation


    Putting it all together implementing what to do with rom2

    Putting it all together: implementing what to do with ROM

    ROM Output

    ROM Input

    t0. Tmp = i+1

    t1. Tmp = decode(Tmp)

    t2. controlVariable = is zero[AND(CurrentLine, Tmp)]

    t3. do nothing


    Putting it all together implementing what to do with rom3

    Putting it all together: implementing what to do with ROM

    ROM Output

    ROM Input

    t0. Tmp = i+1

    t1. Tmp = decode(Tmp)

    t2. controlVariable = is zero[AND(CurrentLine, Tmp)]

    t3. do nothing


    Putting it all together implementing what to do with rom4

    Putting it all together: implementing what to do with ROM

    ROM Output

    ROM Input

    t0. Tmp = i+1

    t1. Tmp = decode(Tmp)

    t2. controlVariable = is zero[AND(CurrentLine, Tmp)]

    t3. do nothing


    Putting it all together implementing what to do with rom5

    Putting it all together: implementing what to do with ROM

    ROM Output

    ROM Input

    t0. Tmp = i+1

    t1. Tmp = decode(Tmp)

    t2. controlVariable = is zero[AND(CurrentLine, Tmp)]

    t3. do nothing


    Control of count neighbor3

    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 ControlVariable=1

    Set Current State 0010

    t3. If ControlVariable=0

    Set Current State 0011

    0011

    0100

    0101

    0110

    0111

    1000


    Putting it all together implmenting control with rom

    Putting it all together:implmenting control with ROM

    ROM Input

    ROM Output

    Here is the branch.


    Toward a general purpose computer

    Timing Variable

    CurrentState

    Current State

    Next State

    ROM

    Op

    Write

    Registers

    D1

    D2

    WA

    WriteData

    ALU

    MUX

    R0R1

    Extend 1to 16

    Result

    zerobit

    1


  • Login