-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ill-formed initializer issue #14
Comments
Hi, the first issue you mention is actually a parsing issue with CompCert, it just doesn't allow empty initialiser lists. Instead the following will actually parse and compile with CompCert: #define NUM_TAPS 4
void fir ( int input, int *output, int taps [NUM_TAPS] ) {
static int delay_line [NUM_TAPS] = {0};
int result = 0;
for ( int i = NUM_TAPS -1 ; i > 0 ; i--) {
delay_line[i] = delay_line[i - 1];
}
delay_line[0] = input;
for ( int i = 0 ; i < NUM_TAPS ; i ++ ) {
result += delay_line[i] * taps[i];
}
*output = result;
} Finally though, unfortunavely Vericert doesn't support a large subset of C yet, so the designs that you can compile at the moment don't really look like typical HLS designs as you have written here. The below function will at least compile and kind of do what you want: #define NUM_TAPS 4
int main ( int input ) {
int taps [NUM_TAPS] = {1, 2, 3, 4};
int delay_line [NUM_TAPS] = {0};
int result = 0;
for ( int i = NUM_TAPS -1 ; i > 0 ; i--) {
delay_line[i] = delay_line[i - 1];
}
delay_line[0] = input;
for ( int i = 0 ; i < NUM_TAPS ; i ++ ) {
result += delay_line[i] * taps[i];
}
return result;
} In general though, the things that you are using which are not supported in Vericert but used all the time in HLS are (which actually incidentally all have to do with the simplistic memory handling in Vericert:
Thanks for trying out Vericert though! I'm happy you managed to compile it in the first place. I hope this helps, and let me know if you have any thoughts. |
But I will admit, without static the second design I posted does not implement an FIR filter. |
Thanks a lot for the detailed reply! |
Howdy,
I'm trying to generate run a 4 tap FIR filter and I'm getting the error message shown below
Would appreciate any help to find a potential solution.
command:
./bin/vericert fir_4tap.c -o fir_4tap.o
error message
fir_4tap.c:5:31: syntax error after '{' and before '}'.
Ill-formed initializer.
At this point, an optional designation, followed with an initializer, is expected.
Fatal error; compilation aborted.
1 error detected.
code
The FIR filter I'm trying to implement is described below (example taken from the Parallel Programming for FPGAs' book)
#define NUM_TAPS 4
void fir ( int input, int *output, int taps [NUM_TAPS] ) {
static int delay_line [NUM_TAPS] = {};
int result = 0;
for ( int i = NUM_TAPS -1 ; i > 0 ; i--) {
delay_line[i] = delay_line[i - 1];
}
delay_line[0] = input;
for ( int i = 0 ; i < NUM_TAPS ; i ++ ) {
result += delay_line[i] * taps[i];
}
*output = result;
}
The text was updated successfully, but these errors were encountered: