Revision 15003796
Added by PierreLoïc Garoche over 6 years ago
src/scheduling.ml  

205  205 
prog 
206  206 
([],IMap.empty) 
207  207  
208  
209 
(* Sort the set of equations of node [nd] according 

210 
to the computed schedule [sch] 

211 
*) 

212 
let sort_equations_from_schedule nd sch = 

213 
let find_eq xl eqs = 

214 
let rec aux accu eqs = 

215 
match eqs with 

216 
 [] > 

217 
begin 

218 
Format.eprintf "Looking for variables %a in the following equations@.%a@." 

219 
(Utils.fprintf_list ~sep:" , " (fun fmt v > Format.fprintf fmt "%s" v)) xl 

220 
Printers.pp_node_eqs eqs; 

221 
assert false 

222 
end 

223 
 hd::tl > 

224 
if List.exists (fun x > List.mem x hd.eq_lhs) xl then hd, accu@tl else aux (hd::accu) tl 

225 
in 

226 
aux [] eqs 

227 
in 

228 
(*Format.eprintf "%s schedule: %a@." 

229 
nd.node_id 

230 
(Utils.fprintf_list ~sep:" ; " Scheduling.pp_eq_schedule) sch;*) 

231 
let split_eqs = Splitting.tuple_split_eq_list (get_node_eqs nd) in 

232 
let eqs_rev, remainder = 

233 
List.fold_left 

234 
(fun (accu, node_eqs_remainder) vl > 

235 
if List.exists (fun eq > List.exists (fun v > List.mem v eq.eq_lhs) vl) accu 

236 
then 

237 
(accu, node_eqs_remainder) 

238 
else 

239 
let eq_v, remainder = find_eq vl node_eqs_remainder in 

240 
eq_v::accu, remainder 

241 
) 

242 
([], split_eqs) 

243 
sch 

244 
in 

245 
begin 

246 
if List.length remainder > 0 then ( 

247 
Format.eprintf "Equations not used are@.%a@.Full equation set is:@.%a@.@?" 

248 
Printers.pp_node_eqs remainder 

249 
Printers.pp_node_eqs (get_node_eqs nd); 

250 
assert false); 

251 
List.rev eqs_rev 

252 
end 

253  
254  
208  255 
let pp_eq_schedule fmt vl = 
209  256 
match vl with 
210  257 
 [] > assert false 
Also available in: Unified diff
copy of trunk. With option lustre and annotation linearization, will simplify the lustre code