diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-05-13 11:57:45 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-05-13 11:57:45 +0200 |
commit | 3db72104ad5664ed320253a342e1b26ad2f7da28 (patch) | |
tree | 7d1424c3b66d6b89a090f389ec5de4f73f0a9f3b /test/monniaux/heptagon_radio_transmitter/_main.c | |
parent | b1b7a68222ada09b8dfaf9a5dbe2306b5fc44684 (diff) | |
download | compcert-kvx-3db72104ad5664ed320253a342e1b26ad2f7da28.tar.gz compcert-kvx-3db72104ad5664ed320253a342e1b26ad2f7da28.zip |
new example + moved random number generator to common files
Diffstat (limited to 'test/monniaux/heptagon_radio_transmitter/_main.c')
-rw-r--r-- | test/monniaux/heptagon_radio_transmitter/_main.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/monniaux/heptagon_radio_transmitter/_main.c b/test/monniaux/heptagon_radio_transmitter/_main.c new file mode 100644 index 00000000..707c921a --- /dev/null +++ b/test/monniaux/heptagon_radio_transmitter/_main.c @@ -0,0 +1,66 @@ +/* --- Generated the 13/5/2019 at 10:21 --- */ +/* --- heptagon compiler, version 1.05.00 (compiled mon. may. 13 10:18:8 CET 2019) --- */ +/* --- Command line: /local/STATOR/packages/opam-root/4.07.1/bin/heptc -target c -hepts -s main -target ctrln radiotrans.ept --- */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "_main.h" +#include "../dm_random.c" + +static inline int get_bool(void) { + return dm_random_uint32() & 1; +} + +Radiotrans__main_mem mem; +int main(int argc, char** argv) { + int step_c; + int step_max; + int enter_tx; + int enter_rx; + int exit_rx; + int calibrate; + int sleep; + int wake_up; + int irq_tx_done; + int irq_on_packet; + int irq_end_of_packet; + int irq_end_of_calibration; + int irq_fifo_threshold; + int adc_on; + int adc_off; + Radiotrans__main_out _res; + step_c = 0; + step_max = 1000; + if ((argc==2)) { + step_max = atoi(argv[1]); + }; + Radiotrans__main_reset(&mem); + while ((!(step_max)||(step_c<step_max))) { + step_c = (step_c+1); + + enter_tx = get_bool(); + enter_rx = get_bool(); + exit_rx = get_bool(); + calibrate = get_bool(); + sleep = get_bool(); + wake_up = get_bool(); + irq_tx_done = get_bool(); + irq_on_packet = get_bool(); + irq_end_of_packet = get_bool(); + irq_end_of_calibration = get_bool(); + irq_fifo_threshold = get_bool(); + adc_on = get_bool(); + adc_off = get_bool(); + + Radiotrans__main_step(enter_tx, enter_rx, exit_rx, calibrate, sleep, + wake_up, irq_tx_done, irq_on_packet, + irq_end_of_packet, irq_end_of_calibration, + irq_fifo_threshold, adc_on, adc_off, &_res, &mem); + printf("%d\n", _res.a_on); + printf("%d\n", _res.red); + fflush(stdout); + }; + return 0; +} + |