Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WSymb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OTAWA-plugins
WSymb
Commits
f188ae4c
Commit
f188ae4c
authored
Jan 12, 2021
by
Grebant Sandro
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into cache
parents
ec0fcee0
91e9ef66
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
simplify/test/power.expect
+2
-2
2 additions, 2 deletions
simplify/test/power.expect
simplify/to_c.ml
+16
-9
16 additions, 9 deletions
simplify/to_c.ml
simplify/wcet_formula.ml
+25
-0
25 additions, 0 deletions
simplify/wcet_formula.ml
with
43 additions
and
11 deletions
simplify/test/power.expect
+
2
−
2
View file @
f188ae4c
(l:1;{16,13}) loops: endl
(l:1;{16,9}) loops: endl
((l:1;{4,1}) + ((l:1;{5,3,2}), (__top;{
,
0}), l:2)^p:1) loops: endl
((l:1;{8,2}) + 2.(((l:1;{5,3,2}), (__top;{
,
0}), l:2)^p:1)) loops: endl
((l:1;{4,1}) + ((l:1;{5,3,2}), (__top;{0}), l:2)^p:1) loops: endl
((l:1;{8,2}) + 2.(((l:1;{5,3,2}), (__top;{0}), l:2)^p:1)) loops: endl
This diff is collapsed.
Click to expand it.
simplify/to_c.ml
+
16
−
9
View file @
f188ae4c
...
...
@@ -52,6 +52,13 @@ let c_wlist out_f (wl, last) =
let
c_null_wcet
out_f
()
=
fprintf
out_f
"@[<hov 2>{-1,@ 0,@ NULL,@ 0}@]"
let
c_aw_placeholder
out_f
f
=
match
f
with
|
FConst
_
->
Utils
.
internal_error
"c_aw_placeholder"
"f should not be const or param"
|
_
->
let
eta_count
=
multi_wcet_size_bound
f
in
fprintf
out_f
"@[<hov 2>{-1,@ %d,@ (long long[%d]){0},@ 0}@]"
eta_count
eta_count
let
c_awcet
out_f
(
lid
,
wl
)
=
fprintf
out_f
"@[<hov 2>{%a,@ %a}@]"
c_loopid
lid
...
...
@@ -70,36 +77,36 @@ and c_formula_rec out_f f =
|
FConst
aw
->
fprintf
out_f
"KIND_CONST,@ 0,@ {0},@ %a,@ NULL"
c_awcet
aw
|
FParam
p
->
fprintf
out_f
"KIND_AWCET,@ %d,@ {0},@ %a,@ NULL"
(
int_of_string
p
)
c_
null_wcet
()
fprintf
out_f
"KIND_AWCET,@ %d,@ {0},@ %a,@ NULL"
(
int_of_string
p
)
c_
aw_placeholder
f
|
FPlus
fl
->
fprintf
out_f
"KIND_SEQ,@ 0,@ {%d},@ %a, %a"
(
List
.
length
fl
)
c_
null_wcet
()
c_
aw_placeholder
f
c_formula_operands
fl
|
FUnion
fl
->
fprintf
out_f
"KIND_ALT,@ 0,@ {%d},@ %a, %a"
(
List
.
length
fl
)
c_
null_wcet
()
c_
aw_placeholder
f
c_formula_operands
fl
|
FPower
(
fbody
,
_
,
lid
,
it
)
->
begin
match
it
with
|
SInt
i
->
fprintf
out_f
"KIND_LOOP,@ 0,@ {%a},@ %a, %a"
c_loopid
lid
c_
null_wcet
()
c_formula_operands
[
fbody
]
c_loopid
lid
c_
aw_placeholder
f
c_formula_operands
[
fbody
]
|
SParam
p
->
fprintf
out_f
"KIND_LOOP,@ %d,@ {%a},@ %a, %a"
(
int_of_string
p
)
c_loopid
lid
c_
null_wcet
()
c_
aw_placeholder
f
c_formula_operands
[
fbody
]
end
|
FAnnot
(
f
,
a
)
->
|
FAnnot
(
f
'
,
a
)
->
fprintf
out_f
"KIND_ANN,@ 0,@ {%a},@ %a,@ %a"
c_annot
a
c_
null_wcet
()
c_formula_operands
[
f
]
|
FProduct
(
k
,
f
)
->
c_annot
a
c_
aw_placeholder
f
c_formula_operands
[
f
'
]
|
FProduct
(
k
,
f
'
)
->
fprintf
out_f
"KIND_INTMULT,@ 0,@ {%d},@ %a,@ %a"
k
c_
null_wcet
()
c_formula_operands
[
f
]
k
c_
aw_placeholder
f
c_formula_operands
[
f
'
]
end
;
fprintf
out_f
"}@]"
...
...
This diff is collapsed.
Click to expand it.
simplify/wcet_formula.ml
+
25
−
0
View file @
f188ae4c
...
...
@@ -36,6 +36,31 @@ type t =
let
bot_f
=
FConst
bot_wcet
(** Computes an upper bound to the size of the [multi_wcet]
corresponding to formula [f] ([last] excluded). *)
let
rec
multi_wcet_size_bound
f
=
match
f
with
|
FParam
_
->
1
|
FConst
(
_
,
(
wl
,_
))
->
List
.
length
wl
|
FPlus
flist
->
List
.
fold_left
(
fun
mx
f
->
max
mx
(
multi_wcet_size_bound
f
))
1
flist
|
FUnion
flist
->
List
.
fold_left
(
fun
sum
f
->
sum
+
(
multi_wcet_size_bound
f
))
0
flist
|
FPower
(
fbody
,
fexit
,_,
it
)
->
let
bound_body
=
multi_wcet_size_bound
fbody
in
let
bound_exit
=
multi_wcet_size_bound
fexit
in
begin
match
it
with
|
SInt
i
->
max
(
int_of_float
(
ceil
((
float_of_int
bound_body
)
/.
(
float_of_int
bound_exit
))))
bound_exit
|
SParam
_
->
max
bound_body
bound_exit
end
|
FAnnot
(
_
,
(
_
,
it
))
->
it
|
FProduct
(
_
,
f'
)
->
multi_wcet_size_bound
f'
(* Pretty printing *)
open
Format
...
...
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