![]() |
Dataflow Software Stack
032db78
Master Thesis of Mathijs Saey at the VUB
|
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 | |
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.
def backEnd.DVM.dis.DIS.__init__ | ( | self, | |
inputs | |||
) |
Create a DIS object.
This automatically calls addPredefined()
inputs | The amount of inputs the program will accept. |
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.
node | The node to associate with the keys |
toKey | The key if you want to link from a different node to this node, in other words, when this node is the destination. |
fromKey | The 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.
node | The node that is not bound to an address yet. |
idx | The 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.
str | A 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. |
chunk | The chunk where we place the string. |
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.
chunk | The chunk where we can find the string. |
idx | The index of the string. |
func | The 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.
chunk | The chunk this instruction belongs to. |
type | The instruction type (such as OP) |
args | The other arguments, in a list. These depend on the type of instruction. |
def backEnd.DVM.dis.DIS.addLiteral | ( | self, | |
key, | |||
port, | |||
value | |||
) |
Add a literal to DIS.
key | A (chunk, instruction) key pair. |
port | The port to send the literal to. |
value | The 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.
fromKey | The from (chunk, instruction) key pair. |
fromPort | The port to send from. |
toKey | The to (chunk, instruction) key pair. |
toPort | The 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.
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 |