mapss.dif.csdf.sdf.sched
Class ProcedureSynthesis

java.lang.Object
  extended by mapss.dif.csdf.sdf.sched.ProcedureSynthesis
Direct Known Subclasses:
CompactProcedureSynthesis

public class ProcedureSynthesis
extends java.lang.Object

Procedure synthesis for a schedule. This class is a helpful companion tool for ProcedureStrategy or any schedule that will be implemented in procedures.

Version:
$Id: ProcedureSynthesis.java 406 2007-05-10 14:27:07Z plishker $
Author:
Mingyung Ko

Field Summary
protected  java.util.Collection _bottomProcedures
          A collection of bottom-level procedures.
protected  java.util.List _procedures
          A list of all procedures synthesized.
protected  java.util.List _schedules
          A list of registered schedules.
protected  java.util.Map _scheduleToProcedureMap
          A map from schedules to procedures.
protected  Procedure _topProcedure
          The toppest level procedure of the synthesis.
 
Constructor Summary
ProcedureSynthesis(mocgraph.sched.Schedule schedule)
          Constructor of a Schedule.
 
Method Summary
protected  java.lang.String _getName(boolean isGeneralName, Procedure procedure, java.util.Map nameMap)
          Get a procedure's name depending on its type.
protected  Procedure _register(mocgraph.sched.ScheduleElement schedule)
          Register the schedule with a new procedure instantiated.
protected  Procedure _synthesize(mocgraph.sched.ScheduleElement schedule, Procedure caller)
          Synthesize a procedure given a schedule and the caller procedure.
 Procedure getProcedure(int label)
          Get the procedure with the given procedure label.
 Procedure getProcedure(mocgraph.sched.ScheduleElement schedule)
          Get the synthesized procedure given a registered schedule.
 int procedureCount()
          The total number of procedures synthesized.
 int procedureLabel(Procedure procedure)
          Get the integer label of a synthesized procedure.
 java.lang.String toString()
          Display the synthesized procedures in text.
 java.lang.String toString(java.util.Map nameMap)
          Display the synthesized procedures in text.
 java.lang.String toStringWithSchedules(java.util.Map nameMap)
          Display the synthesized procedures in text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_bottomProcedures

protected java.util.Collection _bottomProcedures
A collection of bottom-level procedures. Order does not matter.


_procedures

protected java.util.List _procedures
A list of all procedures synthesized.


_schedules

protected java.util.List _schedules
A list of registered schedules.


_scheduleToProcedureMap

protected java.util.Map _scheduleToProcedureMap
A map from schedules to procedures.


_topProcedure

protected Procedure _topProcedure
The toppest level procedure of the synthesis.

Constructor Detail

ProcedureSynthesis

public ProcedureSynthesis(mocgraph.sched.Schedule schedule)
Constructor of a Schedule.

Parameters:
schedule - The given schedule.
Method Detail

getProcedure

public Procedure getProcedure(int label)
Get the procedure with the given procedure label.

Parameters:
label - The procedure label.
Returns:
The procedure.

getProcedure

public Procedure getProcedure(mocgraph.sched.ScheduleElement schedule)
Get the synthesized procedure given a registered schedule. Return null if the schedule was not registered.

Parameters:
schedule - The given schedule.
Returns:
The procedure. Null if the schedule was not registered.

procedureCount

public int procedureCount()
The total number of procedures synthesized.

Returns:
The total number of procedures.

procedureLabel

public int procedureLabel(Procedure procedure)
Get the integer label of a synthesized procedure. Every synthesized procedure has a unique, global integer label. Procedures are labeled from 0.

Parameters:
procedure - The given procedure.
Returns:
The label associated with the procedure.

toString

public java.lang.String toString()
Display the synthesized procedures in text.

Overrides:
toString in class java.lang.Object
Returns:
The synthesis results in text.

toString

public java.lang.String toString(java.util.Map nameMap)
Display the synthesized procedures in text.

Parameters:
nameMap - Map from SDF nodes to their String names.
Returns:
The synthesized procedures.

toStringWithSchedules

public java.lang.String toStringWithSchedules(java.util.Map nameMap)
Display the synthesized procedures in text.

Parameters:
nameMap - Map from SDF nodes to their names.
Returns:
The synthesis results in text.

_getName

protected java.lang.String _getName(boolean isGeneralName,
                                    Procedure procedure,
                                    java.util.Map nameMap)
Get a procedure's name depending on its type. General names (p0, p1, p2, ...) are returned if the option is selected or the procedure calls other procedures. Otherwise, an SDF node name is returned.

Parameters:
isGeneralName - True if general name is desired; false otherwise.
procedure - The procedure.
nameMap - A map from SDF nodes to text names.
Returns:
The name in text.

_register

protected Procedure _register(mocgraph.sched.ScheduleElement schedule)
Register the schedule with a new procedure instantiated. A new schedule is cloned, with iterations set to 1, from the given schedule to avoid interferences to the original schedule.

It is users' responsibility to ensure that the schedule was not registered before.

Parameters:
schedule - The schedule to register.
Returns:
A newly instantiated procedure.

_synthesize

protected Procedure _synthesize(mocgraph.sched.ScheduleElement schedule,
                                Procedure caller)
Synthesize a procedure given a schedule and the caller procedure. This is the main computation of this class.

Parameters:
schedule - The schedule for synthesis.
caller - The procedure calling the synthesized procedure.
Returns:
The synthesized procedure.