diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
commit | 1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68 (patch) | |
tree | 210ffc156c83f04fb0c61a40b4f9037d7ba8a7e1 /test/monniaux/lustrev6-convertible-2cgc/convertible_main.c | |
parent | 222c9047d61961db9c6b19fed5ca49829223fd33 (diff) | |
parent | 12be46d59a2483a10d77fa8ee67f7e0ca1bd702f (diff) | |
download | compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.tar.gz compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.zip |
Merge branch 'mppa-cse2' of gricad-gitlab.univ-grenoble-alpes.fr:sixcy/CompCert into mppa-work
Diffstat (limited to 'test/monniaux/lustrev6-convertible-2cgc/convertible_main.c')
-rw-r--r-- | test/monniaux/lustrev6-convertible-2cgc/convertible_main.c | 1085 |
1 files changed, 1085 insertions, 0 deletions
diff --git a/test/monniaux/lustrev6-convertible-2cgc/convertible_main.c b/test/monniaux/lustrev6-convertible-2cgc/convertible_main.c new file mode 100644 index 00000000..285f8941 --- /dev/null +++ b/test/monniaux/lustrev6-convertible-2cgc/convertible_main.c @@ -0,0 +1,1085 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 -2cgc -node main convertible.lus */ +/* on vanoise the 08/05/2019 at 23:54:11 */ +#include "convertible_main.h" +//// Defining step functions +// Memory initialisation for Lustre_arrow_ctx +void Lustre_arrow_ctx_reset(Lustre_arrow_ctx_type* ctx){ + int _i; + ctx->_memory = _true; +} + +// Initialisation of the internal structure of Lustre_arrow_ctx +void Lustre_arrow_ctx_init(Lustre_arrow_ctx_type* ctx){ + // ctx->client_data = cdata; + Lustre_arrow_ctx_reset(ctx); + } +// Step function(s) for Lustre_arrow_ctx +void Lustre_arrow_step(_integer i1,_integer i2,_integer *out,Lustre_arrow_ctx_type* ctx){ *out = ((ctx->_memory)? i1 : i2); + ctx->_memory = _false; + +} // End of Lustre_arrow_step + +// Memory initialisation for Lustre_arrow_2_ctx +void Lustre_arrow_2_ctx_reset(Lustre_arrow_2_ctx_type* ctx){ + int _i; + ctx->_memory = _true; +} + +// Initialisation of the internal structure of Lustre_arrow_2_ctx +void Lustre_arrow_2_ctx_init(Lustre_arrow_2_ctx_type* ctx){ + // ctx->client_data = cdata; + Lustre_arrow_2_ctx_reset(ctx); + } +// Step function(s) for Lustre_arrow_2_ctx +void Lustre_arrow_2_step(_real i1,_real i2,_real *out,Lustre_arrow_2_ctx_type* ctx){ *out = ((ctx->_memory)? i1 : i2); + ctx->_memory = _false; + +} // End of Lustre_arrow_2_step + +// Memory initialisation for Lustre_arrow_3_ctx +void Lustre_arrow_3_ctx_reset(Lustre_arrow_3_ctx_type* ctx){ + int _i; + ctx->_memory = _true; +} + +// Initialisation of the internal structure of Lustre_arrow_3_ctx +void Lustre_arrow_3_ctx_init(Lustre_arrow_3_ctx_type* ctx){ + // ctx->client_data = cdata; + Lustre_arrow_3_ctx_reset(ctx); + } +// Step function(s) for Lustre_arrow_3_ctx +void Lustre_arrow_3_step(_real i1[50],_real i2[50],_real out[50]/*out*/,Lustre_arrow_3_ctx_type* ctx){ _assign_rp50(out, ((ctx->_memory)? i1 : i2), sizeof(_real [50])); + ctx->_memory = _false; + +} // End of Lustre_arrow_3_step + +// Step function(s) for Lustre_hat_ctx +void Lustre_hat_step(_real i1,_real out[50]/*out*/){ + out[0] = i1; + out[1] = i1; + out[2] = i1; + out[3] = i1; + out[4] = i1; + out[5] = i1; + out[6] = i1; + out[7] = i1; + out[8] = i1; + out[9] = i1; + out[10] = i1; + out[11] = i1; + out[12] = i1; + out[13] = i1; + out[14] = i1; + out[15] = i1; + out[16] = i1; + out[17] = i1; + out[18] = i1; + out[19] = i1; + out[20] = i1; + out[21] = i1; + out[22] = i1; + out[23] = i1; + out[24] = i1; + out[25] = i1; + out[26] = i1; + out[27] = i1; + out[28] = i1; + out[29] = i1; + out[30] = i1; + out[31] = i1; + out[32] = i1; + out[33] = i1; + out[34] = i1; + out[35] = i1; + out[36] = i1; + out[37] = i1; + out[38] = i1; + out[39] = i1; + out[40] = i1; + out[41] = i1; + out[42] = i1; + out[43] = i1; + out[44] = i1; + out[45] = i1; + out[46] = i1; + out[47] = i1; + out[48] = i1; + out[49] = i1; + +} // End of Lustre_hat_step + +// Memory initialisation for Lustre_pre_ctx +void Lustre_pre_ctx_reset(Lustre_pre_ctx_type* ctx){ + int _i; + +} + +// Initialisation of the internal structure of Lustre_pre_ctx +void Lustre_pre_ctx_init(Lustre_pre_ctx_type* ctx){ + // ctx->client_data = cdata; + Lustre_pre_ctx_reset(ctx); + } +// Step function(s) for Lustre_pre_ctx +void Lustre_pre_get(_integer *out,Lustre_pre_ctx_type* ctx){ + *out = ctx->_memory; + +} // End of Lustre_pre_get + +void Lustre_pre_set(_integer i1,Lustre_pre_ctx_type* ctx){ + ctx->_memory = i1; + +} // End of Lustre_pre_set + +// Memory initialisation for Lustre_pre_2_ctx +void Lustre_pre_2_ctx_reset(Lustre_pre_2_ctx_type* ctx){ + int _i; + +} + +// Initialisation of the internal structure of Lustre_pre_2_ctx +void Lustre_pre_2_ctx_init(Lustre_pre_2_ctx_type* ctx){ + // ctx->client_data = cdata; + Lustre_pre_2_ctx_reset(ctx); + } +// Step function(s) for Lustre_pre_2_ctx +void Lustre_pre_2_get(_real *out,Lustre_pre_2_ctx_type* ctx){ + *out = ctx->_memory; + +} // End of Lustre_pre_2_get + +void Lustre_pre_2_set(_real i1,Lustre_pre_2_ctx_type* ctx){ + ctx->_memory = i1; + +} // End of Lustre_pre_2_set + +// Memory initialisation for Lustre_pre_3_ctx +void Lustre_pre_3_ctx_reset(Lustre_pre_3_ctx_type* ctx){ + int _i; + +} + +// Initialisation of the internal structure of Lustre_pre_3_ctx +void Lustre_pre_3_ctx_init(Lustre_pre_3_ctx_type* ctx){ + // ctx->client_data = cdata; + Lustre_pre_3_ctx_reset(ctx); + } +// Step function(s) for Lustre_pre_3_ctx +void Lustre_pre_3_get(_real out[50]/*out*/,Lustre_pre_3_ctx_type* ctx){ + _assign_rp50(out, ctx->_memory, sizeof(_real [50])); + +} // End of Lustre_pre_3_get + +void Lustre_pre_3_set(_real i1[50],Lustre_pre_3_ctx_type* ctx){ + _assign_rp50(ctx->_memory, i1, sizeof(_real [50])); + +} // End of Lustre_pre_3_set + +// Step function(s) for Lustre_slash_ctx +void Lustre_slash_step(_real i1,_real i2,_real *out){ + *out = (i1 / i2); + +} // End of Lustre_slash_step + +// Step function(s) for assign_50_ctx +void assign_50_step(_real v,_integer jv,_real t[50],_real nt[50]/*out*/){ + convertible_update_acc _split_3; + convertible_update_acc dummy; + + _split_3.i = 0; + _split_3.j = jv; + _split_3.v = v; + fillred_update_cell_do_50_step(_split_3,t,&dummy,nt); + +} // End of assign_50_step + +// Step function(s) for convertible_abs_ctx +void convertible_abs_step(_real x,_real *y){ + _real _split_2; + _boolean _split_1; + + _split_2 = - x; + _split_1 = x >= 0.0; + if (_split_1 == _true) { + *y = x; + } else { + *y = _split_2; + } + +} // End of convertible_abs_step + +// Step function(s) for convertible_braking_time_ctx +void convertible_braking_time_step(_real Speed,_real *res){ + _real _split_4; + + _split_4 = Speed * Speed; + Lustre_slash_step(_split_4,5500.0,res); + +} // End of convertible_braking_time_step + +// Memory initialisation for convertible_main_ctx +void convertible_main_ctx_reset(convertible_main_ctx_type* ctx){ + int _i; + + convertible_vehicle_ctx_reset(&ctx->convertible_vehicle_ctx_tab[0]); + convertible_speed_kmh_ctx_reset(&ctx->convertible_speed_kmh_ctx_tab[0]); + convertible_roof_ctx_reset(&ctx->convertible_roof_ctx_tab[0]); + convertible_may_collide_ctx_reset(&ctx->convertible_may_collide_ctx_tab[0]); +} + +// Initialisation of the internal structure of convertible_main_ctx +void convertible_main_ctx_init(convertible_main_ctx_type* ctx){ + // ctx->client_data = cdata; + convertible_main_ctx_reset(ctx); + } +// Step function(s) for convertible_main_ctx +void convertible_main_step(_boolean Start,_boolean Parked,_boolean Rot,_boolean Tick,_boolean OnOff,_boolean Done,_real Dist,_boolean *Danger,_boolean *Locked,_real *Speed,_real *Roof_Speed,convertible_main_ctx_type* ctx){ _boolean _split_7; + _real _split_6; + _real _split_5; + _integer St; + _boolean _split_8; + _boolean _split_9; + + _split_8 = OnOff & Start; + _split_9 = ! _split_8; + convertible_roof_step(Tick,Parked,OnOff,Done,Locked,Roof_Speed,&ctx->convertible_roof_ctx_tab[0]); + convertible_speed_kmh_step(Rot,Tick,Speed,&ctx->convertible_speed_kmh_ctx_tab[0]); + convertible_vehicle_step(Start,*Locked,*Speed,Dist,&St,&ctx->convertible_vehicle_ctx_tab[0]); + switch (St){ + case convertible_anti_col: + _split_6 = Dist; + _split_5 = *Speed; + convertible_may_collide_step(_split_5,_split_6,&_split_7,&ctx->convertible_may_collide_ctx_tab[0]); + *Danger = _split_7; + break; + case convertible_run: + *Danger = _false; + break; + case convertible_stationnary: + *Danger = _false; + break; +} + +} // End of convertible_main_step + +// Step function(s) for convertible_maxr_ctx +void convertible_maxr_step(_real x,_real y,_real *res){ + _boolean _split_10; + + _split_10 = x < y; + if (_split_10 == _true) { + *res = y; + } else { + *res = x; + } + +} // End of convertible_maxr_step + +// Memory initialisation for convertible_may_collide_ctx +void convertible_may_collide_ctx_reset(convertible_may_collide_ctx_type* ctx){ + int _i; + + Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[0]); +} + +// Initialisation of the internal structure of convertible_may_collide_ctx +void convertible_may_collide_ctx_init(convertible_may_collide_ctx_type* ctx){ + // ctx->client_data = cdata; + convertible_may_collide_ctx_reset(ctx); + } +// Step function(s) for convertible_may_collide_ctx +void convertible_may_collide_step(_real Speed,_real Dist,_boolean *Res,convertible_may_collide_ctx_type* ctx){ _real _split_17; + _real _split_16; + _real _split_15; + _real _split_14; + _real _split_13; + _real _split_12; + _real _split_11; + _real Accel; + _real tChoc; + _real tBrake; + + Lustre_pre_2_get(&_split_11,&ctx->Lustre_pre_2_ctx_tab[0]); + _split_12 = Speed - _split_11; + Lustre_slash_step(_split_12,0.1,&_split_13); + Lustre_pre_2_set(Speed,&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_arrow_2_step(0.0,_split_13,&Accel,&ctx->Lustre_arrow_2_ctx_tab[0]); + convertible_braking_time_step(Speed,&tBrake); + _split_15 = - 2.0; + _split_16 = _split_15 * Dist; + _split_14 = 2.0 * Speed; + convertible_solve_eq_d2_step(Accel,_split_14,_split_16,&tChoc); + _split_17 = 2.0 + tBrake; + *Res = tChoc < _split_17; + +} // End of convertible_may_collide_step + +// Step function(s) for convertible_ms_to_kmh_ctx +void convertible_ms_to_kmh_step(_real x,_real *res){ + + *res = x * 3.6; + +} // End of convertible_ms_to_kmh_step + +// Memory initialisation for convertible_roof_ctx +void convertible_roof_ctx_reset(convertible_roof_ctx_type* ctx){ + int _i; + + convertible_roof_speed_ctx_reset(&ctx->convertible_roof_speed_ctx_tab[0]); + Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_ctx_reset(&ctx->Lustre_arrow_ctx_tab[0]); +} + +// Initialisation of the internal structure of convertible_roof_ctx +void convertible_roof_ctx_init(convertible_roof_ctx_type* ctx){ + // ctx->client_data = cdata; + convertible_roof_ctx_reset(ctx); + } +// Step function(s) for convertible_roof_ctx +void convertible_roof_step(_boolean Tick,_boolean Parked,_boolean OnOff,_boolean Done,_boolean *Locked,_real *Roof_Speed,convertible_roof_ctx_type* ctx){ _real _split_25; + _real _split_24; + _integer _split_23; + _boolean _split_22; + _integer _split_21; + _boolean _split_20; + _boolean _split_19; + _integer _split_18; + _integer pst; + _integer st; + _boolean Tick_on_in_motion; + + Lustre_pre_get(&_split_18,&ctx->Lustre_pre_ctx_tab[0]); + switch (pst){ + case convertible_in_motion: + _split_22 = Done; + if (_split_22 == _true) { + _split_23 = convertible_locked; + } else { + _split_23 = convertible_in_motion; + } + st = _split_23; + break; +} + _split_19 = OnOff & Parked; + switch (pst){ + case convertible_locked: + _split_20 = _split_19; + if (_split_20 == _true) { + _split_21 = convertible_in_motion; + } else { + _split_21 = convertible_locked; + } + st = _split_21; + break; +} + Lustre_pre_set(st,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_step(convertible_locked,_split_18,&pst,&ctx->Lustre_arrow_ctx_tab[0]); + *Locked = st == convertible_locked; + switch (st){ + case convertible_in_motion: + Tick_on_in_motion = Tick; + convertible_roof_speed_step(Tick_on_in_motion,&_split_25,&ctx->convertible_roof_speed_ctx_tab[0]); + *Roof_Speed = _split_25; + break; + case convertible_locked: + _split_24 = 0.0; + *Roof_Speed = _split_24; + break; +} + +} // End of convertible_roof_step + +// Memory initialisation for convertible_roof_speed_ctx +void convertible_roof_speed_ctx_reset(convertible_roof_speed_ctx_type* ctx){ + int _i; + + Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[1]); + Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[0]); + Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[1]); + Lustre_arrow_ctx_reset(&ctx->Lustre_arrow_ctx_tab[0]); +} + +// Initialisation of the internal structure of convertible_roof_speed_ctx +void convertible_roof_speed_ctx_init(convertible_roof_speed_ctx_type* ctx){ + // ctx->client_data = cdata; + convertible_roof_speed_ctx_reset(ctx); + } +// Step function(s) for convertible_roof_speed_ctx +void convertible_roof_speed_step(_boolean Tick,_real *Roof_Speed,convertible_roof_speed_ctx_type* ctx){ _real _split_48; + _real _split_47; + _real _split_46; + _real _split_45; + _real _split_44; + _real _split_43; + _real _split_42; + _real _split_41; + _real _split_40; + _real _split_39; + _real _split_38; + _real _split_37; + _real _split_36; + _real _split_35; + _real _split_34; + _real _split_33; + _integer _split_32; + _boolean _split_31; + _real _split_30; + _integer _split_29; + _boolean _split_28; + _real _split_27; + _integer _split_26; + _integer pst; + _integer st; + _real kh; + _real Roof_Percent; + _real pRoof_Percent; + _real slow_it_down; + _real pRoof_Speed; + + switch (Tick){ + case _true: + Lustre_pre_get(&_split_26,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_pre_2_get(&_split_33,&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_arrow_2_step(0.0,_split_33,&pRoof_Percent,&ctx->Lustre_arrow_2_ctx_tab[0]); + switch (pst){ + case convertible_fast: + _split_27 = pRoof_Percent; + _split_28 = _split_27 < 85.0; + if (_split_28 == _true) { + _split_29 = convertible_fast; + } else { + _split_29 = convertible_slow; + } + st = _split_29; + break; + case convertible_slow: + _split_30 = pRoof_Percent; + _split_31 = _split_30 < 100.0; + if (_split_31 == _true) { + _split_32 = convertible_slow; + } else { + _split_32 = convertible_wait; + } + st = _split_32; + break; + case convertible_wait: + st = convertible_fast; + break; +} + Lustre_pre_set(st,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_step(convertible_wait,_split_26,&pst,&ctx->Lustre_arrow_ctx_tab[0]); + Lustre_slash_step(5.,0.1,&_split_38); + Lustre_slash_step(100.,_split_38,&kh); + _split_43 = kh + pRoof_Percent; + switch (st){ + case convertible_fast: + _split_44 = _split_43; + Roof_Percent = _split_44; + break; + case convertible_slow: + _split_47 = pRoof_Percent; + _split_34 = pRoof_Percent; + _split_35 = 100.0 - _split_34; + Lustre_slash_step(_split_35,5.0,&_split_36); + convertible_sqrt_step(_split_36,&_split_37); + convertible_sqrt_step(_split_37,&slow_it_down); + _split_45 = kh; + _split_46 = slow_it_down * _split_45; + _split_48 = _split_46 + _split_47; + Roof_Percent = _split_48; + break; + case convertible_wait: + Roof_Percent = 0.0; + break; +} + Lustre_pre_2_set(Roof_Percent,&ctx->Lustre_pre_2_ctx_tab[0]); + break; +} + Lustre_pre_2_get(&_split_39,&ctx->Lustre_pre_2_ctx_tab[1]); + Lustre_arrow_2_step(0.0,_split_39,&pRoof_Speed,&ctx->Lustre_arrow_2_ctx_tab[1]); + switch (Tick){ + case _false: + _split_40 = pRoof_Speed; + *Roof_Speed = _split_40; + break; + case _true: + switch (st){ + case convertible_fast: + _split_42 = 10.0; + break; + case convertible_slow: + _split_41 = 10.0 * slow_it_down; + _split_42 = _split_41; + break; + case convertible_wait: + _split_42 = 0.0; + break; +} + *Roof_Speed = _split_42; + break; +} + Lustre_pre_2_set(*Roof_Speed,&ctx->Lustre_pre_2_ctx_tab[1]); + +} // End of convertible_roof_speed_step + +// Step function(s) for convertible_solve_eq_d2_ctx +void convertible_solve_eq_d2_step(_real a,_real b,_real c,_real *res){ + _real _split_77; + _real _split_76; + _real _split_75; + _real _split_74; + _real _split_73; + _real _split_72; + _real _split_71; + _real _split_70; + _real _split_69; + _real _split_68; + _real _split_67; + _real _split_66; + _real _split_65; + _real _split_64; + _real _split_63; + _real _split_62; + _real _split_61; + _real _split_60; + _real _split_59; + _integer _split_58; + _integer _split_57; + _boolean _split_56; + _boolean _split_55; + _integer _split_54; + _boolean _split_53; + _boolean _split_52; + _real _split_51; + _real _split_50; + _real _split_49; + _real delta; + _integer sol_nb; + _real a2; + _real b2; + _real delta_pos; + + _split_50 = 4.0 * a; + _split_51 = _split_50 * c; + _split_49 = b * b; + delta = _split_49 - _split_51; + _split_56 = delta == 0.0; + if (_split_56 == _true) { + _split_57 = convertible_one_sol; + } else { + _split_57 = convertible_two_sol; + } + _split_55 = delta < 0.0; + if (_split_55 == _true) { + _split_58 = convertible_no_sol; + } else { + _split_58 = _split_57; + } + _split_53 = b == 0.0; + if (_split_53 == _true) { + _split_54 = convertible_no_sol; + } else { + _split_54 = convertible_deg1; + } + _split_52 = a == 0.0; + if (_split_52 == _true) { + sol_nb = _split_54; + } else { + sol_nb = _split_58; + } + switch (sol_nb){ + case convertible_two_sol: + delta_pos = delta; + a2 = a; + b2 = b; + convertible_sqrt_step(delta_pos,&_split_68); + _split_69 = 2.0 * a2; + Lustre_slash_step(_split_68,_split_69,&_split_70); + _split_67 = - b2; + _split_71 = _split_67 + _split_70; + convertible_sqrt_step(delta_pos,&_split_73); + _split_74 = 2.0 * a2; + Lustre_slash_step(_split_73,_split_74,&_split_75); + _split_72 = - b2; + _split_76 = _split_72 - _split_75; + convertible_maxr_step(_split_71,_split_76,&_split_77); + break; +} + _split_63 = - b; + _split_64 = 2.0 * a; + Lustre_slash_step(_split_63,_split_64,&_split_65); + switch (sol_nb){ + case convertible_one_sol: + _split_66 = _split_65; + break; +} + _split_60 = - c; + Lustre_slash_step(_split_60,b,&_split_61); + switch (sol_nb){ + case convertible_deg1: + _split_62 = _split_61; + *res = _split_62; + break; + case convertible_no_sol: + _split_59 = - 1.0; + *res = _split_59; + break; + case convertible_two_sol: + *res = _split_77; + break; + case convertible_one_sol: + *res = _split_66; + break; +} + +} // End of convertible_solve_eq_d2_step + +// Memory initialisation for convertible_speed_kmh_ctx +void convertible_speed_kmh_ctx_reset(convertible_speed_kmh_ctx_type* ctx){ + int _i; + + sum_50_0d1_ctx_reset(&ctx->sum_50_0d1_ctx_tab[0]); + sum_50_0d0_ctx_reset(&ctx->sum_50_0d0_ctx_tab[0]); + Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[1]); + Lustre_pre_2_ctx_reset(&ctx->Lustre_pre_2_ctx_tab[2]); + Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[0]); + Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[1]); + Lustre_arrow_2_ctx_reset(&ctx->Lustre_arrow_2_ctx_tab[2]); +} + +// Initialisation of the internal structure of convertible_speed_kmh_ctx +void convertible_speed_kmh_ctx_init(convertible_speed_kmh_ctx_type* ctx){ + // ctx->client_data = cdata; + convertible_speed_kmh_ctx_reset(ctx); + } +// Step function(s) for convertible_speed_kmh_ctx +void convertible_speed_kmh_step(_boolean Rot,_boolean Tick,_real *Speed,convertible_speed_kmh_ctx_type* ctx){ _real _split_89; + _real _split_88; + _real _split_87; + _real _split_86; + _real _split_85; + _real _split_84; + _real _split_83; + _real _split_82; + _real _split_81; + _real _split_80; + _real _split_79; + _real _split_78; + _real d; + _real t; + _real pd; + _real pt; + _real dx; + _real tx; + _boolean TickOrRot; + + if (Rot == _true) { + dx = 1.4; + } else { + dx = 0.0; + } + if (Tick == _true) { + tx = 0.1; + } else { + tx = 0.0; + } + TickOrRot = Tick | Rot; + Lustre_pre_2_get(&_split_78,&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_arrow_2_step(0.0,_split_78,&pd,&ctx->Lustre_arrow_2_ctx_tab[0]); + switch (TickOrRot){ + case _false: + _split_80 = pd; + d = _split_80; + break; + case _true: + _split_81 = dx; + sum_50_0d0_step(_split_81,&_split_82,&ctx->sum_50_0d0_ctx_tab[0]); + d = _split_82; + break; +} + Lustre_pre_2_set(d,&ctx->Lustre_pre_2_ctx_tab[0]); + Lustre_pre_2_get(&_split_79,&ctx->Lustre_pre_2_ctx_tab[1]); + Lustre_arrow_2_step(0.0,_split_79,&pt,&ctx->Lustre_arrow_2_ctx_tab[1]); + switch (TickOrRot){ + case _false: + _split_85 = pt; + _split_86 = _split_85; + break; + case _true: + _split_83 = tx; + sum_50_0d1_step(_split_83,&_split_84,&ctx->sum_50_0d1_ctx_tab[0]); + _split_86 = _split_84; + break; +} + convertible_maxr_step(0.1,_split_86,&t); + Lustre_pre_2_set(t,&ctx->Lustre_pre_2_ctx_tab[1]); + Lustre_pre_2_get(&_split_89,&ctx->Lustre_pre_2_ctx_tab[2]); + Lustre_slash_step(d,t,&_split_87); + convertible_ms_to_kmh_step(_split_87,&_split_88); + Lustre_pre_2_set(_split_88,&ctx->Lustre_pre_2_ctx_tab[2]); + Lustre_arrow_2_step(0.0,_split_89,Speed,&ctx->Lustre_arrow_2_ctx_tab[2]); + +} // End of convertible_speed_kmh_step + +// Step function(s) for convertible_sqrt_ctx +void convertible_sqrt_step(_real R,_real *Sqrt){ + + squareR_5_step(R,1.0,Sqrt); + +} // End of convertible_sqrt_step + +// Memory initialisation for convertible_vehicle_ctx +void convertible_vehicle_ctx_reset(convertible_vehicle_ctx_type* ctx){ + int _i; + + Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_ctx_reset(&ctx->Lustre_arrow_ctx_tab[0]); +} + +// Initialisation of the internal structure of convertible_vehicle_ctx +void convertible_vehicle_ctx_init(convertible_vehicle_ctx_type* ctx){ + // ctx->client_data = cdata; + convertible_vehicle_ctx_reset(ctx); + } +// Step function(s) for convertible_vehicle_ctx +void convertible_vehicle_step(_boolean Start,_boolean Locked,_real Speed,_real Dist,_integer *st,convertible_vehicle_ctx_type* ctx){ _integer _split_149; + _boolean _split_148; + _boolean _split_147; + _integer _split_146; + _integer _split_145; + _boolean _split_144; + _boolean _split_143; + _boolean _split_142; + _integer _split_141; + _boolean _split_140; + _boolean _split_139; + _integer _split_138; + _integer pst; + _boolean ac_cond; + + Lustre_pre_get(&_split_138,&ctx->Lustre_pre_ctx_tab[0]); + ac_cond = Speed >= 110.0; + switch (pst){ + case convertible_anti_col: + _split_147 = ac_cond; + _split_148 = ! _split_147; + if (_split_148 == _true) { + _split_149 = convertible_run; + } else { + _split_149 = convertible_anti_col; + } + *st = _split_149; + break; +} + _split_143 = Speed == 0.0; + switch (pst){ + case convertible_run: + _split_144 = _split_143; + if (_split_144 == _true) { + _split_145 = convertible_stationnary; + } else { + _split_145 = convertible_run; + } + _split_142 = ac_cond; + if (_split_142 == _true) { + _split_146 = convertible_anti_col; + } else { + _split_146 = _split_145; + } + *st = _split_146; + break; +} + _split_139 = Start & Locked; + switch (pst){ + case convertible_stationnary: + _split_140 = _split_139; + if (_split_140 == _true) { + _split_141 = convertible_run; + } else { + _split_141 = convertible_stationnary; + } + *st = _split_141; + break; +} + Lustre_pre_set(*st,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_step(convertible_stationnary,_split_138,&pst,&ctx->Lustre_arrow_ctx_tab[0]); + +} // End of convertible_vehicle_step + +// Step function(s) for fillred_update_cell_do_50_ctx +void fillred_update_cell_do_50_step(convertible_update_acc acc,_real cell[50],convertible_update_acc *nacc,_real ncell[50]/*out*/){ + int _i; + for (_i=0 ; _i<49 ; _i+=2){ + update_cell_do_50_step(acc,cell[_i],&acc,&ncell[_i]); + update_cell_do_50_step(acc,cell[_i+1],&acc,&ncell[_i+1]); + } + *nacc = acc; + +} // End of fillred_update_cell_do_50_step + +// Step function(s) for red_rplus_50_real_ctx +void red_rplus_50_real_step(_real i1,_real i2[50],_real *out){ + int _i; + for (_i=0 ; _i<49 ; _i+=2){ + i1 = i1 + i2[_i]; + i1 = i1 + i2[_i+1]; + } + *out = i1; + +} // End of red_rplus_50_real_step + +// Step function(s) for squareR_1_ctx +void squareR_1_step(_real x,_real presqrt,_real *Sqrt){ + _real _split_93; + _real _split_92; + _real _split_91; + _real _split_90; + _real sqrt; + _boolean ecart; + + Lustre_slash_step(x,presqrt,&_split_92); + _split_93 = presqrt + _split_92; + sqrt = 0.5 * _split_93; + _split_90 = presqrt - sqrt; + convertible_abs_step(_split_90,&_split_91); + ecart = _split_91 < 0.0005; + *Sqrt = sqrt; + +} // End of squareR_1_step + +// Step function(s) for squareR_2_ctx +void squareR_2_step(_real x,_real presqrt,_real *Sqrt){ + _real _split_101; + _real _split_100; + _real _split_99; + _real _split_98; + _real _split_97; + _real _split_96; + _real _split_95; + _real _split_94; + _real sqrt; + _boolean ecart; + + Lustre_slash_step(x,presqrt,&_split_96); + _split_97 = presqrt + _split_96; + sqrt = 0.5 * _split_97; + _split_94 = presqrt - sqrt; + convertible_abs_step(_split_94,&_split_95); + ecart = _split_95 < 0.0005; + switch (ecart){ + case _true: + _split_101 = sqrt; + *Sqrt = _split_101; + break; + case _false: + _split_99 = sqrt; + _split_98 = x; + squareR_1_step(_split_98,_split_99,&_split_100); + *Sqrt = _split_100; + break; +} + +} // End of squareR_2_step + +// Step function(s) for squareR_3_ctx +void squareR_3_step(_real x,_real presqrt,_real *Sqrt){ + _real _split_109; + _real _split_108; + _real _split_107; + _real _split_106; + _real _split_105; + _real _split_104; + _real _split_103; + _real _split_102; + _real sqrt; + _boolean ecart; + + Lustre_slash_step(x,presqrt,&_split_104); + _split_105 = presqrt + _split_104; + sqrt = 0.5 * _split_105; + _split_102 = presqrt - sqrt; + convertible_abs_step(_split_102,&_split_103); + ecart = _split_103 < 0.0005; + switch (ecart){ + case _true: + _split_109 = sqrt; + *Sqrt = _split_109; + break; + case _false: + _split_107 = sqrt; + _split_106 = x; + squareR_2_step(_split_106,_split_107,&_split_108); + *Sqrt = _split_108; + break; +} + +} // End of squareR_3_step + +// Step function(s) for squareR_4_ctx +void squareR_4_step(_real x,_real presqrt,_real *Sqrt){ + _real _split_117; + _real _split_116; + _real _split_115; + _real _split_114; + _real _split_113; + _real _split_112; + _real _split_111; + _real _split_110; + _real sqrt; + _boolean ecart; + + Lustre_slash_step(x,presqrt,&_split_112); + _split_113 = presqrt + _split_112; + sqrt = 0.5 * _split_113; + _split_110 = presqrt - sqrt; + convertible_abs_step(_split_110,&_split_111); + ecart = _split_111 < 0.0005; + switch (ecart){ + case _true: + _split_117 = sqrt; + *Sqrt = _split_117; + break; + case _false: + _split_115 = sqrt; + _split_114 = x; + squareR_3_step(_split_114,_split_115,&_split_116); + *Sqrt = _split_116; + break; +} + +} // End of squareR_4_step + +// Step function(s) for squareR_5_ctx +void squareR_5_step(_real x,_real presqrt,_real *Sqrt){ + _real _split_125; + _real _split_124; + _real _split_123; + _real _split_122; + _real _split_121; + _real _split_120; + _real _split_119; + _real _split_118; + _real sqrt; + _boolean ecart; + + Lustre_slash_step(x,presqrt,&_split_120); + _split_121 = presqrt + _split_120; + sqrt = 0.5 * _split_121; + _split_118 = presqrt - sqrt; + convertible_abs_step(_split_118,&_split_119); + ecart = _split_119 < 0.0005; + switch (ecart){ + case _true: + _split_125 = sqrt; + *Sqrt = _split_125; + break; + case _false: + _split_123 = sqrt; + _split_122 = x; + squareR_4_step(_split_122,_split_123,&_split_124); + *Sqrt = _split_124; + break; +} + +} // End of squareR_5_step + +// Memory initialisation for sum_50_0d0_ctx +void sum_50_0d0_ctx_reset(sum_50_0d0_ctx_type* ctx){ + int _i; + + Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[0]); + Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[0]); + Lustre_arrow_ctx_reset(&ctx->Lustre_arrow_ctx_tab[0]); +} + +// Initialisation of the internal structure of sum_50_0d0_ctx +void sum_50_0d0_ctx_init(sum_50_0d0_ctx_type* ctx){ + // ctx->client_data = cdata; + sum_50_0d0_ctx_reset(ctx); + } +// Step function(s) for sum_50_0d0_ctx +void sum_50_0d0_step(_real s,_real *res,sum_50_0d0_ctx_type* ctx){ _integer _split_130; + _real _split_129[50]; + _real _split_128[50]; + _integer _split_127; + _integer _split_126; + _real a[50]; + _real pre_a[50]; + _integer i; + + Lustre_pre_get(&_split_126,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_step(0,_split_126,&_split_127,&ctx->Lustre_arrow_ctx_tab[0]); + i = _split_127 + 1; + Lustre_pre_set(i,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_pre_3_get(_split_129,&ctx->Lustre_pre_3_ctx_tab[0]); + Lustre_hat_step(0.0,_split_128); + Lustre_arrow_3_step(_split_128,_split_129,pre_a,&ctx->Lustre_arrow_3_ctx_tab[0]); + _split_130 = i % 50; + assign_50_step(s,_split_130,pre_a,a); + Lustre_pre_3_set(a,&ctx->Lustre_pre_3_ctx_tab[0]); + red_rplus_50_real_step(0.0,a,res); + +} // End of sum_50_0d0_step + +// Memory initialisation for sum_50_0d1_ctx +void sum_50_0d1_ctx_reset(sum_50_0d1_ctx_type* ctx){ + int _i; + + Lustre_pre_3_ctx_reset(&ctx->Lustre_pre_3_ctx_tab[0]); + Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_3_ctx_reset(&ctx->Lustre_arrow_3_ctx_tab[0]); + Lustre_arrow_ctx_reset(&ctx->Lustre_arrow_ctx_tab[0]); +} + +// Initialisation of the internal structure of sum_50_0d1_ctx +void sum_50_0d1_ctx_init(sum_50_0d1_ctx_type* ctx){ + // ctx->client_data = cdata; + sum_50_0d1_ctx_reset(ctx); + } +// Step function(s) for sum_50_0d1_ctx +void sum_50_0d1_step(_real s,_real *res,sum_50_0d1_ctx_type* ctx){ _integer _split_135; + _real _split_134[50]; + _real _split_133[50]; + _integer _split_132; + _integer _split_131; + _real a[50]; + _real pre_a[50]; + _integer i; + + Lustre_pre_get(&_split_131,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_step(0,_split_131,&_split_132,&ctx->Lustre_arrow_ctx_tab[0]); + i = _split_132 + 1; + Lustre_pre_set(i,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_pre_3_get(_split_134,&ctx->Lustre_pre_3_ctx_tab[0]); + Lustre_hat_step(0.1,_split_133); + Lustre_arrow_3_step(_split_133,_split_134,pre_a,&ctx->Lustre_arrow_3_ctx_tab[0]); + _split_135 = i % 50; + assign_50_step(s,_split_135,pre_a,a); + Lustre_pre_3_set(a,&ctx->Lustre_pre_3_ctx_tab[0]); + red_rplus_50_real_step(0.0,a,res); + +} // End of sum_50_0d1_step + +// Step function(s) for update_cell_do_50_ctx +void update_cell_do_50_step(convertible_update_acc acc,_real cell,convertible_update_acc *nacc,_real *ncell){ + _integer _split_137; + _boolean _split_136; + + _split_136 = acc.i == acc.j; + if (_split_136 == _true) { + *ncell = acc.v; + } else { + *ncell = cell; + } + _split_137 = acc.i + 1; + nacc->i = _split_137; + nacc->j = acc.j; + nacc->v = acc.v; + +} // End of update_cell_do_50_step + |