balm-ii
DESCRIPTION
Using Balm-II to solve Automata ProblemsTRANSCRIPT
BALM-II
BY
HA
SS
AN
AL N
AJ J
AR
B0
00
32
20
1 &
MO
HA
MM
ED
AL S
OL H
B0
00
50
76
2
SU
PE
RV
I SE
D B
Y : DR
. KH
AL E
D E
L F AK
I H
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.
2
“Reference from Balm-II Manual & Berkeley Website”
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.
3
“Reference from Balm-II Manual & Berkeley Website”
REQUIREMENTS FOR BALM-II
1. Ubuntu http://www.ubuntu.com/download/desktop2. Balm-II package from:
http://esd.scienze.univr.it/index.php/it/balm-ii.html3. xDot package from Ubuntu software center
4
VIRTUAL BOX GUIDE
1. Install Virtual Box Either From (VirtualBox-4.2.6-Installation.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
VIRTUAL BOX GUIDE - CONTINUED
4. Click open Appliance
6
VIRTUAL BOX GUIDE - CONTINUED
5. Choose the Ubuntu.ova file from the root folder of the DVD Distributed and click open
7
VIRTUAL BOX GUIDE - CONTINUED
5. Choose the Ubuntu.ova file from the root folder of the DVD Distributed and click open
8
VIRTUAL BOX GUIDE - CONTINUED
6. Click Next:
9
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
VIRTUAL BOX GUIDE - CONTINUED
8. Wait for import to complete:
11
VIRTUAL BOX GUIDE - CONTINUED
9. Double click on Ubuntu machine to start it or click on it once then click on start
12
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
RUNNING BALM-II
2. Now you have entered the balm-II tool, you can type help to display all operators of balm-II
14
CREATING A .AUT FILE (AUTOMATA)
15
1. Open the balm-II shortcut
2. Make a new folder, eg: “automata1” in the balm-II folder
CREATING A .AUT FILE (AUTOMATA)
16
1. Open the balm-II shortcut
2. Make a new folder, eg: “automata1” in the balm-II folder
CREATING A .AUT FILE (AUTOMATA)
17
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”
CREATING A .AUT FILE (AUTOMATA)
18
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 EX is the input and E is the tagname for X input
.outputs Accthe above line should be available by default
.mv X 2 X1 X2X 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 E1E is the same as “d”
.mv CS, NS 2 A BCS, 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 CSthe above 2 lines should be available by default and it is for the automata initialization
A 1the above line means the state “A” is set to accepted state, if it is 0 then it is not accepted state
CREATING A .AUT FILE (AUTOMATA)
19
.table CS -> Acc.default 1this means the remaining states other than “A” is set to accepted state, and also 0 means not accepted
.table X E CS -> NSthe above line is for setting the transitions, you need to enter the same inputs in the bolded text
X1 E0 A BX2 E0 B A- E1 A A- E1 B Bthe 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
.endby 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
PLOTTING THE AUT FILE
20
1. Open Balm-II2. Write: plot_aut [the path to the .aut file you need to plot]
3. The resultant plotted automata will open in a separate Window
STEPS TO GENERATE THE LARGEST SOLUTION
21
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 onexample 1.1 – “spec.aut” file:1. Open Balm-II as described before2. Create the specification and component files in a folder named “automata1”
inside balm-II folder as described before3. Execute the following steps:
Optional: plot both spec.aut and comp.aut to view the automata(s) visually:plot_aut automata1/spec.aut
STEPS TO GENERATE THE LARGEST SOLUTION
22
plot_aut automata1/comp.aut
STEPS TO GENERATE THE LARGEST SOLUTION
23
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 outputplot_aut automata1/a1.aut
STEPS TO GENERATE THE LARGEST SOLUTION
24
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 outputplot_aut automata1/a2.aut
STEPS TO GENERATE THE LARGEST SOLUTION
25
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 outputplot_aut automata1/a3.aut
STEPS TO GENERATE THE LARGEST SOLUTION
26
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.autPlease 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 outputplot_aut automata1/a4.aut
STEPS TO GENERATE THE LARGEST SOLUTION
27
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 outputplot_aut automata1/a5.aut
STEPS TO GENERATE THE LARGEST SOLUTION
28
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
STEPS TO GENERATE THE LARGEST SOLUTION
29
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 outputplot_aut automata1/a7.aut
STEPS TO GENERATE THE LARGEST SOLUTION
30
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.autOptional: Plot the above to see the outputplot_aut automata1/a8.aut
STEPS TO GENERATE THE LARGEST SOLUTION
31
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.autOptional: Plot the above to see the outputplot_aut automata1/a9.aut
This example can be found in: /home/coe531/balm-II/Described_Examples/automata1in the virtual machine
CONVERTING FSM TO AUTOMATA
32
Look at the example 2.1 which represents the file “FSM.aut”
1. Optional: Plot the FSM file:plot_aut FSM2Aut/FSM.aut
CONVERTING FSM TO AUTOMATA
33
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/FSM2Autin the virtual machine
EXERCISE AUTOMATA LARGEST SOLUTION
34
Look at examples 3.1 and 3.2:
EXERCISE AUTOMATA LARGEST SOLUTION
35
3.2:
EXERCISE AUTOMATA LARGEST SOLUTION
36
3.2:
SOLUTION
37
plot_aut automata2/spec.aut
plot_aut automata2/comp.aut
support X,U(3),E automata2/spec.aut automata2/a1.aut
plot_aut automata2/a1.aut
complement automata2/a1.aut automata2/a2.aut
plot_aut automata2/a2.aut
expansion E1 automata2/a2.aut automata2/a3.aut
plot_aut automata2/a3.aut
product automata2/comp.aut automata2/a3.aut automata2/a4.aut
plot_aut automata2/a4.aut
restriction E1 automata2/a4.aut automata2/a5.aut
plot_aut automata2/a5.aut
complement automata2/a5.aut automata2/a6.aut
plot_aut automata2/a6.aut
support X,U(3) automata2/a6.aut automata2/a7.aut
plot_aut automata2/a7.aut
prefix_close automata2/a7.aut automata2/a8.aut
plot_aut automata2/a8.aut
remove_dc automata2/a8.aut automata2/a9.aut
plot_aut automata2/a9.aut
the input and output files are readily available in
/home/coe531/balm-II/Exercises/automata2in the virtual machine
EXERCISE FSM TO AUTOMATA CONVERSION
38
Look at example 4.1
SOLUTION
39
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/FSM2Autin the virtual machine
CONCLUSION
40
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
FUTURE WORK
41
• 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.autit 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
REFERENCES
42
• Balm-II manual: http://esd.scienze.univr.it/docs/TR-UCB-EECS-2011-102-R1.pdf
• The Unknown Component Problem- Theory and Applications ISBN 978-0-387-34532-1
• http://embedded.eecs.berkeley.edu/mvsis/balm.html
QUESTIONS?
43
THANK YO
U!
By Has
san A
l Naj
jar b
00032201 & M
oham
med
AlS
olh
b00050762
Supervi
sed B
y: D
r.Khal
ed E
lFak
ih
44