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-carlightV2 | |
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-carlightV2')
6 files changed, 484 insertions, 0 deletions
diff --git a/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.c b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.c new file mode 100644 index 00000000..206f854a --- /dev/null +++ b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.c @@ -0,0 +1,282 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 carlightV2.lus -n carlight --to-c */ +/* on vanoise the 08/05/2019 at 22:54:09 */ +#include "carlightV2_carlight.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; +} +// Memory allocation for Lustre_arrow_ctx +Lustre_arrow_ctx_type* Lustre_arrow_ctx_new_ctx(){ + + Lustre_arrow_ctx_type* ctx = (Lustre_arrow_ctx_type*)calloc(1, sizeof(Lustre_arrow_ctx_type)); + // ctx->client_data = cdata; + Lustre_arrow_ctx_reset(ctx); + return ctx; +} +// Step function(s) for Lustre_arrow_ctx +void Lustre_arrow_step(_boolean i1,_boolean i2,_boolean *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; +} +// Memory allocation for Lustre_arrow_2_ctx +Lustre_arrow_2_ctx_type* Lustre_arrow_2_ctx_new_ctx(){ + + Lustre_arrow_2_ctx_type* ctx = (Lustre_arrow_2_ctx_type*)calloc(1, sizeof(Lustre_arrow_2_ctx_type)); + // ctx->client_data = cdata; + Lustre_arrow_2_ctx_reset(ctx); + return 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_pre_ctx +void Lustre_pre_ctx_reset(Lustre_pre_ctx_type* ctx){ + int _i; + +} +// Memory allocation for Lustre_pre_ctx +Lustre_pre_ctx_type* Lustre_pre_ctx_new_ctx(){ + + Lustre_pre_ctx_type* ctx = (Lustre_pre_ctx_type*)calloc(1, sizeof(Lustre_pre_ctx_type)); + // ctx->client_data = cdata; + Lustre_pre_ctx_reset(ctx); + return ctx; +} +// Step function(s) for Lustre_pre_ctx +void Lustre_pre_get(_boolean *out,Lustre_pre_ctx_type* ctx){ + *out = ctx->_memory; + +} // End of Lustre_pre_get + +void Lustre_pre_set(_boolean 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; + +} +// Memory allocation for Lustre_pre_2_ctx +Lustre_pre_2_ctx_type* Lustre_pre_2_ctx_new_ctx(){ + + Lustre_pre_2_ctx_type* ctx = (Lustre_pre_2_ctx_type*)calloc(1, sizeof(Lustre_pre_2_ctx_type)); + // ctx->client_data = cdata; + Lustre_pre_2_ctx_reset(ctx); + return 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 carlightV2_carlight_ctx +void carlightV2_carlight_ctx_reset(carlightV2_carlight_ctx_type* ctx){ + int _i; + + carlightV2_front_montant_ctx_reset(&ctx->carlightV2_front_montant_ctx_tab[0]); + carlightV2_carlight_auto_ctx_reset(&ctx->carlightV2_carlight_auto_ctx_tab[0]); + Lustre_pre_ctx_reset(&ctx->Lustre_pre_ctx_tab[0]); +} +// Memory allocation for carlightV2_carlight_ctx +carlightV2_carlight_ctx_type* carlightV2_carlight_ctx_new_ctx(){ + + carlightV2_carlight_ctx_type* ctx = (carlightV2_carlight_ctx_type*)calloc(1, sizeof(carlightV2_carlight_ctx_type)); + // ctx->client_data = cdata; + carlightV2_carlight_ctx_reset(ctx); + return ctx; +} +// Step function(s) for carlightV2_carlight_ctx +void carlightV2_carlight_step(_integer switch_pos,_real intensity,_boolean *is_on,carlightV2_carlight_ctx_type* ctx){ _boolean _split_8; + _boolean _split_7; + _boolean _split_6; + _real _split_5; + _boolean _split_4; + _boolean _split_3; + _boolean _split_2; + _boolean _split_1; + _boolean fm_auto; + _boolean res_auto; + + _split_1 = switch_pos == carlightV2_AUTO; + carlightV2_front_montant_step(_split_1,&fm_auto,&ctx->carlightV2_front_montant_ctx_tab[0]); + Lustre_pre_get(&_split_6,&ctx->Lustre_pre_ctx_tab[0]); + switch (switch_pos){ + case carlightV2_AUTO: + _split_7 = _split_6; + _split_5 = intensity; + carlightV2_carlight_auto_step(_split_5,_split_7,&_split_8,&ctx->carlightV2_carlight_auto_ctx_tab[0]); + break; +} + _split_3 = intensity <= 70.0; + switch (switch_pos){ + case carlightV2_AUTO: + _split_4 = _split_3; + _split_2 = fm_auto; + if (_split_2 == _true) { + res_auto = _split_4; + } else { + res_auto = _split_8; + } + *is_on = res_auto; + break; + case carlightV2_OFF: + *is_on = _false; + break; + case carlightV2_ON: + *is_on = _true; + break; +} + Lustre_pre_set(*is_on,&ctx->Lustre_pre_ctx_tab[0]); + +} // End of carlightV2_carlight_step + +// Memory initialisation for carlightV2_carlight_auto_ctx +void carlightV2_carlight_auto_ctx_reset(carlightV2_carlight_auto_ctx_type* ctx){ + int _i; + + carlightV2_vrai_depuis_n_secondes_ctx_reset(&ctx->carlightV2_vrai_depuis_n_secondes_ctx_tab[0]); + carlightV2_vrai_depuis_n_secondes_ctx_reset(&ctx->carlightV2_vrai_depuis_n_secondes_ctx_tab[1]); +} +// Memory allocation for carlightV2_carlight_auto_ctx +carlightV2_carlight_auto_ctx_type* carlightV2_carlight_auto_ctx_new_ctx(){ + + carlightV2_carlight_auto_ctx_type* ctx = (carlightV2_carlight_auto_ctx_type*)calloc(1, sizeof(carlightV2_carlight_auto_ctx_type)); + // ctx->client_data = cdata; + carlightV2_carlight_auto_ctx_reset(ctx); + return ctx; +} +// Step function(s) for carlightV2_carlight_auto_ctx +void carlightV2_carlight_auto_step(_real intensity,_boolean pre_is_on,_boolean *res,carlightV2_carlight_auto_ctx_type* ctx){ _boolean _split_17; + _boolean _split_16; + _boolean _split_15; + _boolean _split_14; + _boolean _split_13; + _boolean _split_12; + _boolean _split_11; + _boolean _split_10; + _boolean _split_9; + + _split_14 = intensity < 60.0; + _split_13 = ! pre_is_on; + _split_15 = _split_13 & _split_14; + carlightV2_vrai_depuis_n_secondes_step(_split_15,2.0,&_split_16,&ctx->carlightV2_vrai_depuis_n_secondes_ctx_tab[0]); + if (_split_16 == _true) { + _split_17 = _true; + } else { + _split_17 = pre_is_on; + } + _split_9 = intensity > 70.0; + _split_10 = pre_is_on & _split_9; + carlightV2_vrai_depuis_n_secondes_step(_split_10,3.0,&_split_11,&ctx->carlightV2_vrai_depuis_n_secondes_ctx_tab[1]); + if (_split_11 == _true) { + _split_12 = _false; + } else { + _split_12 = pre_is_on; + } + if (pre_is_on == _true) { + *res = _split_12; + } else { + *res = _split_17; + } + +} // End of carlightV2_carlight_auto_step + +// Memory initialisation for carlightV2_front_montant_ctx +void carlightV2_front_montant_ctx_reset(carlightV2_front_montant_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]); +} +// Memory allocation for carlightV2_front_montant_ctx +carlightV2_front_montant_ctx_type* carlightV2_front_montant_ctx_new_ctx(){ + + carlightV2_front_montant_ctx_type* ctx = (carlightV2_front_montant_ctx_type*)calloc(1, sizeof(carlightV2_front_montant_ctx_type)); + // ctx->client_data = cdata; + carlightV2_front_montant_ctx_reset(ctx); + return ctx; +} +// Step function(s) for carlightV2_front_montant_ctx +void carlightV2_front_montant_step(_boolean x,_boolean *res,carlightV2_front_montant_ctx_type* ctx){ _boolean _split_20; + _boolean _split_19; + _boolean _split_18; + + Lustre_pre_get(&_split_18,&ctx->Lustre_pre_ctx_tab[0]); + _split_19 = ! _split_18; + _split_20 = x & _split_19; + Lustre_pre_set(x,&ctx->Lustre_pre_ctx_tab[0]); + Lustre_arrow_step(x,_split_20,res,&ctx->Lustre_arrow_ctx_tab[0]); + +} // End of carlightV2_front_montant_step + +// Step function(s) for carlightV2_max_ctx +void carlightV2_max_step(_real x,_real y,_real *res){ + _boolean _split_21; + + _split_21 = x > y; + if (_split_21 == _true) { + *res = x; + } else { + *res = y; + } + +} // End of carlightV2_max_step + +// Memory initialisation for carlightV2_vrai_depuis_n_secondes_ctx +void carlightV2_vrai_depuis_n_secondes_ctx_reset(carlightV2_vrai_depuis_n_secondes_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]); +} +// Memory allocation for carlightV2_vrai_depuis_n_secondes_ctx +carlightV2_vrai_depuis_n_secondes_ctx_type* carlightV2_vrai_depuis_n_secondes_ctx_new_ctx(){ + + carlightV2_vrai_depuis_n_secondes_ctx_type* ctx = (carlightV2_vrai_depuis_n_secondes_ctx_type*)calloc(1, sizeof(carlightV2_vrai_depuis_n_secondes_ctx_type)); + // ctx->client_data = cdata; + carlightV2_vrai_depuis_n_secondes_ctx_reset(ctx); + return ctx; +} +// Step function(s) for carlightV2_vrai_depuis_n_secondes_ctx +void carlightV2_vrai_depuis_n_secondes_step(_boolean signal,_real n,_boolean *res,carlightV2_vrai_depuis_n_secondes_ctx_type* ctx){ _real _split_26; + _real _split_25; + _real _split_24; + _real _split_23; + _boolean _split_22; + _real tempo; + + _split_22 = ! signal; + Lustre_pre_2_get(&_split_23,&ctx->Lustre_pre_2_ctx_tab[0]); + _split_24 = _split_23 - 0.5; + carlightV2_max_step(0.0,_split_24,&_split_25); + if (_split_22 == _true) { + _split_26 = n; + } else { + _split_26 = _split_25; + } + Lustre_arrow_2_step(n,_split_26,&tempo,&ctx->Lustre_arrow_2_ctx_tab[0]); + Lustre_pre_2_set(tempo,&ctx->Lustre_pre_2_ctx_tab[0]); + *res = tempo == 0.0; + +} // End of carlightV2_vrai_depuis_n_secondes_step + diff --git a/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.h b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.h new file mode 100644 index 00000000..c56c8fa1 --- /dev/null +++ b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight.h @@ -0,0 +1,52 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 carlightV2.lus -n carlight --to-c */ +/* on vanoise the 08/05/2019 at 22:54:09 */ + +#include <stdlib.h> +#include <string.h> + +#include "lustre_types.h" +#include "lustre_consts.h" + +#ifndef _carlightV2_carlight_H_FILE +#define _carlightV2_carlight_H_FILE +void Lustre_arrow_ctx_reset(Lustre_arrow_ctx_type* ctx); +Lustre_arrow_ctx_type* Lustre_arrow_ctx_new_ctx(); +void Lustre_arrow_step(_boolean ,_boolean ,_boolean *,Lustre_arrow_ctx_type*); + +void Lustre_arrow_2_ctx_reset(Lustre_arrow_2_ctx_type* ctx); +Lustre_arrow_2_ctx_type* Lustre_arrow_2_ctx_new_ctx(); +void Lustre_arrow_2_step(_real ,_real ,_real *,Lustre_arrow_2_ctx_type*); + +void Lustre_pre_ctx_reset(Lustre_pre_ctx_type* ctx); +Lustre_pre_ctx_type* Lustre_pre_ctx_new_ctx(); +void Lustre_pre_get(_boolean *,Lustre_pre_ctx_type*); + +void Lustre_pre_set(_boolean ,Lustre_pre_ctx_type*); + +void Lustre_pre_2_ctx_reset(Lustre_pre_2_ctx_type* ctx); +Lustre_pre_2_ctx_type* Lustre_pre_2_ctx_new_ctx(); +void Lustre_pre_2_get(_real *,Lustre_pre_2_ctx_type*); + +void Lustre_pre_2_set(_real ,Lustre_pre_2_ctx_type*); + +void carlightV2_carlight_ctx_reset(carlightV2_carlight_ctx_type* ctx); +carlightV2_carlight_ctx_type* carlightV2_carlight_ctx_new_ctx(); +void carlightV2_carlight_step(_integer ,_real ,_boolean *,carlightV2_carlight_ctx_type*); + +void carlightV2_carlight_auto_ctx_reset(carlightV2_carlight_auto_ctx_type* ctx); +carlightV2_carlight_auto_ctx_type* carlightV2_carlight_auto_ctx_new_ctx(); +void carlightV2_carlight_auto_step(_real ,_boolean ,_boolean *,carlightV2_carlight_auto_ctx_type*); + +void carlightV2_front_montant_ctx_reset(carlightV2_front_montant_ctx_type* ctx); +carlightV2_front_montant_ctx_type* carlightV2_front_montant_ctx_new_ctx(); +void carlightV2_front_montant_step(_boolean ,_boolean *,carlightV2_front_montant_ctx_type*); + +void carlightV2_max_step(_real ,_real ,_real *); + +void carlightV2_vrai_depuis_n_secondes_ctx_reset(carlightV2_vrai_depuis_n_secondes_ctx_type* ctx); +carlightV2_vrai_depuis_n_secondes_ctx_type* carlightV2_vrai_depuis_n_secondes_ctx_new_ctx(); +void carlightV2_vrai_depuis_n_secondes_step(_boolean ,_real ,_boolean *,carlightV2_vrai_depuis_n_secondes_ctx_type*); + +///////////////////////////////////////////////// +#endif diff --git a/test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c new file mode 100644 index 00000000..a9b4417a --- /dev/null +++ b/test/monniaux/lustrev6-carlightV2/carlightV2_carlight_loop.c @@ -0,0 +1,62 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 carlightV2.lus -n carlight --to-c */ +/* on vanoise the 08/05/2019 at 22:54:09 */ + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include "carlightV2_carlight.h" +#include "../clock.h" +#include "../dm_random.c" + +/* MACROS DEFINITIONS ****************/ +#ifndef TT +#define TT "1" +#endif +#ifndef FF +#define FF "0" +#endif +#ifndef BB +#define BB "bottom" +#endif +#ifdef CKCHECK +/* set this macro for testing output clocks */ +#endif + +/* Standard Input procedures **************/ +_boolean _get_bool(char* n){ + return dm_random_uint32() & 1; +} +_integer _get_int(char* n){ + return (_integer) (dm_random_uint32() % 21) - 10; +} +_real _get_real(char* n){ + return ((_integer) (dm_random_uint32() % 2000001) - 1000000)*1E-6; +} + +/* Main procedure *************************/ +int main(){ + int _s = 0; + _integer switch_pos; + _real intensity; + _boolean is_on; + carlightV2_carlight_ctx_type* ctx = carlightV2_carlight_ctx_new_ctx(NULL); + + /* Main loop */ + clock_prepare(); + clock_start(); + + for(int count=0; count<1000; count++){ + ++_s; + switch_pos = _get_int("switch_pos"); + intensity = _get_real("intensity"); + carlightV2_carlight_step(switch_pos,intensity,&is_on,ctx); + // printf("%d %f #outs %d\n",switch_pos,intensity,is_on); + // printf("%d\n",is_on); + } + + clock_stop(); + print_total_clock(); + + return 0; +} diff --git a/test/monniaux/lustrev6-carlightV2/lustre_consts.c b/test/monniaux/lustrev6-carlightV2/lustre_consts.c new file mode 100644 index 00000000..e1a77c9e --- /dev/null +++ b/test/monniaux/lustrev6-carlightV2/lustre_consts.c @@ -0,0 +1,4 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 carlightV2.lus -n carlight --to-c */ +/* on vanoise the 08/05/2019 at 22:54:09 */ +#include "lustre_consts.h"
\ No newline at end of file diff --git a/test/monniaux/lustrev6-carlightV2/lustre_consts.h b/test/monniaux/lustrev6-carlightV2/lustre_consts.h new file mode 100644 index 00000000..9d651d25 --- /dev/null +++ b/test/monniaux/lustrev6-carlightV2/lustre_consts.h @@ -0,0 +1,9 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 carlightV2.lus -n carlight --to-c */ +/* on vanoise the 08/05/2019 at 22:54:09 */ + +// Constant definitions +#define carlightV2_AUTO 2 +#define carlightV2_OFF 1 +#define carlightV2_ON 0 +#define carlightV2_period 0.5 diff --git a/test/monniaux/lustrev6-carlightV2/lustre_types.h b/test/monniaux/lustrev6-carlightV2/lustre_types.h new file mode 100644 index 00000000..e1cfb463 --- /dev/null +++ b/test/monniaux/lustrev6-carlightV2/lustre_types.h @@ -0,0 +1,75 @@ +/* This file was generated by lv6 version master.737 (2727a7744111c84f7984634d2bd3ad6f7c6c7ff9). */ +/* lv6 carlightV2.lus -n carlight --to-c */ +/* on vanoise the 08/05/2019 at 22:54:09 */ + +#ifndef _SOC2C_PREDEF_TYPES +#define _SOC2C_PREDEF_TYPES +typedef int _boolean; +typedef int _integer; +typedef char* _string; +typedef double _real; +typedef double _double; +typedef float _float; +#define _false 0 +#define _true 1 +#endif +// end of _SOC2C_PREDEF_TYPES +// User typedef +#ifndef _carlightV2_carlight_TYPES +#define _carlightV2_carlight_TYPES +typedef _integer carlightV2_SwitchMode; +#endif // enf of _carlightV2_carlight_TYPES +// Memoryless soc ctx typedef +// Memoryfull soc ctx typedef +/* Lustre_pre_ctx */ +typedef struct { + /*Memory cell*/ + _boolean _memory ; +} Lustre_pre_ctx_type; + +/* Lustre_arrow_ctx */ +typedef struct { + /*Memory cell*/ + _boolean _memory ; +} Lustre_arrow_ctx_type; + +/* carlightV2_front_montant_ctx */ +typedef struct { + /*INSTANCES*/ + Lustre_pre_ctx_type Lustre_pre_ctx_tab[1]; + Lustre_arrow_ctx_type Lustre_arrow_ctx_tab[1]; +} carlightV2_front_montant_ctx_type; + +/* Lustre_pre_2_ctx */ +typedef struct { + /*Memory cell*/ + _real _memory ; +} Lustre_pre_2_ctx_type; + +/* Lustre_arrow_2_ctx */ +typedef struct { + /*Memory cell*/ + _boolean _memory ; +} Lustre_arrow_2_ctx_type; + +/* carlightV2_vrai_depuis_n_secondes_ctx */ +typedef struct { + /*INSTANCES*/ + Lustre_pre_2_ctx_type Lustre_pre_2_ctx_tab[1]; + Lustre_arrow_2_ctx_type Lustre_arrow_2_ctx_tab[1]; +} carlightV2_vrai_depuis_n_secondes_ctx_type; + +/* carlightV2_carlight_auto_ctx */ +typedef struct { + /*INSTANCES*/ + carlightV2_vrai_depuis_n_secondes_ctx_type carlightV2_vrai_depuis_n_secondes_ctx_tab[2]; +} carlightV2_carlight_auto_ctx_type; + +/* carlightV2_carlight_ctx */ +typedef struct { + /*INSTANCES*/ + carlightV2_front_montant_ctx_type carlightV2_front_montant_ctx_tab[1]; + carlightV2_carlight_auto_ctx_type carlightV2_carlight_auto_ctx_tab[1]; + Lustre_pre_ctx_type Lustre_pre_ctx_tab[1]; +} carlightV2_carlight_ctx_type; + |