tweak waters data dependencies

This commit is contained in:
Alwin Berger 2025-02-19 15:45:35 +01:00
parent 4bb52ce75f
commit 76e7014eee

View File

@ -29,7 +29,7 @@
#include <queue.h> #include <queue.h>
#include <stdio.h> #include <stdio.h>
#define LOCAL_WCET_MULT 15 // Multiplier to increase all waiting periods to make the schedule more tight an force preemptions #define LOCAL_WCET_MULT 14 // Multiplier to increase all waiting periods to make the schedule more tight an force preemptions
#define NUM_TASKS 10 #define NUM_TASKS 10
#include "fuzzhelper.c" #include "fuzzhelper.c"
@ -399,9 +399,9 @@ static void prvTaskC11( void * pvParameters ) {
// Output: g(x) = x % 8 // Output: g(x) = x % 8
// WC Input: x = 629760 // WC Input: x = 629760
uint32_t x = INPUT_LONG_NEXT; uint32_t x = INPUT_LONG_NEXT;
xTaskNotify(xTaskC12, DEBUG_VAL(x % 8 + 1, 1), eSetValueWithOverwrite);
volatile int torun = (x>>8) & 0x0fff; volatile int torun = (x>>8) & 0x0fff;
WCET_CLAMP(torun*LOCAL_WCET_MULT, 500*LOCAL_WCET_MULT, 2460*LOCAL_WCET_MULT, TASK_579_MESSAGE) WCET_CLAMP(torun*LOCAL_WCET_MULT, 500*LOCAL_WCET_MULT, 2460*LOCAL_WCET_MULT, TASK_579_MESSAGE)
xTaskNotify(xTaskC12, DEBUG_VAL(x % 8, 0), eSetValueWithOverwrite);
// --------------------------------------------- // ---------------------------------------------
trigger_job_done(); trigger_job_done();
xTaskDelayUntil( &xLastWakeTime, xFrequency );} xTaskDelayUntil( &xLastWakeTime, xFrequency );}
@ -419,7 +419,8 @@ static void prvTaskC12( void * pvParameters ) {
// Output: g(x) = x % 8 == y // Output: g(x) = x % 8 == y
// WC Input: x = 12000, y = 0 // WC Input: x = 12000, y = 0
uint16_t x = INPUT_SHORT_NEXT; uint16_t x = INPUT_SHORT_NEXT;
int y = ulTaskNotifyTake(pdTRUE, 0); int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY)-1;
xTaskNotify(xTaskC13, DEBUG_VAL((x % 8 == y) + 1, 2), eSetValueWithOverwrite);
volatile int torun = 0; volatile int torun = 0;
if (x % 8 == y) { if (x % 8 == y) {
torun = 40000 + x; torun = 40000 + x;
@ -427,7 +428,6 @@ static void prvTaskC12( void * pvParameters ) {
torun = CLAMP(x, 0, 40000); torun = CLAMP(x, 0, 40000);
} }
WCET_CLAMP(torun*LOCAL_WCET_MULT, 0, 51485*LOCAL_WCET_MULT, TASK_1009_MESSAGE) WCET_CLAMP(torun*LOCAL_WCET_MULT, 0, 51485*LOCAL_WCET_MULT, TASK_1009_MESSAGE)
xTaskNotify(xTaskC13, DEBUG_VAL(x % 8 == y, 1), eSetValueWithOverwrite);
// --------------------------------------------- // ---------------------------------------------
trigger_job_done(); trigger_job_done();
xTaskDelayUntil( &xLastWakeTime, xFrequency );} xTaskDelayUntil( &xLastWakeTime, xFrequency );}
@ -447,18 +447,25 @@ static void prvTaskC13( void * pvParameters ) {
// Output: g(x) = y && rng(x) // Output: g(x) = y && rng(x)
// longmax - shortmax: 39505 // longmax - shortmax: 39505
// most likely long case, which causes a short case in next task // most likely long case, which causes a short case in next task
// WC Input: x = , y = 1 // WC Input: x = 65535 , y = 0 for "long" run
// WC Input: x = 65535 , y = 1 for "short" run
// globally, short runs consume more time in subsequent jobs
volatile uint32_t x = INPUT_SHORT_NEXT; volatile uint32_t x = INPUT_SHORT_NEXT;
int y = ulTaskNotifyTake(pdTRUE, 0); int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY)-1;
volatile int do_short_run = (y + ((x%100)<=5)) == 1; // XOR volatile int do_short_run = (y + ((x%100)<=5)) == 1; // XOR
xTaskNotify(xTaskC14, DEBUG_VAL(do_short_run+1, 2), eSetValueWithOverwrite);
int torun = 0; int torun = 0;
if (do_short_run > 0) { if (do_short_run > 0) {
torun = 40000 + x; torun = 40000 + x;
} else { } else {
torun = 80000 + x; torun = 80000 + x;
} }
#ifdef INSERT_WC
WCET_CLAMP(torun*LOCAL_WCET_MULT, 0, 145040*LOCAL_WCET_MULT, TASK_1129_MESSAGE) WCET_CLAMP(torun*LOCAL_WCET_MULT, 0, 145040*LOCAL_WCET_MULT, TASK_1129_MESSAGE)
xTaskNotify(xTaskC14, do_short_run, eSetValueWithOverwrite); #else
// to reach the global wcrt, take the shorter case
WCET_CLAMP(torun*LOCAL_WCET_MULT, 0, (40000+0xFFFF)*LOCAL_WCET_MULT, TASK_1129_MESSAGE)
#endif
// --------------------------------------------- // ---------------------------------------------
trigger_job_done(); trigger_job_done();
xTaskDelayUntil( &xLastWakeTime, xFrequency );} xTaskDelayUntil( &xLastWakeTime, xFrequency );}
@ -475,7 +482,7 @@ static void prvTaskC14( void * pvParameters ) {
// Exectime: f(x,y) = if y ? c1+2*x : c2-x // Exectime: f(x,y) = if y ? c1+2*x : c2-x
// longmax - shortmax: 76955 // longmax - shortmax: 76955
volatile uint32_t x = INPUT_SHORT_NEXT; volatile uint32_t x = INPUT_SHORT_NEXT;
int y = ulTaskNotifyTake(pdTRUE, 0); int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY)-1;
volatile int torun = 0; volatile int torun = 0;
if (y) { if (y) {
torun = x*3; torun = x*3;