Is it possible to set the name of the Top Function in the Project Settings based on a define? I have an IP which uses different parameters and a different Top Function name based on a define, but I don't want to change the name of the Top Function in the Project Settings every time when I change the define. I want to change the Top Function name based on a define because the name of the generated IP block is the same as the name of the Top Function.
For example I have these defines:
#ifdef CONV1
#define INPUT_LENGTH 32
#define IN_CHAN 2
#define OUT_CHAN 8
#define CONV_FUNC conv_8x2x5x5
#else
#ifdef CONV2
#define INPUT_LENGTH 28
#define IN_CHAN 8
#define OUT_CHAN 16
#define CONV_FUNC conv_16x8x5x5
#else
#define INPUT_LENGTH 24
#define IN_CHAN 16
#define OUT_CHAN 20
#define CONV_FUNC conv_20x16x5x5
#endif
#endif
And the Top Function is defined as:
void CONV_FUNC (...) {
...
}
I define for example CONV1, the name of the Top Function becomes conv_8x2x5x5 and thus the name of the generated IP block becomes conv_8x2x5x5. How can I make the Synthesis automatically pick the correct Top Function name?
I'm not sure I understood the details of the question, but you can use the C preprocessor to achieve what you want (and even get rid of the
CONV_FUNCmacro):Which will print:
Search for "token concatenation" for more information.