From 3b2c92a9c87fe49682500a21ae23736b7cea1116 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Thu, 23 Dec 2021 01:59:13 +0000 Subject: [PATCH] Add CRTL templates Forgot to add them in the previous commit. --- src/openpower/decoder/test/crtl_template.c | 41 ++++++++++++++++++++++ src/openpower/decoder/test/crtl_template.h | 17 +++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/openpower/decoder/test/crtl_template.c create mode 100644 src/openpower/decoder/test/crtl_template.h diff --git a/src/openpower/decoder/test/crtl_template.c b/src/openpower/decoder/test/crtl_template.c new file mode 100644 index 00000000..e10e25e4 --- /dev/null +++ b/src/openpower/decoder/test/crtl_template.c @@ -0,0 +1,41 @@ +#include +#include "common.h" + +state_t slots[%d]; +uint64_t pending[%d]; +uint64_t pending_count; + +void add_pending(uint64_t index) +{ + pending[pending_count++] = index; +} + +void clear_pending(void) +{ + pending_count = 0; +} + +uint64_t capture(uint64_t index) +{ + if (slots[index].curr == slots[index].next) + return 0; + + slots[index].curr = slots[index].next; + return 1; +} + +uint64_t get_curr(uint64_t index) +{ + return slots[index].curr; +} + +uint64_t get_next(uint64_t index) +{ + return slots[index].next; +} + +void set(uint64_t index, uint64_t value) +{ + slots[index].next = value; + add_pending(index); +} diff --git a/src/openpower/decoder/test/crtl_template.h b/src/openpower/decoder/test/crtl_template.h new file mode 100644 index 00000000..e714d268 --- /dev/null +++ b/src/openpower/decoder/test/crtl_template.h @@ -0,0 +1,17 @@ +typedef struct state_t +{ + uint64_t curr; + uint64_t next; +} state_t; + +extern state_t slots[%d]; +extern uint64_t pending[%d]; +extern uint64_t pending_count; + +void add_pending(uint64_t index); +void clear_pending(void); + +uint64_t capture(uint64_t index); +uint64_t get_curr(uint64_t index); +uint64_t get_next(uint64_t index); +void set(uint64_t index, uint64_t value); -- 2.30.2