Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Lustrec - public version
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LustreC
Lustrec - public version
Commits
eb9a8c3c
Commit
eb9a8c3c
authored
6 years ago
by
Pierre Loic Garoche
Browse files
Options
Downloads
Patches
Plain Diff
Moved find_eq from Machine_code to Corelang and sort_eqs from Machine_code to Scheduling
parent
a703ed0c
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/corelang.ml
+16
-0
16 additions, 0 deletions
src/corelang.ml
src/corelang.mli
+3
-1
3 additions, 1 deletion
src/corelang.mli
src/machine_code.ml
+1
-48
1 addition, 48 deletions
src/machine_code.ml
src/scheduling.ml
+35
-0
35 additions, 0 deletions
src/scheduling.ml
with
55 additions
and
49 deletions
src/corelang.ml
+
16
−
0
View file @
eb9a8c3c
...
...
@@ -1199,6 +1199,22 @@ let mk_fresh_var node loc ty ck =
}
in
aux
()
let
find_eq
xl
eqs
=
let
rec
aux
accu
eqs
=
match
eqs
with
|
[]
->
begin
Format
.
eprintf
"Looking for variables %a in the following equations@.%a@."
(
Utils
.
fprintf_list
~
sep
:
" , "
(
fun
fmt
v
->
Format
.
fprintf
fmt
"%s"
v
))
xl
Printers
.
pp_node_eqs
eqs
;
assert
false
end
|
hd
::
tl
->
if
List
.
exists
(
fun
x
->
List
.
mem
x
hd
.
eq_lhs
)
xl
then
hd
,
accu
@
tl
else
aux
(
hd
::
accu
)
tl
in
aux
[]
eqs
(* Local Variables: *)
(* compile-command:"make -C .." *)
(* End: *)
This diff is collapsed.
Click to expand it.
src/corelang.mli
+
3
−
1
View file @
eb9a8c3c
...
...
@@ -165,6 +165,8 @@ val expr_contains_expr: tag -> expr -> bool
val
reset_cpt_fresh
:
unit
->
unit
val
mk_fresh_var
:
node_desc
->
Location
.
t
->
Types
.
type_expr
->
Clocks
.
clock_expr
->
var_decl
(* Local Variables: *)
val
find_eq
:
ident
list
->
eq
list
->
eq
*
eq
list
(* Local Variables: *)
(* compile-command:"make -C .." *)
(* End: *)
This diff is collapsed.
Click to expand it.
src/machine_code.ml
+
1
−
48
View file @
eb9a8c3c
...
...
@@ -226,54 +226,7 @@ let translate_eq node ((m, si, j, d, s) as args) eq =
assert
false
end
let
find_eq
xl
eqs
=
let
rec
aux
accu
eqs
=
match
eqs
with
|
[]
->
begin
Format
.
eprintf
"Looking for variables %a in the following equations@.%a@."
(
Utils
.
fprintf_list
~
sep
:
" , "
(
fun
fmt
v
->
Format
.
fprintf
fmt
"%s"
v
))
xl
Printers
.
pp_node_eqs
eqs
;
assert
false
end
|
hd
::
tl
->
if
List
.
exists
(
fun
x
->
List
.
mem
x
hd
.
eq_lhs
)
xl
then
hd
,
accu
@
tl
else
aux
(
hd
::
accu
)
tl
in
aux
[]
eqs
(* Sort the set of equations of node [nd] according
to the computed schedule [sch]
*)
let
sort_equations_from_schedule
nd
sch
=
(* Format.eprintf "%s schedule: %a@." *)
(* nd.node_id *)
(* (Utils.fprintf_list ~sep:" ; " Scheduling.pp_eq_schedule) sch; *)
let
eqs
,
auts
=
get_node_eqs
nd
in
assert
(
auts
=
[]
);
(* Automata should be expanded by now *)
let
split_eqs
=
Splitting
.
tuple_split_eq_list
eqs
in
let
eqs_rev
,
remainder
=
List
.
fold_left
(
fun
(
accu
,
node_eqs_remainder
)
vl
->
if
List
.
exists
(
fun
eq
->
List
.
exists
(
fun
v
->
List
.
mem
v
eq
.
eq_lhs
)
vl
)
accu
then
(
accu
,
node_eqs_remainder
)
else
let
eq_v
,
remainder
=
find_eq
vl
node_eqs_remainder
in
eq_v
::
accu
,
remainder
)
([]
,
split_eqs
)
sch
in
begin
if
List
.
length
remainder
>
0
then
(
let
eqs
,
auts
=
get_node_eqs
nd
in
assert
(
auts
=
[]
);
(* Automata should be expanded by now *)
Format
.
eprintf
"Equations not used are@.%a@.Full equation set is:@.%a@.@?"
Printers
.
pp_node_eqs
remainder
Printers
.
pp_node_eqs
eqs
;
assert
false
);
List
.
rev
eqs_rev
end
let
constant_equations
nd
=
List
.
fold_right
(
fun
vdecl
eqs
->
...
...
@@ -292,7 +245,7 @@ let translate_eqs node args eqs =
let
translate_decl
nd
sch
=
(*Log.report ~level:1 (fun fmt -> Printers.pp_node fmt nd);*)
let
schedule
=
sch
.
Scheduling_type
.
schedule
in
let
sorted_eqs
=
sort_equations_from_schedule
nd
schedule
in
let
sorted_eqs
=
Scheduling
.
sort_equations_from_schedule
nd
schedule
in
let
constant_eqs
=
constant_equations
nd
in
(* In case of non functional backend (eg. C), additional local variables have
...
...
This diff is collapsed.
Click to expand it.
src/scheduling.ml
+
35
−
0
View file @
eb9a8c3c
...
...
@@ -245,6 +245,41 @@ let pp_warning_unused fmt node_schs =
node_schs
(* Sort eqs according to schedule *)
(* Sort the set of equations of node [nd] according
to the computed schedule [sch]
*)
let
sort_equations_from_schedule
nd
sch
=
(* Format.eprintf "%s schedule: %a@." *)
(* nd.node_id *)
(* (Utils.fprintf_list ~sep:" ; " Scheduling.pp_eq_schedule) sch; *)
let
eqs
,
auts
=
get_node_eqs
nd
in
assert
(
auts
=
[]
);
(* Automata should be expanded by now *)
let
split_eqs
=
Splitting
.
tuple_split_eq_list
eqs
in
let
eqs_rev
,
remainder
=
List
.
fold_left
(
fun
(
accu
,
node_eqs_remainder
)
vl
->
if
List
.
exists
(
fun
eq
->
List
.
exists
(
fun
v
->
List
.
mem
v
eq
.
eq_lhs
)
vl
)
accu
then
(
accu
,
node_eqs_remainder
)
else
let
eq_v
,
remainder
=
find_eq
vl
node_eqs_remainder
in
eq_v
::
accu
,
remainder
)
([]
,
split_eqs
)
sch
in
begin
if
List
.
length
remainder
>
0
then
(
let
eqs
,
auts
=
get_node_eqs
nd
in
assert
(
auts
=
[]
);
(* Automata should be expanded by now *)
Format
.
eprintf
"Equations not used are@.%a@.Full equation set is:@.%a@.@?"
Printers
.
pp_node_eqs
remainder
Printers
.
pp_node_eqs
eqs
;
assert
false
);
List
.
rev
eqs_rev
end
(* Local Variables: *)
(* compile-command:"make -C .." *)
(* End: *)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment