data flow graph alg cad

Upload: kumaranraj

Post on 13-Apr-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Data Flow Graph Alg CAD

    1/31

    Data Flow GraphsData Flow GraphsIntroIntro

    Sources: Gang Quan

  • 7/27/2019 Data Flow Graph Alg CAD

    2/31

    Computational ModelsComputational Models

    What:

    A conceptual notion for expressing the function of a system

    E.g. DFG, FSM, Petri net, Turing machine, etc.

    Computational Models & Languages

    Models express the behavior, languages capture models

    Models are conceptual, languages are concrete

    What is in a computational model

    A set of objects

    Rules

    Semantics

  • 7/27/2019 Data Flow Graph Alg CAD

    3/31

    Data Flow Graph (DFG)Data Flow Graph (DFG)

    A modem communications system

    Each box is a single function or sub systems The activity of each block in the chain depends on the

    input of the previous block

    Data driven Each functional block may have to wait until it receives a

    "certain amount" of information before it begins processing

    Some place to output the results

  • 7/27/2019 Data Flow Graph Alg CAD

    4/31

    Data Flow GraphData Flow Graph

    Definition

    A directed graph that shows the data dependenciesbetween a number of functions

    G=(V,E) Nodes (V): each node having input/output data ports

    Arces (E): connections between the output ports and inputports

    Semantics Fire when input data are ready

    Consume data from input ports and produce data to its outputports

    There may be many nodes that are ready to fire at a given time

  • 7/27/2019 Data Flow Graph Alg CAD

    5/31

    Data Flow Graph ConstructionData Flow Graph Construction

    a

    acbbx

    2

    42

    1

    +=

    a

    acbb

    x2

    4

    2

    2

    =

  • 7/27/2019 Data Flow Graph Alg CAD

    6/31

    -1

    +

    -

    x

    /

    **

    sqrt

    x

    x

    b 4 c a 2

    -/

    X1 X2

    a

    acbbx

    24

    2

    1

    +

    =

    a

    acbbx

    2

    42

    2

    =

  • 7/27/2019 Data Flow Graph Alg CAD

    7/31

    Data flow graph constructionData flow graph construction

    original code:

    x

  • 7/27/2019 Data Flow Graph Alg CAD

    8/31

    Data flow graph constructionData flow graph construction

    original code:x

  • 7/27/2019 Data Flow Graph Alg CAD

    9/31

    Data flow graph constructionData flow graph construction

    single-assignment form:x1

  • 7/27/2019 Data Flow Graph Alg CAD

    10/31

    Design IssuesDesign Issues Allocating

    Mapping

    Schedule

    Memory management

    Construction and usage of the queues

  • 7/27/2019 Data Flow Graph Alg CAD

    11/31

    GoalsGoals

    Guarantee correct behavior Utilize hardware efficiently.

    Obtain acceptable performance.

  • 7/27/2019 Data Flow Graph Alg CAD

    12/31

    AllocationAllocation

    Decide the numbers and types of different functional

    units

    E.g. register allocation

    .

    x

  • 7/27/2019 Data Flow Graph Alg CAD

    13/31

    MappingMapping

    Distributing nodes to different functionalunits on which they will fire

    Functional units may provide different functions

    Adder or ALU, MUX or buses, etc

    Functional units may have different delay

    Ripple adder or look ahead adder Determines area, cycle time.

  • 7/27/2019 Data Flow Graph Alg CAD

    14/31

    A Mapping ExampleA Mapping Example

    Subject to:

    Two adders

    Four registers

    b and e cannot be assigned

    to the same register

    +

    +

    a b

    c

    e

    +

    d

    f

  • 7/27/2019 Data Flow Graph Alg CAD

    15/31

    A Mapping ExampleA Mapping Example

    R1: a

    R2: b, c, e

    R3: d, f

    +

    +

    a b

    c

    e

    +

    d

    f

    Subject to:

    Two adders

    Three registers

    a and e cannot be

    assigned to the same

    register

    R3

    Adder 1

    R1 R2

    Adder 2

    Mapping may not be unique !

  • 7/27/2019 Data Flow Graph Alg CAD

    16/31

    Scheduling of DFGScheduling of DFG

    Schedule Creating the sequence in which nodes fire

    Determines number of clock cycles required

    Two simple schedules: As-soon-as-possible (ASAP) schedule puts

    every operation as early in time as possible

    As-late-as-possible (ALAP) schedule putsevery operation as late in schedule as possible

  • 7/27/2019 Data Flow Graph Alg CAD

    17/31

    ASAPASAP

    +

    -

    /

    *-1

    +

    ** t=0

    t=1

    t=2

    t=3

    t=4

    +/ **-1

    -

    *

    +

    Nodes fire whenever the input data are available.

  • 7/27/2019 Data Flow Graph Alg CAD

    18/31

    ALAPALAP

    +

    -

    /

    *-1

    +

    ** t=0

    t=1

    t=2

    t=3

    t=4

    +/

    **

    -1

    -

    *

    +

    Nodes fire when absolutely necessary.

  • 7/27/2019 Data Flow Graph Alg CAD

    19/31

    More about ASAP and ALAPMore about ASAP and ALAP Unlimited resources

    No limit for the number of registers, adders, etc

    Longest path through data flow determinesminimum schedule length

    Mobility

    tL tS

  • 7/27/2019 Data Flow Graph Alg CAD

    20/31

    MobilityMobility

    u = tL- t

    S

    t=0t=1t=2t=3t=4

    +/ **-1-

    *+

    t=0t=1t=2t=3t=4

    +/**

    -1-

    *+

    ASAP

    ALAP

    +

    /

    **

    -1

    -

    *

    +

    u

    0

    0

    0

    1

    0

    2

    0

    The node mobility represents its flexibility in the fire sequence.

  • 7/27/2019 Data Flow Graph Alg CAD

    21/31

    Restrained SchedulingRestrained Scheduling

    Time constraints Time is given, minimize the resource

    Resource constraints

    NP problem

  • 7/27/2019 Data Flow Graph Alg CAD

    22/31

    Time ConstraintsTime Constraints

    -1

    +

    -

    x

    /

    **

    sqrt

    x

    x

    b 4 c a 2

    -/

    X1 X2

    T

    2

    2

    1

    11

    6 7 8

    +/-

    *//

    **

    sqrt-1

    1

    2

    1

    11

    1

    1

    1

    1

    1

  • 7/27/2019 Data Flow Graph Alg CAD

    23/31

    Resource ConstraintsResource Constraints Resource is given, minimize the long time

    List based scheduling

    Maintain a priority based ready list

    The priority can be decide by mobility for example

    Fire the nodes according to their priorities until all

    the resource are used in that stage

  • 7/27/2019 Data Flow Graph Alg CAD

    24/31

    List Based SchedulingList Based Scheduling

    +

    -

    /

    *+

    +

    +

    t=0

    t=1

    t=2

    t=3

    t=4

    +/

    -

    * +

    +

    S.t: one +/-, one *//

    / + + - * + +

    u 0 0 1 0 0 2 0

    t=5+

  • 7/27/2019 Data Flow Graph Alg CAD

    25/31

    List Based SchedulingList Based Scheduling

    A general ASAP Priority based ready list

  • 7/27/2019 Data Flow Graph Alg CAD

    26/31

    Control/Data Flow GraphControl/Data Flow Graph

    (CDFG)(CDFG)

    x 100)

    y

  • 7/27/2019 Data Flow Graph Alg CAD

    27/31

    Control/Data Flow GraphControl/Data Flow Graph Definition

    A directed graph that represents the controldependenciesamong the functions branch

    fall-through G=(V,E)

    Nodes (V)

    Encapsulated DFG

    Decision

    Arces (E)

    flow of the controls

  • 7/27/2019 Data Flow Graph Alg CAD

    28/31

    CDFG ExampleCDFG Examplefun0();

    if (cond1) fun1();else fun2();

    fun3();

    switch(test1) {

    case 1: fun4();break;

    case 2: fun5();

    break;

    case 3: fun6();break;

    }

    fun7();

    fun0

    cond1

    fun3

    fun2fun1

    fun5 fun6fun4

    fun7

    test1

    Y N

  • 7/27/2019 Data Flow Graph Alg CAD

    29/31

    CDFG ExampleCDFG Example

    fun0();

    while(cond1) {

    fun1();}

    fun2();

    fun0

    cond1

    fun3

    fun2Y

    N

  • 7/27/2019 Data Flow Graph Alg CAD

    30/31

    Design IssuesDesign Issues

    Code optimization Loop optimization, dead code detection

    Register allocation

  • 7/27/2019 Data Flow Graph Alg CAD

    31/31

    SummarySummary Data Flow Graph (DFG)

    models data dependencies.

    Does not require that nodes be fired in a particularorder.

    Models operations in the functional modelnoconditionals.

    Allocation and Mapping

    Scheduling ASAP, ALAP, List-based scheduling

    Control/Data Flow Graph

    Represents control dependencies