Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VHDL Assert - actions other than report

Tags:

vhdl

I was looking to add an error counter to a VHDL assert operation in existing code. Basically, I have code that looks like this:

assert data = good_data
  report "Bad data" 
  severity error; 

And I would like to add something like this to get triggered when the assertion occurs:

errors <= errors + 1;

Now I know I can achieve this by changing the assert to an if statement and then embedding the report statement and my error count increment withing the if statement. But I'm wondering if there is anyway to get more functionality out of the assert statement that is already there?

like image 678
Barry Moss Avatar asked Oct 23 '25 13:10

Barry Moss


1 Answers

You could use the VUnit VHDL testing framework https://github.com/LarsAsplund/vunit which has check and check_equal procedures wrapping assert and counting the number of errors. The default behavior is to halt on first error such that it can be easily debugged.

I also believe the OSVVM AlertLogPkg.vhd has a similar feature. VUnit ships with OSVVM re-distributed so you could use it from there as well.

If you want to roll your own just make an procedure assert(cond : value; msg : string := "") that increments a shared counter variable in the same package.

like image 167
kraigher Avatar answered Oct 25 '25 15:10

kraigher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!