Skip to content

Commit ca15510

Browse files
committed
fix bugs
1 parent 6dee53e commit ca15510

File tree

8 files changed

+73
-20
lines changed

8 files changed

+73
-20
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This Dockerfile is not currently used for CoCoSim.
2+
# It's work in progress to support docker in the future
13
FROM ubuntu:18.04 as builder
24

35

RELEASE_NOTES.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
CoCoSim version 1.1 release notes
2+
===================================
3+
4+
Release date
5+
------------
6+
7+
May 29th, 2020
8+
9+
List of features:
10+
----------------
11+
12+
* This release contains many bug fixes to v1.0.
13+
* Also some improvements on Stateflow compiler.
14+
Stateflow flow chart algorithm was modified to speedup the verification time. On one example, we reduced verification time of a Stateflow flow chart from hours to seconds.
15+
* Add the option to choose which smt solver (Z3 or Yices2) will be used by Kind2.
16+
* We organized Matlab functions files in packages to avoid any conflicts in function names.
17+
118
CoCoSim version 1.0 release notes
219
===================================
320

doc/TROUBLESHOOTING.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document covers some common issues with CoCoSim, and how to solve them.
66
Contact
77
-------
88

9-
Please contact as at [email protected] with any issue. Or use Github issues reporting system.
9+
Please contact us at [email protected] with any issue. Or use Github issues reporting system.
1010

1111
Installation issues
1212
-------------------
@@ -25,8 +25,19 @@ To call the function in Matlab Command Window:
2525
install_cocosim_lib(true)
2626
```
2727

28+
## Install script issues
29+
### Missing libraries:
2830

29-
**Installing external tools (Kind2, Lustrec, etc ...):**
31+
**Error: gmb.h Cannot be found**
32+
33+
you need to install libgmp3-dev
34+
```
35+
apt-get install libgmp3-dev
36+
```
37+
38+
39+
40+
### Installing external tools (Kind2, Lustrec, etc ...):
3041

3142
If running the script `cocosim2/scripts/install_cocosim` failed. You can install the tools manually and set their path in `cocosim2/tools/tools_config.m`.
3243

@@ -42,3 +53,4 @@ change `osx` by `linux` if your machine is a linux machine.
4253

4354
See [INSTALL.md](../INSTALL.md)
4455

56+

src/backEnd/verification/+coco_nasa_verify/@ToLustreVerify/run_kind2.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@
103103
return;
104104
end
105105
export_verif_results(model, verificationResults, xml_trace);
106-
VerificationMenu.displayHtmlVerificationResultsCallbackCode(model);
106+
VerificationMenu.displayHtmlVerificationResultsCallbackCode(model, ...
107+
verificationResults, ...
108+
fileparts(nom_lustre_file));
107109
catch me
108110
display_msg(me.getReport(), MsgType.DEBUG, 'toLustreVerify.run_kind2', '');
109111
display_msg('Something went wrong in Verification.', MsgType.ERROR, 'toLustreVerify.run_kind2', '');

src/middleEnd/+nasa_toLustre/+IR_pp/+stateflow_IR_pp/+stateflow_fields/confirm_actions_SFIR_pp.m

+13-8
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@
6060
else
6161
display_msg(...
6262
sprintf('To Disable parsing checks of Stateflow State/transition actions, go to: '),...
63-
MsgType.WARNING, 'confirm_actions_SFIR_pp', '');
63+
MsgType.RESULT, 'confirm_actions_SFIR_pp', '');
6464
display_msg('tools -> CoCoSim -> Preferences -> NASA Compiler Preferences -> Skip Stateflow parser check. ', ...
65-
MsgType.WARNING, 'confirm_actions_SFIR_pp', '');
65+
MsgType.RESULT, 'confirm_actions_SFIR_pp', '');
6666
end
6767

6868
if isfield(new_ir, 'States')
69-
new_ir.States = adapt_states(new_ir.States);
70-
69+
[new_ir.States, skip] = adapt_states(new_ir.States);
70+
if skip
71+
return;
72+
end
7173
for i=1:numel(new_ir.States)
7274
statePath = new_ir.States{i}.Path;
7375
% default transition
@@ -98,12 +100,12 @@
98100
end
99101
end
100102
end
101-
function states = adapt_states(states)
103+
function [states, skip] = adapt_states(states)
102104
states_keywords = {'en', 'du', 'ex'};
103105
states_fields = {'Entry', 'During', 'Exit'};
104106
% 'Bind', 'On', 'OnAfter', ...
105107
% 'OnBefore', 'OnAt', 'OnEvery'};
106-
108+
skip = false;
107109
for i=1:numel(states)
108110
statePath = states{i}.Path;
109111
if isfield(states{i}, 'LabelString')...
@@ -139,9 +141,12 @@
139141
fprintf('\n');
140142
end
141143
end
142-
prompt = 'Are all the above actions correct? Y/N [Y]: ';
144+
prompt = sprintf('Are all the above actions correct?\nY(yes)/N(no)/S(skip all next actions) [Y]: ');
143145
str = input(prompt,'s');
144-
if ~isempty(str) && strcmp(upper(str), 'N')
146+
if ~isempty(str) && strcmpi(str, 'S')
147+
skip = true;
148+
return;
149+
elseif ~isempty(str) && strcmpi(str, 'N')
145150
for j=1:numel(states_fields)
146151
f = states_fields{j};
147152
if isfield(states{i}.Actions, f) ...

src/middleEnd/+nasa_toLustre/+utils/@SLX2LusUtils/get_lustre_dt.m

+8
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,17 @@
7272
slx_dt = regexprep(slx_dt, 'Enum:\s*', '');
7373
end
7474
if isKey(TOLUSTRE_ENUMS_MAP, lower(slx_dt))
75+
% Lustrec requires enums to be lower case
7576
isEnum = true;
7677
hasEnum = true;
7778
Lustre_type = lower(slx_dt);
79+
elseif isKey(TOLUSTRE_ENUMS_MAP, slx_dt)
80+
% Kind2 does not require enums to be lower case
81+
% CEX uses enums, therefore the original name should be
82+
% respected
83+
isEnum = true;
84+
hasEnum = true;
85+
Lustre_type = slx_dt;
7886
else
7987
isBus = coco_nasa_utils.SLXUtils.isSimulinkBus(char(slx_dt));
8088
if isBus

src/middleEnd/+nasa_toLustre/ToLustreUnsupportedBlocks.m

+15-8
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
[ir_struct, ir_handle_struct_map, ir_json_path] = nasa_toLustre.IR_pp.internalRep_pp(ir_struct, 1, output_dir);
150150

151151
% add enumeration from Stateflow and from IR
152-
add_IR_Enum(ir_struct);
152+
add_IR_Enum(ir_struct, lus_backend);
153153

154154
%% Unsupported blocks detection
155155
if skip_unsupportedblocks
@@ -178,17 +178,20 @@
178178
end
179179
%% display report files
180180
if isempty(unsupportedOptions)
181+
msg = sprintf(['The model does not contain unsupported blocks.\n' ...
182+
'Some blocks may be partially supported.\n'...
183+
'When running verification or code generation, other errors may appear if some blocks are partially supported.']);
181184
if mode_display == 1
185+
182186
if exist('success.png', 'file')
183187
[icondata,iconcmap] = imread('success.png');
184-
msgbox('Your model is compatible with CoCoSim!','Success','custom',icondata,iconcmap);
188+
msgbox(msg,'Success','custom',icondata,iconcmap);
185189
else
186-
msgbox('Your model is compatible with CoCoSim!');
190+
msgbox(msg);
187191
end
188192
end
189193
% display it too in command window.
190-
display_msg('Your model is compatible with CoCoSim!', ...
191-
MsgType.RESULT, 'ToLustreUnsupportedBlocks', '');
194+
display_msg(msg, MsgType.RESULT, 'ToLustreUnsupportedBlocks', '');
192195

193196
elseif mode_display == 1
194197
try
@@ -281,14 +284,18 @@
281284

282285

283286
%% add enumeration from IR
284-
function add_IR_Enum(ir)
287+
function add_IR_Enum(ir, lus_backend)
285288
global TOLUSTRE_ENUMS_MAP TOLUSTRE_ENUMS_CONV_NODES;
286289
if isfield(ir, 'meta') && isfield(ir.meta, 'Declarations') ...
287290
&& isfield(ir.meta.Declarations, 'Enumerations')
288291
enums = ir.meta.Declarations.Enumerations;
289292
for i=1:numel(enums)
290-
% put the type name in LOWER case: Lustrec limitation
291-
name = lower(enums{i}.Name);
293+
if coco_nasa_utils.LusBackendType.isKIND2(lus_backend)
294+
name = enums{i}.Name;
295+
else
296+
% put the type name in LOWER case: Lustrec limitation
297+
name = lower(enums{i}.Name);
298+
end
292299
if isKey(TOLUSTRE_ENUMS_MAP, name)
293300
continue;
294301
end

src/utils/+coco_nasa_utils/@MenuUtils/createHtmlListUsingHTMLITEM.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
if ~exist(output_dir, 'dir')
5353
coco_nasa_utils.MatlabUtils.mkdir(output_dir);
5454
end
55-
cocoSim_path = regexprep(mfilename('fullpath'), 'cocosim2/.+', 'cocosim2');
55+
cocoSim_path = fileparts(which('start_cocosim'));
5656
% read template
5757
html_text = fileread(fullfile(cocoSim_path, 'src', 'backEnd' , 'html_templates' , 'item_list.html'));
5858

0 commit comments

Comments
 (0)