2. INTRODUCTION
In this Project we describe how to solve parallel language equations over
regular languages / automata and finite state machines (FSMs) to
compute the largest solution using the software package BALM-II,
which is an extended version of BALM. The original BALM was able to
solve equations only with respect to synchronous composition; BALM-II
used to solve also equations with respect to parallel composition,
adding new commands and procedures.
“Reference from Balm-II Manual & Berkeley Website”
2
3. BALM-II FEATURES
The Berkeley Automata and Language Manipulation (BALM) software:
•
addresses finite automata in two forms, regular finite automata and
finite state machines.
•
provides for input and output through BLIF, BLIF-MV or "automata"
files.
•
uses symbolic methods to extend the range and speed of automata
manipulation.
•
has special routines for solving language equations and the unknown
component problem.
•
can solve for the complete sequential flexibility of a component
embedded in a system of FSMs.
•
provides visualization of automata.
“Reference from Balm-II Manual & Berkeley Website”
3
4. REQUIREMENTS FOR BALM-II
1. Ubuntu http://www.ubuntu.com/download/desktop
2. Balm-II package from:
http://esd.scienze.univr.it/index.php/it/balm-ii.html
3. xDot package from Ubuntu software center
4
5. VIRTUAL BOX GUIDE
1. Install Virtual Box Either From (VirtualBox-4.2.6Installation.exe) or (VirtualBox-4.2.6-Portable.exe), the
installation version provides network support in the Ubuntu
VM
2. Run Virtual box from the shortcut or run VirtualBox.exe in
case you choose the portable version
3. Click on File >> Import Appliance:
5
10. VIRTUAL BOX GUIDE - CONTINUED
7. You can click import directly with the default values or you can change
the ram, cpu count & machine name if desired:
10
12. VIRTUAL BOX GUIDE - CONTINUED
9. Double click on Ubuntu machine to start it or click on it once then click
on start
12
13. RUNNING BALM-II
1. Click on the terminal icon on the left dock as shown
below, then type:
a. cd balm-II >> Click Enter
b. ./balm32 >> Click Enter
13
14. RUNNING BALM-II
2. Now you have entered the balm-II tool, you can type help to
display all operators of balm-II
14
15. CREATING A .AUT FILE (AUTOMATA)
1. Open the balm-II shortcut
2. Make a new folder, eg: “automata1” in the balm-II folder
15
16. CREATING A .AUT FILE (AUTOMATA)
1. Open the balm-II shortcut
2. Make a new folder, eg: “automata1” in the balm-II folder
16
17. CREATING A .AUT FILE (AUTOMATA)
3. Make a copy from the “template.aut” file in the balm-II folder by right
clicking on the file >> copy then right click on anywhere in the
“automata1” folder and click paste, you can rename the file to whatever you
desire, for example lets name it “spec.aut”
17
18. CREATING A .AUT FILE (AUTOMATA)
Open a1.aut file, below is the explanation for the aut format:
.model automataname
the above line creates an instance of an automata, the bolded text can be replaced with any name you
desire for the automata
.inputs X E
X is the input and E is the tagname for X input
.outputs Acc
the above line should be available by default
.mv X 2 X1 X2
X is the input, 2 is the number of X inputs, X1 and X2 are the variable names for the 2 “X inputs”
.mv E 2 E0 E1
E is the same as “d”
.mv CS, NS 2 A B
CS, NS is by default and means “Current State” & “Next State”, 2 is the number of states, A B are the
variable names for the states
.latch NS CS
.reset CS
the above 2 lines should be available by default and it is for the automata initialization
A1
the above line means the state “A” is set to accepted state, if it is 0 then it is not accepted state
18
19. CREATING A .AUT FILE (AUTOMATA)
.table CS -> Acc
.default 1
this means the remaining states other than “A” is set to accepted state, and also 0 means not accepted
.table X E CS -> NS
the above line is for setting the transitions, you need to enter the same inputs in the bolded text
X1 E0
AB
X2 E0 B A
- E1 A A
- E1 B B
the above line and the next 3 lines means the transitions are specified on the right such as “A” to “B”
transition, and the inputs that cause that transition are specified on the left and it should be in the same
order of the table variables entered “X E”, “-“ means no input will cause the transition, specifying the input
will mean that the input such as “X1” will cause the transition “A to B”
Please note that you have to add a loop for E tag name for all the states to complement and expand the
automata properly
.end
by default to specify the end of the file
After you save the file desired
Please note that if you need to create an aut file representing an FSM you have to replace the “-“
sign with “^” sign and add “^” to the inputs and the .mv lines
19
20. PLOTTING THE AUT FILE
1. Open Balm-II
2. Write: plot_aut [the path to the .aut file you need to plot]
3. The resultant plotted automata will open in a separate
Window
20
21. STEPS TO GENERATE THE LARGEST SOLUTION
Look at examples 1.1 and 1.2 which are the files “spec.aut” and “comp.aut”
that generates the specification and component automata we are going to
work on
example 1.1 – “spec.aut” file:
1.
2.
3.
Open Balm-II as described before
Create the specification and component files in a folder named “automata1”
inside balm-II folder as described before
Execute the following steps:
Optional: plot both spec.aut and comp.aut to view the automata(s) visually:
plot_aut automata1/spec.aut
21
22. STEPS TO GENERATE THE LARGEST SOLUTION
plot_aut automata1/comp.aut
22
23. STEPS TO GENERATE THE LARGEST SOLUTION
1. Start with the specification file, we need to add the alphabet of input variables
in the specification that are not existing in the component and vice versa, this
can be executed by the below 2 steps
write: support (all the inputs of both spec.aut and comp.aut), if the number of
inputs are more than 2 you have to specify it, then you have to specify the
input file which is the specification and output file which is the specification
including the uploaded inputs ex:
support X,U(3),E automata1/spec.aut automata1/a1.aut
Optional: Plot the above to see the output
plot_aut automata1/a1.aut
23
24. STEPS TO GENERATE THE LARGEST SOLUTION
2. Write: complement then you have to specify the input file which is a1.aut and
output file which is the complemented automata, eg:
complement automata1/a1.aut automata1/a2.aut
Optional: Plot the above to see the output
plot_aut automata1/a2.aut
24
25. STEPS TO GENERATE THE LARGEST SOLUTION
3. Write: expansion (the missing input tag in this example is E1 which represents
U1,U2,U3) then you have to specify the input file which is a2.aut and output file
which is the completion of the uploaded automata, eg:
expansion E1 automata1/a2.aut automata1/a3.aut
Optional: Plot the above to see the output
plot_aut automata1/a3.aut
25
26. STEPS TO GENERATE THE LARGEST SOLUTION
Write: product then you have to specify the input file which is comp.aut and the
second input to product which is a3.aut and specify the output file which is the
product of the 2 automatas, eg:
product automata1/comp.aut automata1/a3.aut automata1/a4.aut
Please note that the order is important you have to product the component with
the specification and not vice versa
Optional: Plot the above to see the output
plot_aut automata1/a4.aut
26
27. STEPS TO GENERATE THE LARGEST SOLUTION
5. Write: restriction (the missing input tag in this example is E1 which represents
U1,U2,U3) then the input file a4.aut then the output file which is the restricted
automata, eg:
restriction E1 automata1/a4.aut automata1/a5.aut
Optional: Plot the above to see the output
plot_aut automata1/a5.aut
27
28. STEPS TO GENERATE THE LARGEST SOLUTION
6. Write: complement as described in “b”, eg:
complement automata1/a5.aut automata1/a6.aut
Optional: Plot the above to see the output
plot_aut automata1/a6.aut
28
29. STEPS TO GENERATE THE LARGEST SOLUTION
7. Write: support (all the original inputs only without the tags) then the input file
which is a6.aut and the output file which is the automata with only the original
inputs, eg:
support X,U(3) automata1/a6.aut automata1/a7.aut
Optional: Plot the above to see the output
plot_aut automata1/a7.aut
29
30. STEPS TO GENERATE THE LARGEST SOLUTION
8. Write: prefix_close [the input file you need to remove all fail states from] [the
path to the desired output file that doesn’t contain failed states] eg:
prefix_close automata1/a7.aut automata1/a8.aut
Optional: Plot the above to see the output
plot_aut automata1/a8.aut
30
31. STEPS TO GENERATE THE LARGEST SOLUTION
9. Write: remove_dc then the input file which is a8.aut and the output file which is
the automata without the don’t care state, eg:
remove_dc automata1/a8.aut automata1/a9.aut
Optional: Plot the above to see the output
plot_aut automata1/a9.aut
This example can be found in:
/home/coe531/balm-II/Described_Examples/automata1
in the virtual machine
31
32. CONVERTING FSM TO AUTOMATA
Look at the example 2.1 which represents the file “FSM.aut”
1. Optional: Plot the FSM file:
plot_aut FSM2Aut/FSM.aut
32
33. CONVERTING FSM TO AUTOMATA
2. Open Balm-II as described before
3. Create the file “FSM.aut” from example 2.1 in a folder named “FSM2Aut”
inside balm-II folder as described before
4. Write: read_para_fsm [the inputs/outputs of the FSM] [the path to the
FSM file] [the path to the resultant automata file]
read_para_fsm i|o FSM2Aut/FSM.aut FSM2Aut/Aut.aut
5. Optional: Plot the resultant file:
plot_aut FSM2Aut/Aut.aut
This example can be found in:
/home/coe531/balm-II/Described_Examples/FSM2Aut
in the virtual machine
33
39. SOLUTION
read_para_fsm i|v|u|o FSM2Aut/FSM.aut FSM2Aut/Aut.aut
plot_aut FSM2Aut/Aut.aut
the input and output files are readily available in
/home/coe531/balm-II/Exercises/FSM2Aut
in the virtual machine
39
40. CONCLUSION
Balm-II is an effective tool to help in solving large automata(s) and FSMs
with many states, many theories can be verified using balm tool and it
helps in reducing the manual work and efforts done to solve problems
by hand
40
41. FUTURE WORK
•
Balm-II is having some issues converting automata(s) back to FSMs, the
current command is:
write_para_fsm x|u|y|v|E E0|E1,E4|E3 x_supp.aut x_supp_fsm.aut
it may need to be verified and updated to make it simpler and effective
for the user
•
Balm-II is a command line tool, it would be more effective for the user
to use balm-II visually
41