0
unexpected behviour using PositiveFlank(x) and Not(x)
Using IQAN6, we have encountered some unexpected behaviour when using a NOT condition with a Positive Flank condition. A solution has been found but curious as to if this behaviour is in the Simulation only or will the HW behave in the same manner. If this is the expected behaviour, how are these conditions handled at the system level?
Customer support service by UserEcho
Not sure I follow what the question, but it seems as if the cutout is from four separate versions of a Qcode function that you tried separately and then combined to make the post?
With a function that can assign the Result variable multiple times (as the posted cutout looks like), it will be the last assigned value that gets used.
In the first three, you are assigning the Result variable directly, and the code is written so it could end up not assigning Result. If you do not assign anything to Result, the behavior you will see is that it is set to zero.
The static variable (used in the last statement) will always keep its values between cycles.
Non-static variables should be placed so they are always set (as it is otherwise undefined between cycles).
For the flank() function, it is good to think of where it is placed. When it is evaluated every cycle it is easy to see that it will work. In the first three examples, it can be not evaluated, and you end up on relying on the behavior it has when changing from not evaluated to being evaluated.
So the line where you always assign y :=PositveFlank(x) is a good solution.
Thank you for the response, it was helpful.
Yes, I combined the 4 different else/if's for the post, not what was actually executed. Ran each one independently. Sorry about the confusion.
Our confusion(curiosity) is coming from what would the steady state be reported as, in a cycle where the flank is also being reported?
X=DIN
For a single cycle:
not(X)=??
X = ??
PostiveFlank(X) = TRUE
Thanks!
The not() function is just the inverse of its input. If the DIN is True, not(DIN) is False and vice versa.
The PositiveFlank() function is more interesting as it depends on the previous cycle.
Normally when the PositveFlank() function is evaluated every cycle, it will be True in the cycle when its input changes from False to True.
A special case is in the first cycle, the PositiveFlank() function will be False regardless of the value on the input.
This also applies when changing from disabled / not evaluated.
In the examples where you put the PositiveFlank() as part of an elseif statement, you get this behavior where it is changing from not evaluated.