de.cau.cs.kieler.krep.compiler.ceq
Class KlpProgram

java.lang.Object
  extended by de.cau.cs.kieler.krep.compiler.ceq.Program
      extended by de.cau.cs.kieler.krep.compiler.ceq.KlpProgram

public class KlpProgram
extends Program

Klp assembler, extends a program by the compiler from CEQs into actual klp assembler.

Rating yellow
(2010-02-05) review by cmot, msp, tam

Field Summary
static int N_IO
          Number of input output registers.
static int N_LOCAL
          Number of full local registers.
static int N_TEMP
          Number of temporary registers.
 
Constructor Summary
KlpProgram(String name)
           
KlpProgram(String name, Program p)
          Generate a new program from an existing one.
 
Method Summary
 LinkedList<AbstractInstruction> compile(boolean useHWClocks, String scope)
          generate KLP instructions for all equations.
 LinkedList<AbstractInstruction> compileInit(boolean useHWClocks, String scope, boolean setInputs, boolean setOutputs, int prioOffset)
           
 int nEq()
           
 int nInstr()
           
 int nReg()
           
 String toDot()
           
 String toString()
           
 
Methods inherited from class de.cau.cs.kieler.krep.compiler.ceq.Program
addEq, addInput, addLocal, addOutput, addVar, addVar, destroyTemp, flatten, getDepGraph, getEqs, getInputs, getLabel, getLocals, getMax, getName, getOutputs, getSsms, getTemp, getVar, getVar, getVars, init, propagateConst, removeEquiv, replace, setDepGraph, setEqs, setInputs, setLocals, setName, setOutputs, setSsms, setVars, simplify, staticEval, toLustre, wcrt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

N_IO

public static final int N_IO
Number of input output registers.

See Also:
Constant Field Values

N_LOCAL

public static final int N_LOCAL
Number of full local registers.

See Also:
Constant Field Values

N_TEMP

public static final int N_TEMP
Number of temporary registers.

See Also:
Constant Field Values
Constructor Detail

KlpProgram

public KlpProgram(String name)
Parameters:
name - name of the main node

KlpProgram

public KlpProgram(String name,
                  Program p)
Generate a new program from an existing one.

Parameters:
name - of the program
p - the program
Method Detail

compile

public LinkedList<AbstractInstruction> compile(boolean useHWClocks,
                                               String scope)
generate KLP instructions for all equations.

Parameters:
useHWClocks - use hardware clocks, if false, a software test for clocks is generated
scope - scope, if the equations is in a state
Returns:
klp instructions that implement the program

toString

public String toString()
Overrides:
toString in class Program

nInstr

public int nInstr()
Returns:
number of instructions

nEq

public int nEq()
Returns:
number of clocked equations

toDot

public String toDot()
Returns:
dot description of the dependency graph

compileInit

public LinkedList<AbstractInstruction> compileInit(boolean useHWClocks,
                                                   String scope,
                                                   boolean setInputs,
                                                   boolean setOutputs,
                                                   int prioOffset)
Parameters:
useHWClocks - should the hw clocks of the klp be used?
scope - scope of this program, if it is inside of an automaton
setInputs - should inputs be initialized (for initial states)
setOutputs - should outputs be initialized (for initial states)
prioOffset - minimal priority to use
Returns:
klp code to initialize the registers

nReg

public int nReg()
Returns:
number of totally used registers