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/lustrev4_lv4_heater_control/heater_control_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/lustrev4_lv4_heater_control/heater_control_loop.c')
-rw-r--r-- | test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c b/test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c new file mode 100644 index 00000000..06bad418 --- /dev/null +++ b/test/monniaux/lustrev4_lv4_heater_control/heater_control_loop.c @@ -0,0 +1,64 @@ +/******** +* ec2c version 0.67 +* c main file generated for node : heater_control +* to be used with : heater_control.c +* and : heater_control.h +* context method = HEAP +* ext call method = PROCEDURES +********/ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include "../clock.h" +#include "../dm_random.c" +#include "heater_control.h" + +/* Print a promt ? ************************/ +static int ISATTY; +/* MACROS DEFINITIONS ****************/ +#ifndef TT +#define TT "true" +#endif +#ifndef FF +#define FF "false" +#endif +#ifndef BB +#define BB "bottom" +#endif +#ifdef CKCHECK +/* set this macro for testing output clocks */ +#endif + +/* Standard Input procedures **************/ +_real _get_real(char* n){ + return (dm_random_uint32()%70000U) * 1E-3 -20.0; +} +/* Standard Output procedures **************/ +void _put_bool(char* n, _boolean b){ + printf("%s: %d\n", n, b); +} +/* Output procedures **********************/ +void heater_control_O_Heat_on(void* cdata, _boolean _V) { + // _put_bool("Heat_on", _V); +} +/* Main procedure *************************/ +int main(){ + + /* Context allocation */ + struct heater_control_ctx* ctx = heater_control_new_ctx(NULL); + /* Main loop */ + clock_prepare(); + clock_start(); + heater_control_reset(ctx); + for(int count=0; count<1000; count++){ + heater_control_I_T(ctx, _get_real("T")); + heater_control_I_T1(ctx, _get_real("T1")); + heater_control_I_T2(ctx, _get_real("T2")); + heater_control_I_T3(ctx, _get_real("T3")); + heater_control_step(ctx); + + } + clock_stop(); + print_total_clock(); + return 0; +} |