1 |
22 |
antanguay |
/**
|
2 |
|
|
* Scoreboard / Checker for 10 GE MAC Core verification environment.
|
3 |
|
|
* It takes packet data from driver as well as monitor class and comapre them for equality for error checking purpose
|
4 |
|
|
* @file: scoreboard.sv
|
5 |
|
|
* @author: Pratik Mahajan
|
6 |
|
|
* @par Contact: pratik@e-pigeonpost.com
|
7 |
|
|
* @par Company: UCSC 1896 course
|
8 |
|
|
*
|
9 |
|
|
* @version: $LastChangedRevision$
|
10 |
|
|
* @par Last Changed Date
|
11 |
|
|
* $LastChangedDate$
|
12 |
|
|
* $par Last Changed By
|
13 |
|
|
* $LastChangedBy$
|
14 |
|
|
*/
|
15 |
|
|
|
16 |
|
|
/**
|
17 |
|
|
* Scoreboard class for error checking of 10GE MAC Core.
|
18 |
|
|
* Collects packet data from driver and monitor in the form of mailboxes and then compare them for equality.
|
19 |
|
|
* If they are equal then communication was successful
|
20 |
|
|
* @class scoreboard
|
21 |
|
|
* @par mailbox driver2Scoreboard collects transmitted packets from driver.
|
22 |
|
|
* @par mailbox monitor2Scoreboard collects received packets through monitor.
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
class scoreboard;
|
26 |
|
|
|
27 |
|
|
mailbox driver2Scoreboard; ///< packet data passed down from driver as source or expected data
|
28 |
|
|
mailbox monitor2Scoreboard; ///< packet data from monitor as source for actual data
|
29 |
|
|
static bit error = 0; ///< Error flag to keep track of correctness of verification environment
|
30 |
|
|
/**
|
31 |
|
|
* Constructor for scoreboard class.
|
32 |
|
|
* purpose is to create an object for scoreboard which will take mailboxes from respective classes
|
33 |
|
|
* @param mailbox receivedFromDriver to hold mailbox received from Driver
|
34 |
|
|
* @param mailbox receivedFromMonitor to hold mailbox received from Monitor
|
35 |
|
|
* @return: NA (creates object of type scoreboard and returns handle)
|
36 |
|
|
*/
|
37 |
|
|
function new (input mailbox receivedFromDriver, input mailbox receivedFromMonitor);
|
38 |
|
|
this.driver2Scoreboard = receivedFromDriver;
|
39 |
|
|
this.monitor2Scoreboard = receivedFromMonitor;
|
40 |
|
|
endfunction: new
|
41 |
|
|
|
42 |
|
|
/**
|
43 |
|
|
* Compare task for error checking.
|
44 |
|
|
* This task compares actual and expected results for correctness of design.
|
45 |
|
|
* @param mailbox driver2Scoreboard expected results to be validated
|
46 |
|
|
* @param mailbox monitor2Scoreboard actual results to be compared
|
47 |
|
|
*/
|
48 |
|
|
task compare ( input mailbox driver2Scoreboard,
|
49 |
|
|
input mailbox monitor2Scoreboard,
|
50 |
|
|
int bytesInFrame);
|
51 |
|
|
|
52 |
|
|
packet driverPacket;
|
53 |
|
|
packet monitorPacket;
|
54 |
|
|
|
55 |
|
|
driver2Scoreboard.get (driverPacket);
|
56 |
|
|
monitor2Scoreboard.get (monitorPacket);
|
57 |
|
|
|
58 |
|
|
`define driverData { driverPacket.packetData [7], driverPacket.packetData [6], driverPacket.packetData [5], driverPacket.packetData [4], driverPacket.packetData [3], driverPacket.packetData [2], driverPacket.packetData [1], driverPacket.packetData [0] }
|
59 |
|
|
`define monitorData { monitorPacket.receivedData [7], monitorPacket.receivedData [6], monitorPacket.receivedData [5], monitorPacket.receivedData [4], monitorPacket.receivedData [3], monitorPacket.receivedData [2], monitorPacket.receivedData [1], monitorPacket.receivedData [0] }
|
60 |
|
|
|
61 |
|
|
if (bytesInFrame != 0) begin
|
62 |
|
|
for (int i = 0; i < bytesInFrame; i++) begin
|
63 |
|
|
if (driverPacket.packetData [7-i] != monitorPacket.receivedData [7-i]) begin
|
64 |
|
|
$display ("ERROR: Packet data [%0d] the data was %x and %x mismatched", i, driverPacket.packetData[7-i], monitorPacket.receivedData[7-i]);
|
65 |
|
|
error = 1;
|
66 |
|
|
end
|
67 |
|
|
end
|
68 |
|
|
end
|
69 |
|
|
|
70 |
|
|
if (bytesInFrame == 0)
|
71 |
|
|
if (`driverData != `monitorData) begin
|
72 |
|
|
$display ("ERROR: Packet frame mismatched");
|
73 |
|
|
error = 1;
|
74 |
|
|
end
|
75 |
|
|
|
76 |
|
|
if (driverPacket.startOfPacket != monitorPacket.startOfPacket || driverPacket.endOfPacket != monitorPacket.endOfPacket)
|
77 |
|
|
begin
|
78 |
|
|
error = 1;
|
79 |
|
|
$display ("ERROR: Packet control mismatched ");
|
80 |
|
|
end
|
81 |
|
|
|
82 |
|
|
/* if (error == 0) begin
|
83 |
|
|
$display ("PASS: Packet matched properly ");
|
84 |
|
|
end
|
85 |
|
|
*/
|
86 |
|
|
endtask // compare
|
87 |
|
|
|
88 |
|
|
endclass // scoreboard
|