Define a struct packet. Define the following elements in this struct.
Define addr (2 bits)—physical field.
Define len (6 bits)—physical field.
Define payload (list of byte)—physical field.
Define new_packet—event.
Define coverage group new_packet that includes coverage on addr and len.
Use a weight = 5, radix = HEX on addr and a weight = 10, radix = DEC on len.
Extend struct packet.
Extend coverage group new_packet using is also.
Add cross coverage on addr and len.
Cross coverage name addr_len.
Define an enumerated type fsm_state with values [IDLE, EXEC, HOLD]. Extend struct packet.
Extend coverage group new_packet using is also.
Add an item st of type fsm_state that gets a value from HDL signal '~/top/state'.
Add a transition item of st. Exclude illegal transitions. The legal state transitions are IDLE->EXEC, EXEC->HOLD, HOLD->EXEC, EXEC->IDLE. (Hint: Use a not of legal transitions.) Assign a name "State_Machine" to this item.
Extend struct packet.
Add events start and end to the struct.
Take a sample of sys.time when event start is emitted.
Take a sample of sys.time when event end is emitted
Extend coverage group new_packet using is also.
Perform latency coverage on the simulation time difference between the start and end. Ranges for latency coverage are [0..50] = "short", [51..100] = "medium", [101..200] = "long". At least three samples are needed in each range for full coverage. (Hint: Use ranges keyword and at_least option.)
Extend sys. Instantiate the packet struct. Turn coverage ON in normal mode.