User code:
REQ-RSP Packet flow diagram:
NOTE:: In the above diagram for Sequence to Driver packet flow black ink is used and for Driver to Sequence packet flow blue ink is used. .
Sequence to Driver:
1. In run_phase of testcase we start the sequence: seq.start(sequencer);
2. Now sequence's start method calls the body of the sequence. Inside the body of sequence, we have created the packet. Once packet is getting created, start_item(pkt) is called.
3. This start_item() calls the wait_for_grant() method of sequencer. Which pushes the current sequence inside the sequence queue of sequencer. And then it waits for that sequence entry to get granted.
4. Driver calls the get_next_item() method implemented in sequencer. This method is blocking until the sequence is available inside the sequence queue of sequencer. And out of available sequences, sequencer selects the sequence based on the arbitration mode set.
5. Once the sequence entry gets granted, sequence comes out of the start_item() and it randomizes the packet as per requirement (in body task). Now once packet got randomized, sequence calls the finish_item().
6. finish_item() calls send_request() method defined in sequencer. In send_request() it pushes the packet inside the request queue of sequencer.
7. In get_next_item(), once sequence got selected it waits for the packet to be available inside request queue of sequencer. Once packet is available, it is handed over to driver as an output of get_next_item(). And driver will start driving this packet on interface.
8. After send_request(), sequence calls wait_for_item_done() method of sequencer. This method waits for wait_for_item_seq_id variable to be updated with its own sequence id value.[Ultimately, it waits for the indication that driver has completed the driving of current sequence packet]
9. Once packet has been driven by the driver, driver will call item_done method of sequencer. This item_done method updates the wait_for_item_seq_id variable with the sequence id value of granted sequence whose packet has been driven by driver.
10. This will unblock wait_for_item_done and sequence returns from finish_item().
Driver to Sequence:
1. When sequence is done with finish_item(), sometimes response is required by the sequence. And that RSP packet can be get by the sequence using get_response() method, which is blocking.
2. This method waits for the size of the response queue of sequence to be non-zero.
3. Whenever driver calls item_done() method of sequencer, it may or may not pass packet as response. If the driver sends RSP packet then this packet is passed to the put_response method. This put_response method of sequencer calls put_response method of sequence, which pushes the RSP packet inside its own response queue.
4. This will unblock the get_response(), as packet is available inside the response queue. And it will return RSP as an output of get_response().
2. Now sequence's start method calls the body of the sequence. Inside the body of sequence, we have created the packet. Once packet is getting created, start_item(pkt) is called.
3. This start_item() calls the wait_for_grant() method of sequencer. Which pushes the current sequence inside the sequence queue of sequencer. And then it waits for that sequence entry to get granted.
4. Driver calls the get_next_item() method implemented in sequencer. This method is blocking until the sequence is available inside the sequence queue of sequencer. And out of available sequences, sequencer selects the sequence based on the arbitration mode set.
5. Once the sequence entry gets granted, sequence comes out of the start_item() and it randomizes the packet as per requirement (in body task). Now once packet got randomized, sequence calls the finish_item().
6. finish_item() calls send_request() method defined in sequencer. In send_request() it pushes the packet inside the request queue of sequencer.
7. In get_next_item(), once sequence got selected it waits for the packet to be available inside request queue of sequencer. Once packet is available, it is handed over to driver as an output of get_next_item(). And driver will start driving this packet on interface.
8. After send_request(), sequence calls wait_for_item_done() method of sequencer. This method waits for wait_for_item_seq_id variable to be updated with its own sequence id value.[Ultimately, it waits for the indication that driver has completed the driving of current sequence packet]
9. Once packet has been driven by the driver, driver will call item_done method of sequencer. This item_done method updates the wait_for_item_seq_id variable with the sequence id value of granted sequence whose packet has been driven by driver.
10. This will unblock wait_for_item_done and sequence returns from finish_item().
Driver to Sequence:
1. When sequence is done with finish_item(), sometimes response is required by the sequence. And that RSP packet can be get by the sequence using get_response() method, which is blocking.
2. This method waits for the size of the response queue of sequence to be non-zero.
3. Whenever driver calls item_done() method of sequencer, it may or may not pass packet as response. If the driver sends RSP packet then this packet is passed to the put_response method. This put_response method of sequencer calls put_response method of sequence, which pushes the RSP packet inside its own response queue.
4. This will unblock the get_response(), as packet is available inside the response queue. And it will return RSP as an output of get_response().
No comments:
Post a Comment