I have the next code in my verification environment:
// seq_file.e
extend SPECIFIC_TYPE sequence {
keep type driver is a SPECIFIC_TYPE sequence_driver;
event some_event is @driver.as_a(SPECIFIC_TYPE sequence_driver).some_event;
};
extend SPECIFIC_TYPE SEQ_NAME sequence {
body()@driver.clock is only {
var foo := driver.specific_type_field;
};
};
Note that thank to keep type driver is a..
there is no need in driver
's casting in the line starting var foo..
BUT, the keep type driver is a..
does not affect the some_event
, i.e. if the as_a
casting is removed from the line, there is a compilation error says 'driver' does not have 'some_event' though its subtype do. use driver.as_a(SPECIFIC_TYPE sequence_driver)
.
Why the keep type driver is a..
fails to cast the driver
in some_event..
line?
Thank you for your help
Your observation is correct: type constraint is taken into account for a field access (and for a method call), but not for event sampling. This is a limitation, and it might be removed in upcoming versions. I suggest contacting official Specman support for the exact info on the plans.