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/convertible_main_loop.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/convertible_main_loop.c')
-rw-r--r-- | test/monniaux/lustrev6-convertible/convertible_main_loop.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/test/monniaux/lustrev6-convertible/convertible_main_loop.c b/test/monniaux/lustrev6-convertible/convertible_main_loop.c new file mode 100644 index 00000000..46e94cd1 --- /dev/null +++ b/test/monniaux/lustrev6-convertible/convertible_main_loop.c @@ -0,0 +1,86 @@ +/* This file was generated by lus2lic version master.668 (35901e970a0c377cc36d6437dcbc61beb8001b54). */ +/* lus2lic -2c convertible.lus -n main */ +/* on ovaz the 27/10/2016 at 11:39:07 */ + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <stdint.h> +#include "convertible_main.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; +} +/* Output procedures **********************/ +void convertible_main_O_n(void* cdata, _integer _V) { +} +/* Main procedure *************************/ +int main(){ + int _s = 0; + _boolean Start; + _boolean Parked; + _boolean Rot; + _boolean Tic; + _boolean OnOff; + _boolean Done; + _real Distance; + _boolean Danger; + _boolean Locked; + _real Speed; + _real Hood_Speed; + convertible_main_ctx_type* ctx = convertible_main_ctx_new_ctx(NULL); + +#if 0 + printf("#inputs \"Start\":bool \"Parked\":bool \"Rot\":bool \"Tic\":bool \"OnOff\":bool \"Done\":bool \"Distance\":real\n"); + printf("#outputs \"Danger\":bool \"Locked\":bool \"Speed\":real \"Hood_Speed\":real\n"); +#endif + + /* Main loop */ + clock_prepare(); + clock_start(); + + for(int count=0; count<1000; count++){ + ++_s; + Start = _get_bool("Start"); + Parked = _get_bool("Parked"); + Rot = _get_bool("Rot"); + Tic = _get_bool("Tic"); + OnOff = _get_bool("OnOff"); + Done = _get_bool("Done"); + Distance = _get_real("Distance"); + convertible_main_step(Start,Parked,Rot,Tic,OnOff,Done,Distance,&Danger,&Locked,&Speed,&Hood_Speed,ctx); + // printf("%d %d %d %d %d %d %f #outs %d %d %f %f\n",Start,Parked,Rot,Tic,OnOff,Done,Distance,Danger,Locked,Speed,Hood_Speed); + // printf("%d %d %f %f\n",Danger,Locked,Speed,Hood_Speed); + } + + clock_stop(); + print_total_clock(); + + return 0; + +} |