-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol_example.dats
26 lines (19 loc) · 1.03 KB
/
control_example.dats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(**
This file was automatically generated by our modified Prelude compiler
*)
staload "rat.sats"
staload "flow.sats"
extern fun controller(i: strict_flow (int, 100, RationalDiv(0, 1)), j: strict_flow (int, 100, RationalDiv(0, 1))): (strict_flow (int, 100, RationalDiv(0, 1)), strict_flow (int, 100, RationalDiv(0, 1)))
extern fun database(i: strict_flow (int, 10, RationalDiv(0, 1))): (strict_flow (int, 10, RationalDiv(0, 1)))
fun main(i: strict_flow (int, 10, RationalDiv(0, 1))): (strict_flow (int, 100, RationalDiv(0, 1))) = let
var response : strict_flow (int, 10, RationalDiv(0, 1))
prval pfresponse = flow_future_make (response)
var command : strict_flow (int, 100, RationalDiv(0, 1))
prval pfcommand = flow_future_make (command)
val (o, command') = controller ((flow_divide_clock (i, 10)), (flow_divide_clock ((flow_fby (0, response)), 10)))
val (response') = database (flow_multiply_clock (command, 10))
prval () = flow_future_elim (pfresponse, response, response')
prval () = flow_future_elim (pfcommand, command, command')
in
(o)
end