Dataflow Software Stack  032db78
Master Thesis of Mathijs Saey at the VUB
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
backEnd.DVM.dis.DIS Class Reference

This class collects the necessary data to generate a DIS string. More...

Inherits object.

Public Member Functions

def __init__
 Create a DIS object. More...
 
def addPredefined
 Add the standard statements to DIS. More...
 
def linkNode
 Link a node to a key pair. More...
 
def getFromKey
 Get the from key for a node. More...
 
def getToKey
 Get the to key for a node. More...
 
def addCallIdx
 Add the index of a string waiting for the address of a call to become known. More...
 
def addString
 Add a string to a chunk. More...
 
def addKeyedString
 Add a string that needs to receive a key in the instruction memory. More...
 
def modifyString
 Modify a string in the memory. More...
 
def getIdx
 Return the index of the string that was added last. More...
 
def addNewline
 Convenience function to add a newline for prettier output. More...
 
def addNewlines
 Adds a newline to every chunk. More...
 
def addCommentLine
 Convenience function to add a comment line for better documented output. More...
 
def addCommentLines
 Add a comment to every chunk. More...
 
def createChunk
 Generate a chunk string. More...
 
def addInstruction
 Add an instruction. More...
 
def addLiteral
 Add a literal to DIS. More...
 
def addLink
 Add a link to DIS. More...
 
def linkStart
 Link every output of start to an instruction. More...
 
def linkStop
 Link the output of a node to stop. More...
 
def generate
 Return the DIS string for the current contents of the memories. More...
 

Public Attributes

 nodes
 Stores the node -> (chunk, inst) mapping. More...
 
 memory
 Stores the strings per chunk. More...
 
 keys
 Contains the current key per chunk. More...
 
 callMap
 
 chunks
 
 inputs
 
 indent
 

Detailed Description

This class collects the necessary data to generate a DIS string.

It's goal is to facilitate the creation of DIS, by containing the necessary strings while doing necessary bookkeeping such as keys. It also allows us to generate a tidier DIS string by arranging the strings per chunk before printing.

Constructor & Destructor Documentation

def backEnd.DVM.dis.DIS.__init__ (   self,
  inputs 
)

Create a DIS object.

This automatically calls addPredefined()

Parameters
inputsThe amount of inputs the program will accept.

Member Function Documentation

def backEnd.DVM.dis.DIS.addPredefined (   self,
  inputs 
)

Add the standard statements to DIS.

def backEnd.DVM.dis.DIS.linkNode (   self,
  node,
  toKey,
  fromKey 
)

Link a node to a key pair.

We store the source and destination keys separately for nodes that are converted to multiple instructions.

Parameters
nodeThe node to associate with the keys
toKeyThe key if you want to link from a different node to this node, in other words, when this node is the destination.
fromKeyThe key if you want to link from this node, in other words, when this node is the source.
def backEnd.DVM.dis.DIS.getFromKey (   self,
  node 
)

Get the from key for a node.

def backEnd.DVM.dis.DIS.getToKey (   self,
  node 
)

Get the to key for a node.

def backEnd.DVM.dis.DIS.addCallIdx (   self,
  node,
  idx 
)

Add the index of a string waiting for the address of a call to become known.

Parameters
nodeThe node that is not bound to an address yet.
idxThe idx of the string that needs to be updated when the node is bound.
def backEnd.DVM.dis.DIS.addString (   self,
  str,
  chunk 
)

Add a string to a chunk.

This string does not influence keys.

def backEnd.DVM.dis.DIS.addKeyedString (   self,
  str,
  chunk 
)

Add a string that needs to receive a key in the instruction memory.

Parameters
strA format string that has room for a single integer, this means the string should contain a single d. This d will be replaced by the received key.
chunkThe chunk where we place the string.
Returns
A (chunk, key) pair
def backEnd.DVM.dis.DIS.modifyString (   self,
  chunk,
  idx,
  func 
)

Modify a string in the memory.

The result of func(str) will be added to the instruction memory.

Parameters
chunkThe chunk where we can find the string.
idxThe index of the string.
funcThe function to apply on the string.
def backEnd.DVM.dis.DIS.getIdx (   self,
  chunk 
)

Return the index of the string that was added last.

def backEnd.DVM.dis.DIS.addNewline (   self,
  chunk 
)

Convenience function to add a newline for prettier output.

def backEnd.DVM.dis.DIS.addNewlines (   self)

Adds a newline to every chunk.

def backEnd.DVM.dis.DIS.addCommentLine (   self,
  comment,
  chunk 
)

Convenience function to add a comment line for better documented output.

def backEnd.DVM.dis.DIS.addCommentLines (   self,
  comment 
)

Add a comment to every chunk.

def backEnd.DVM.dis.DIS.createChunk (   self,
  idx 
)

Generate a chunk string.

def backEnd.DVM.dis.DIS.addInstruction (   self,
  chunk,
  type,
  args 
)

Add an instruction.

Parameters
chunkThe chunk this instruction belongs to.
typeThe instruction type (such as OP)
argsThe other arguments, in a list. These depend on the type of instruction.
Returns
The (chunk, key) pair of this instruction.
def backEnd.DVM.dis.DIS.addLiteral (   self,
  key,
  port,
  value 
)

Add a literal to DIS.

Parameters
keyA (chunk, instruction) key pair.
portThe port to send the literal to.
valueThe value of the literal.
def backEnd.DVM.dis.DIS.addLink (   self,
  fromKey,
  fromPort,
  toKey,
  toPort 
)

Add a link to DIS.

Links are not dependent on chunks. Currently they are written in the chunk of the from instruction.

Parameters
fromKeyThe from (chunk, instruction) key pair.
fromPortThe port to send from.
toKeyThe to (chunk, instruction) key pair.
toPortThe port to send to.
def backEnd.DVM.dis.DIS.linkStart (   self,
  key 
)

Link every output of start to an instruction.

def backEnd.DVM.dis.DIS.linkStop (   self,
  key 
)

Link the output of a node to stop.

def backEnd.DVM.dis.DIS.generate (   self)

Return the DIS string for the current contents of the memories.

Member Data Documentation

backEnd.DVM.dis.DIS.nodes

Stores the node -> (chunk, inst) mapping.

backEnd.DVM.dis.DIS.memory

Stores the strings per chunk.

backEnd.DVM.dis.DIS.keys

Contains the current key per chunk.

backEnd.DVM.dis.DIS.callMap
backEnd.DVM.dis.DIS.chunks
backEnd.DVM.dis.DIS.inputs
backEnd.DVM.dis.DIS.indent