VISUAL PROGRAMMING TOOL FOR COMPUTER WITH DATA FLOW COMPUTATION CONTROL

The paper presents the brief overview of the design and implementation of visual programming tool for visual creation of data flow graph (DFG) and its automatic transformation to the program code for computer with the data flow computation control that is designed at the Department of Computers and Informatics of the Faculty of Electrical Engineering and Informatics, Technical University of Košice.


INTRODUCTION
Today most common computer architectures are based on the John Von Neumann's principles and are using the control flow model, where computation control is using the flow of instructions.
In most of architectures of control flow computers the next instruction for execution is pointed by the special register called program counter (PC) and this instruction is executed even in the situation when needed operands of instruction are not present.Control flow computing model has the serious limitations in exploiting parallelism in the phase of the program code execution which is one of main disadvantages in comparison with data flow control model.
Data flow control of computation on the other hand controls the flow of program execution not by the flood of instructions, but by the flood of the data.The program code is created in the form of the data flow graph (DFG) that is describing the data dependencies between instructions in the program.
In the dataflow paradigm, the instruction is executable only when operands of the instruction are present and data dependencies between instructions ensure the proper order of instructions execution.Dataflow computation control has main advantage in the possibility to exploit the inherent parallelism on the instructions level in time of the program execution.
In 2009 a prototype of the dataflow computer was developed at the Department of Computers and Informatics, FEI, TUKE [1] Prototype was verified and tested with use of the FPGA technology.Xilinx WebPackISE software and the Xilinx Spartan 3AN Development board were used.Dataflow program for this computer is represented by the binary file that consists of 128b vectors, which are representing program instructions.
To allow comfortable program code creation, visual programming tool was designed, that allows creation of dataflow graph in visual form and transforms DFG into the textual form.
Next parts of this paper are describing design and basic features of the developed CASE tool.

DESIGN AND IMPLEMENTATION OF CASE TOOL FOR PROGRAMMING OF DATAFLOW COMPUTERS
This part of the paper describes the design and implementation of the CASE tool for programming of dataflow computers.The structure of this chapter is divided into sub chapters that chronologically describe the process of the CASE tool creation.

Design of the dataflow graph
The main feature of the CASE tool is drawing of the dataflow graphs.The advantage of drawing and visualization of graphs versus writing program in the form of the source code in textual form is in easy understandability by users as well as in less chance of committing syntax errors.This chance is reached by the possibilities and limitations of applications graphics editor.CASE tool offers a possibility to program a simple dataflow graph.The word "simple" means, the graph does not contain any primitives for generate predicates and copying of instruction operands.The graph does not contain any switch and merge primitives, because these primitives need predicates to properly work.On the other side, dataflow graph consist of these primitives: Operating nodes can be divided into two groups.The first group is a group consisting from binary operations (addition, subtraction, multiplication and division).The second group consists only from one unary operation (negation).Because operations have to work with some data, for this purpose, the application disposes with second group of primitives -Input data.Input data can be constant or variable.In the application's dataflow graph, constants represent numbers.Variables are for defining places where the data will be entering into the graph from outside.The ending element is the last group of graph's primitives.This element does not influence the final source code for a dataflow computer.Recursive algorithms which run behind the scene of a program are using these ending elements to determine the first node of dataflow graph.Input data and operating nodes have to be connected to each other.For this reason the application contains connecting lines, which are representing edges in data flow graph.These four groups of graph primitives contain enough components for successful creation of dataflow graph.

Design and implementation features of the application
Features of CASE tool are closely connected with dataflow graph, which was described in previous subchapter.The features are divided into the groups as well.

Features of graphical editor
The CASE tool belongs into the group of graphical programming tools.The first and most prominent functionality of the tool is a graphical editor.In this part of the application it is possible to visually generate a dataflow graph.The editor includes the following main features:  Inserting nodesthe user can select a type of node.
Next with the help of mouse's cursor put it to the desired position in the scene of graphical editor. Making edges (connecting lines)with these edges the user can make connections between nodes of dataflow graph.One of the features of the editor is the ability to control the validity of connections.It means, for example that the user cannot create the loop in the graph. Moving nodes and edgesthey give a possibility to move items from one position to another for better visualisation of dataflow graph.Edges are moving automatically with the connected nodes. Removing nodes and edgesthe user can remove nodes or edges from the graph in editor as well as insert them.If the user erases a node with the edges, these will be deleted too. Colouring sub-graphsthe user can change colour of sub-graph for better visualisation of partial solution. Zoomingthe user can zoom in or out a scene visualized in the graphical editor. Group selectionthere is the possibility to select more than one node or edge and subsequently edit this group of elements, it means delete or move entire selected sub graph.
Second part of the graphical editor is a list of instructions.This list contains information about activating framework in a "smart" form in which user can read information better than in normal 128 bits binary vector form.Smart representation of instruction has the following form: <Address>_<Description>_<Left Input>_<Right Input> Every node has an address.The address is integer number from interval <0, 126> because target dataflow architecture accepts only 127 nodes.
Each of implemented instructions has the description for better identification of the type of instruction.As the proof of the concept developed CASE tool supports these types of instructions: addition (ADD instruction), subtraction (SUB instruction), multiplication (MUL instruction), division (DIV instruction) and negation (NEG instruction).
Finally the instruction node has the left and a right input.These two fields contain information about edges.When the left or right input pin is free (free means no connection to another node), the left or right input will contain "NULL" string.When a node is connected to a binary or unary operation via the edge, the application uses an address of that instruction for the left or right input.
If the node has a connection to constant 123 on the left pin, the left input will consist from a prefix Const and next value of constant in parentheses.In this case it is Const(123).On the other side the application uses prefix Var for variable node and name of variable is written between parentheses.
The list of instructions contains all binary and unary instructions which are used in a graphical editor.It means, each binary or unary node used in graphical scene has one line in list of instructions.The user can as well use it to find instructions in the graphics editor.Constants, variables and "END" nodes are not included in the list of instructions because their presence in this form is not relevant for the dataflow computer.Implemented graphical editor with the list of instructions in the smart form is shown in the Fig. 1, where is shown the graphical editor (the biggest part in the middle of the figure) with the dataflow graph and the list of instructions (part which is located on the right side of the figure).
Editor of the dataflow graph is capsuled in the main window of the application and is unique for every one project which is opening it.Activation framework is represented as the 128 bits binary vector and to find part of information hidden inside this vector is very hard.For this reason the application contains features to show this information in readable form, also with highlighting of the text in different colours. Export code for target dataflow computer.This code is the result product of the CASE tool.Users can find this code in the special dialog.
Additional features for the improved work with the application are no less important.For example users can show or hide elements of the application to increase space of graphics editor.Instructions have a colour which indicates the connected state.Connected state occurs when users connect instruction to the main dataflow graph (main dataflow graph includes end element in its body).The application contains key shortcuts and many tips as well.At last but not least, users can use the application under several of resolutions of the screen.

Design algorithm unique for application
The application computes a lot of calculations during the process of creating data flow graph.Many of these calculations are very easy, but for some of them the application uses more difficult algorithms.The following subchapters take a closer look to these algorithms.

Algorithm for graph align
Users can lose the sight over the complex data flow graph.Algorithm for graphs align makes the complex dataflow graph better readable.In connection with graph the term level was established to describe where a node appears vertically.The level of a node in a graph is given by the number of links you have to travel up from the END element in order to reach it.The END element is therefore at level 0 (no links need to be followed), and its children nodes are at level 1.Their children nodes are at level 2, and so on.The level of a node is therefore the same as the ycoordinate where it will be drawn in graphics scene.To make it easier on ourselves, and to avoid having to detect whether one node bumps into or overlays another, in algorithm is written a rule that there will only be one node per vertical grid line.This may mean that the graph is a little too spread out horizontally, but it is a whole lot easier to deal with.What this means in practice is that the END's xcoordinate will be equal to the total number of nodes in its left sub-graph.To suit the recursive nature of graphs, the algorithm itself is recursive.Given the END element of a graph and its level, algorithm draws its left sub-graph starting one level down, draws its right sub-graph one level down, and then draws the parent's at its level.Algorithm by the first draws the left sub-graph, then the END element, and lastly the right sub-graph, because after drawing the left sub-graph it has enough information to draw the END element (in essence, it knows the number of nodes in the left sub-graph).

Process of saving and loading projects
The application uses a special structure of file with postfix .yggfor saving projects.This structure consists of XML tags.In these tags all important information is coded for description of all nodes and connection lines used in a project.The application stores these elements of every node inside graphics scene: x-coordinate, y-coordinate, type, address, value, text and colour.For edges application stores these elements: address of node from which line starts, address of destination node, type of connection pin from which line starts and type of destination node's connection pin.The order of these elements is important for successful loading of project from the disk.The final design and implementation of the CASE tool for programming of dataflow computers is shown on the Fig. 2, along with the aligned graph.

CONCLUSION
CASE tool for programming of data flow computers brings to developers of prototype of dataflow computer better tool for work with that prototype.Whole creation of programs for target architecture is easier, because drawing "code" is easier than writing 128 binary bits vectors that are accepted by the data flow computer.However CASE tool has still some limitation.Codevectors are generated in string form and developer has to move this code to the target machine.This moving process takes a time.Avoid this process is the biggest possible improvement of this ISSN 1335-8246 (print) © 2014 FEI TUKE ISSN 1338-3957 (online), www.aei.tuke.sk

Fig. 1 
Fig. 1 Implemented graphical editor with the list of instructions2.2.2.Features of the main windowFeatures of the main window are including all of the functionality which helps the right operation of the CASE tool application.These features also help to the intuitive work of the program.Further points describe the most

Fig. 2
Fig. 2 Final design of the CASE tool for programming of dataflow computers