-
Notifications
You must be signed in to change notification settings - Fork 14
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
Potential pitfall for an assert_equal(std_ulogic) using std_match #2
Comments
I see that 'L' and '0' also match (and '1' and 'H')... I'm not sure Cheers, On 5 August 2011 21:22, cmarqu
|
Ha, hadn't even noticed that... |
On 9 August 2011 20:43, cmarqu
I think you're right, yes.
Maybe we could have assert_nearly_equals() :) Martin |
assert_nearly_equals() - weeeeell... for reals and physical types, I have an "err" parameter that defines the allowed plusminus error margin (and for completeness's sake, should have err_min and err_max (or better named err_neg/err_pos?)). |
On 9 August 2011 21:46, cmarqu
That thought had also crossed my mind when I write it :) Hmmm. I don't suppose you can do this can you?:
to get a default "even-sided" comparison? You have to have two functions? |
I don't know offhand, but even if it was possible, it would feel awkward from a user's point of view - if you saw a function call like compare(act => 1.1, exp => 1.0, err_neg => 0.2);, you would expect the positive error to be 0.0, not 0.2, right? Oh, and actually, would you say "err_neg => -0.2, err_pos => 0.2" or "err_neg => 0.2, err_pos => 0.2" if you wanted to allow an error of 0.2 on either side? Makes sense to get the naming just right - assuming that is even possible. :) |
On 9 August 2011 22:40, cmarqu
Yes, I wasn't thinking of using named parameters (when there's only 3
And you (well, I :) also (sometimes) want errors specified in |
Percentages and LSBs, good point - I hope we will have all these procedures/functions (maybe even stuff like function wrappers around procedures where useful) at some point in the future. This will lead to such a proliferation that it makes sense to split out the common parts like the error reporting to have it consistent in all cases (but even the reporting needs to know the type of the value it reports... tricky). |
I am likely to forget about this soon unless I write it down somewhere, so...
In my assert_equal()-like procedure for std_ulogic(_vector), I recently made a change to use std_match() instead of comparing via the "=" operator so that I can have don't care ('-') which was pretty useful so far. The pitfall with std_match() however is that comparing 'X' with 'X' yields false - quite unexpected for a user of an assert_equal :)
I will implement my own match_table soon. The original is e.g. in http://www.eda.org/rassp/vhdl/models/standards/numeric_std.vhd
The text was updated successfully, but these errors were encountered: