I'm trying to make a state machine that is synthesizable into a hardware description through Vitis HLS. I'm getting the error ERROR: [HLS 214-134] in function 'kernel1(char*, int)': Pointer to pointer is not supported for variable ''. This is happening in:
Transition transitions[] = {a, b};, where I'm trying to create an array ofTransitionstructstransitions_occurred += testTransition(&transitions[i], stream, &stream_index);, where I'm trying to call a function with members of the previous array
I don't get why that specific error pops up in these situations. I get no error when trying to do it 'manually' (without the array), like in:
transitions_occurred += testTransition(&a, stream, &stream_index);
transitions_occurred += testTransition(&b, stream, &stream_index);
Here's the full code:
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
typedef struct {
bool active;
} State;
typedef struct {
char token;
State *current;
State *next;
int stream_increment;
} Transition;
bool testTransition(Transition *t, char* stream, int *stream_index)
{
if (!t->current->active)
return false;
if (t->token == stream[*stream_index])
{
t->next->active = true;
*stream_index += t->stream_increment;
return true;
}
return false;
}
#define STATE_NO 3
#define START_STATE 0
#define END_STATE 2
bool kernel1(char stream[], int stream_size)
{
State current[STATE_NO] = {0};
State next[STATE_NO] = {0};
current[START_STATE].active = true;
Transition a = {'a', ¤t[0], &next[1], 1};
Transition b = {'b', ¤t[1], &next[2], 1};
Transition transitions[] = {a, b};
size_t transition_no = sizeof(transitions) / sizeof(Transition);
int stream_index = 0;
int transitions_occurred;
do {
transitions_occurred = 0;
for (int i = 0; i < transition_no; i++)
transitions_occurred += testTransition(&transitions[i], stream, &stream_index);
memcpy(current, next, STATE_NO * sizeof(State));
memset(next, 0, STATE_NO * sizeof(State));
} while (stream_index != stream_size && transitions_occurred);
return current[END_STATE].active;
}
-std=c99/11/14/17in theCFLAGSand the error persists