## 3 Control Program Representation Accommodated for Direct Hardware Synthesis
### Constructing the Data Flow Graph from Sequential Function Chart  
The proposed intermediate representation is used not only for the ladder diagram but is also suitable for other languages. The sequential function chart (SFC) language enables describing parallel control processes, using a common chart [1; 11; 23]. Opposite to the LD program, where control flow is hidden behind the mutual connection of switches and coils, the SFC graphically depicts the control flow between particular operations, using steps and transitions. The description and operation principles are inherited from Petri nets [3]. Opposite to finite state machines, where only a single state is active at a time, the SFC allows for multiple steps to be active. The output activity is described by actions. Each action can be associated with one or more steps that control its activity. A complex control activity, executed conditionally, can be described using other languages, e.g., LD. It is executed conditionally, depending on the activity of selected steps. The activity of the step is denoted by a token (network marking). The control flow is based on a token passing between steps. The general properties of the SFC permit creating an invalid description, resulting in the infinite multiplication of tokens or placing multiple tokens in a step. The  
Figure 6: The complex functions components DFG mappings of TON timer (**A**) and arithmetic functions (**B**). implementation of SFC assumes a Boolean variable is used for step activity. The correct behavior is assured only if a step can get no more than one token at a time. The SFC that meets this requirement is called a safe network [24; 25]. Taking the above into consideration, the step (s) activity is stored in the implied Boolean variable _s.x_. There, it can be distinguished whether the token acceptance functions (\(a_{i}\)) and token passing functions (\(p_{j}\)) were specified for each transition. The general step activity function can be put down as follows:  
\[s.x=\vee_{i=0}^{m}a_{i}\vee\left(s.x\wedge\left(\wedge_{j=0}^{n}\overline{p_{j }}\right)\right) \tag{6}\]  
The general idea of mapping steps to EFG is shown in Figure 7. Case A depicts the sequence of steps used to show a token-passing concept, using accept and pass conditions. Step _s2_ receives the token, provided step _s1_ is active and condition _c1_ is true. Step _s2_ passes the token to step _s3_, provided the condition _c2_ is true and _s2_ is active. The general token, passing between steps, is shown in Case B. The transition condition requires the activity of all preceding steps (\(sp_{1}\)... \(sp_{m}\)) and fulfilling of condition \(c\). The condition (_c_) can be given, using an LD network. The transition firing condition graph is connected by a simple edge to nodes accepting a token (steps \(ss_{1}\)... \(ss_{n}\)) and via inverting an edge to a token passing node of the transition's preceding steps (\(sp_{1}\)... \(sp_{m}\)). The building procedure assumes creating basic step structures for all declared steps. Actions enable passing control from steps and is associated with variables or enabling a conditional execution of the control program fragment [1; 11]. An action is executed, provided at least one of the steps it is associated with is active. The action mapping methods are outlined in Figure 8. The simplest action (default action or N-type action) lists the variables that are set when it is activated. Its EFG mapping, using a conditional choice node, is shown in Case A. An action holding a fragment of the control program is executed conditionally. A variable assignment node is preceded with a conditional selection of a value, based on action activity. The action implemented in EFG is shown in Case B. The SFC standard defines action attributes to be used. There have been selected N, S, R, and P attributes of an action to illustrate the method of implementing an action control block. It is required that the R action is dominant, which requires appropriate implementation.