1 |
22 |
antanguay |
/**
|
2 |
|
|
* 10 GE MAC Core verification environment monitor file.
|
3 |
|
|
* @file: monitor.sv
|
4 |
|
|
* @author: Pratik Mahajan
|
5 |
|
|
* @par Contact: pratik@e-pigeonpost.com
|
6 |
|
|
* @par Company: UCSC (SV 1896 Systemverilog for advanced verification course)
|
7 |
|
|
*
|
8 |
|
|
* @version: $LastChangedRevision$
|
9 |
|
|
* @par Last Changed Date:
|
10 |
|
|
* $LastChangedDate$
|
11 |
|
|
* @par Last Changed By
|
12 |
|
|
* $LastChangedBy$
|
13 |
|
|
*/
|
14 |
|
|
|
15 |
|
|
/**
|
16 |
|
|
* Monitor class to collect packet from DUT (10 GE MAC Core) in test environment.
|
17 |
|
|
* Monitor only communicate with receive interface of DUT and collects information
|
18 |
|
|
* about packet, this information can be validated with expected results for error
|
19 |
|
|
* checking and proper working of protocol.
|
20 |
|
|
* @class monitor
|
21 |
|
|
* @par virtual macCoreInterface to collect data from interface.
|
22 |
|
|
*/
|
23 |
|
|
|
24 |
|
|
class monitor;
|
25 |
|
|
|
26 |
|
|
virtual macCoreInterface virtualMacCoreInterface; ///< virtual interface to connect class type to RTL / module type
|
27 |
|
|
mailbox monitor2Scoreboard;
|
28 |
|
|
|
29 |
|
|
const bit ASSERT = 1'b1; ///< to assert sequence while receiving packet from DUT
|
30 |
|
|
const bit DEASSERT = 1'b0; ///< to de-assert sequence while receiving packet from DUT
|
31 |
|
|
// packetFrame monitorPacket;
|
32 |
|
|
|
33 |
|
|
/**
|
34 |
|
|
* Constructor for monitor class -- main purpose is to connect design interface with monitor class virtual interface.
|
35 |
|
|
* @param virtualInterface -- input to constructor passed down by env class
|
36 |
|
|
* @return: NA (creates an object of type monitor and returns a handle)
|
37 |
|
|
*/
|
38 |
|
|
function new (virtual macCoreInterface virtualInterface,
|
39 |
|
|
mailbox monitor2Scoreboard
|
40 |
|
|
);
|
41 |
|
|
this.virtualMacCoreInterface = virtualInterface;
|
42 |
|
|
this.monitor2Scoreboard = monitor2Scoreboard;
|
43 |
|
|
endfunction // new
|
44 |
|
|
|
45 |
|
|
/**
|
46 |
|
|
* Task to collect data from output of RTL from interface as bus.
|
47 |
|
|
* collect_packet should follow protocol requirements specified in requirement specifications (unless it is used for error injection)
|
48 |
|
|
* Protocol requirements:
|
49 |
|
|
* Always check for receiveAvailable (need to do it in testcase or environment? but need to be running under forever)
|
50 |
|
|
* if(receiveAvailable) start packet collect
|
51 |
|
|
* assert receiveReadEnable
|
52 |
|
|
* until receive is not complete
|
53 |
|
|
* if receiveValid
|
54 |
|
|
* if receiveStartOfPacket -- print/do nothing/start
|
55 |
|
|
* packet.data = receiveData
|
56 |
|
|
* if receiveEndOfPacket -- finish collecting packet
|
57 |
|
|
* deassert receiveReadEnable
|
58 |
|
|
* display some stuff
|
59 |
|
|
*
|
60 |
|
|
* MAY NEED TO LOOK IN OTHER FLAGS AS ERROR AND STUFF
|
61 |
|
|
* creating new packet itself will take care of incrementing
|
62 |
|
|
*/
|
63 |
|
|
`define receivedPacket { receiveMacCore.receivedData[7], receiveMacCore.receivedData[6], receiveMacCore.receivedData[5], receiveMacCore.receivedData[4], receiveMacCore.receivedData[3], receiveMacCore.receivedData[2], receiveMacCore.receivedData[1], receiveMacCore.receivedData[0] }
|
64 |
|
|
|
65 |
|
|
task collect_packet ();
|
66 |
|
|
packet receiveMacCore; ///< object of type packet that will be collected from DUT.
|
67 |
|
|
|
68 |
|
|
virtualMacCoreInterface.clockingTxRx.receiveReadEnable <= ASSERT;
|
69 |
|
|
|
70 |
|
|
do begin
|
71 |
|
|
receiveMacCore = new (RECEIVE);
|
72 |
|
|
@(virtualMacCoreInterface.clockingTxRx);
|
73 |
|
|
if (virtualMacCoreInterface.clockingTxRx.receiveValid) begin
|
74 |
|
|
receiveMacCore.startOfPacket = virtualMacCoreInterface.clockingTxRx.receiveStartOfPacket;
|
75 |
|
|
receiveMacCore.endOfPacket = virtualMacCoreInterface.clockingTxRx.receiveEndOfPacket;
|
76 |
|
|
receiveMacCore.packetLengthModulus = virtualMacCoreInterface.clockingTxRx.receivePacketLengthModulus;
|
77 |
|
|
|
78 |
|
|
if (virtualMacCoreInterface.clockingTxRx.receiveStartOfPacket) begin
|
79 |
|
|
$display ("Starting to receive packet \n");
|
80 |
|
|
end
|
81 |
|
|
`receivedPacket = virtualMacCoreInterface.clockingTxRx.receivedData;
|
82 |
|
|
receiveMacCore.print (RECEIVE);
|
83 |
|
|
|
84 |
|
|
monitor2Scoreboard.put (receiveMacCore);
|
85 |
|
|
end // if (virtualMacCoreInterface.clockingTxRx.receiveValid)
|
86 |
|
|
end while (!virtualMacCoreInterface.clockingTxRx.receiveEndOfPacket); // UNMATCHED !!
|
87 |
|
|
|
88 |
|
|
virtualMacCoreInterface.clockingTxRx.receiveReadEnable <= DEASSERT;
|
89 |
|
|
|
90 |
|
|
endtask // collect_packet
|
91 |
|
|
|
92 |
|
|
endclass // monitor
|