Hi, I recently ran into an issue related to the use of is_relevant() from within a sequence and I'd like to get some opinion on possible solutions. Originally posted in cdnusers.org by jhzhang
Problem: I want to use is_relevant() as a form of back-pressure to stall the enclosing sequence upon some condition. However, that condition is not known until the current item has been generated. Since 'do' is an atomic action, and is_relevant() does not allow access to the generated item as it's being 'do'ne, I'm stuck.
We eventually ended up replacing the 'do' syntax with our own macro for doing an item. Our macros would generate the item first, set some conditions based on the results of the gen, and then invoke 'do' to pass it the item we just generated. The conditions we set right after the gen would be used to implement is_relevant().
The work-around solves the problem, but it's cumbersome and we might run into some issues in the future should the semantics/implementation of 'do' change.
Has anyone else ever encountered a similar problem/limitation with is_relevant()?
Joseph H. Zhang
Lead Verification Engineer
Cisco Systems, Inc.