cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
567 Views
Registered: ‎05-21-2018

[HLS] How to create assertions for Synthesis

Jump to solution

Hi all, 

I was wondering how can I create an assertion for synthesis in HLS. So far I've been able to create them for csim, however it's ignored in synthesis.

I guess is based in the fact that you should run your csim prior synthesizing, but I would like to know if there is any option to imply these checks for synthesis as well. In my project, I generate the HLS IP Core based on scripting, and some internal numerical approximations are only valid for specific values of #defines in a header file. I would like to check if those have been changed without requiring a new long simulation.

This is how I'm implementing them so far for CSIM:

assert (INP_ROWS==1072 && INP_COLS==1928); // IMP_ROWS, INP_COLS are #defines in .h

Any ideas? If so, is there any way to throw an error message on them?

Thanks in advance!

 

PS: I'm, using Vivado HLS 2019.1.

0 Kudos
Reply
1 Solution

Accepted Solutions
Instructor
Instructor
500 Views
Registered: ‎10-23-2018

@domitilo 

If you are only trying to validate constant values from a configuration header file, then yes... you may be in luck... using the preprocessor you can test the values of the defines, then use #error to abort the compilation/synthesis.

e.g.

#if INP_ROWS!=1072

#error "some message"

#endif

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

View solution in original post

4 Replies
Instructor
Instructor
513 Views
Registered: ‎10-23-2018

@domitilo 

In the synthesized hardware, you would not 'throw an error' per se... but if you want to generate some monitor/debug in the hardware itself, you could generate an 'output'  that is triggered when a condition is true or false... giving you the ability to see what is happening on your synthesized hardware.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.  

0 Kudos
Reply
Visitor
Visitor
511 Views
Registered: ‎05-21-2018
Hi,
Thanks for answering.
Sorry, probably I didn't explain myself properly, what I meant is if there is any way to make these check on synthesis time, but not to be implemented in hardware.
Just the way that if INP_ROWS != 1072 the synthesis tool throws an error and stop synthesis, as it does the simulation tool when doing the assert.
I would like to implement these kind of checks to avoid misconfigurations due to wrong values in .h file.

Thanks in advance and sorry for my first explanation.
0 Kudos
Reply
Instructor
Instructor
501 Views
Registered: ‎10-23-2018

@domitilo 

If you are only trying to validate constant values from a configuration header file, then yes... you may be in luck... using the preprocessor you can test the values of the defines, then use #error to abort the compilation/synthesis.

e.g.

#if INP_ROWS!=1072

#error "some message"

#endif

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

View solution in original post

Visitor
Visitor
435 Views
Registered: ‎05-21-2018
Thanks!, that's what I was looking for, it works perfectly.
0 Kudos
Reply