OpenCores
URL https://opencores.org/ocsvn/xge_mac/xge_mac/trunk

Subversion Repositories xge_mac

[/] [xge_mac/] [trunk/] [tbench/] [proto_systemverilog/] [verification/] [driver.sv] - Blame information for rev 22

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 antanguay
/**
2
 * 10 GE MAC Core verification environment driver file.
3
 * @file: driver.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
 * Driver class to send packet from test environment to DUT (10GE MAC Core).
17
 * Driver only talks with Tx interface of 10 GE MAC Core, This class will provide
18
 * packet data to MAC Core as represented in specification requirement.
19
 * @class driver
20
 * @par virtual macCoreInterface to connect class objects with DUT
21
 */
22
 
23
class driver;
24
 
25
   virtual macCoreInterface virtualMacCoreInterface; ///< Virtual interface to connect class types with RTL.
26
   mailbox driver2Scoreboard;
27
 
28
   const bit ASSERT   = 1'b1; ///< to assert sequence while transsion of packet
29
   const bit DEASSERT = 1'b0; ///< to deassert sequence while transmission of packet
30
 
31
//   packetFrame        driverPacket;
32
 
33
   /**
34
    * Constructor for driver class -- main purpose is to connect design interface with class virtual interface.
35
    * @param virtualInterface -- virtual interface passed down from env class
36
    * @return: NA (creates object of type class and returns handle
37
    */
38
   function new (virtual macCoreInterface virtualInterface,
39
                 input mailbox driver2Scoreboard
40
                 );
41
      this.virtualMacCoreInterface = virtualInterface;
42
      this.driver2Scoreboard       = driver2Scoreboard;
43
   endfunction // new
44
 
45
   /**
46
    * Task to send complete packet data to the input of RTL (10 GE MAC Core).
47
    * send_packet should follow protocol requirements specified in requirement specifications (except if it is used for error injection)
48
    * protocol requirement:
49
    *   assert: packetValid
50
    *   make sure sop, eop and mod are set to 0 at start of packet (do it at the end of each packet transmission or right here)
51
    *   if sending 0th frame assert sop
52
    *   if sending last fram assert eop and mod
53
    *   put all data on packetData
54
    *   wait for a clock edge and de-assert packetValid, eop and mod (at this point sop is still asserted ??)
55
    * packet class itself will take care of keeping track of number of objects created.
56
    */
57
   task send_packet (input int lengthOfFrame);
58
      packet macCore; ///< object of type packet that will be transmitted to DUT
59
 
60
      virtualMacCoreInterface.clockingTxRx.transmitValid <= ASSERT;
61
 
62
      for (int i = 0; i < lengthOfFrame; i+=8)
63
        begin
64
           macCore = new (TRANSMIT);
65
           assert (macCore.randomize ());
66
           macCore.startOfPacket        = DEASSERT;
67
           macCore.endOfPacket          = DEASSERT;
68
           macCore.packetLengthModulus  = 3'b0;
69
 
70
           if (i == 0) macCore.startOfPacket    = ASSERT;
71
//virtualMacCoreInterface.clockingTxRx.transmitStartOfPacket <= ASSERT;
72
 
73
           if (i+8 >= lengthOfFrame) begin
74
              macCore.endOfPacket               = ASSERT;
75
              macCore.packetLengthModulus       = lengthOfFrame % 8;
76
//            virtualMacCoreInterface.clockingTxRx.transmitEndOfPacket <= ASSERT;
77
//            virtualMacCoreInterface.clockingTxRx.transmitPacketLengthModulus <= lengthOfFrame % 8;
78
           end
79
 
80
           virtualMacCoreInterface.clockingTxRx.transmitStartOfPacket           <= macCore.startOfPacket;
81
           virtualMacCoreInterface.clockingTxRx.transmitEndOfPacket             <= macCore.endOfPacket;
82
           virtualMacCoreInterface.clockingTxRx.transmitPacketLengthModulus     <= macCore.packetLengthModulus;
83
 
84
           virtualMacCoreInterface.clockingTxRx.transmitData <= {       macCore.packetData [7],
85
                                                                        macCore.packetData [6],
86
                                                                        macCore.packetData [5],
87
                                                                        macCore.packetData [4],
88
                                                                        macCore.packetData [3],
89
                                                                        macCore.packetData [2],
90
                                                                        macCore.packetData [1],
91
                                                                        macCore.packetData [0]  };
92
           macCore.print (TRANSMIT);
93
           driver2Scoreboard.put (macCore);
94
           @(virtualMacCoreInterface.clockingTxRx);
95
 
96
        end // for (int i = 0; i < lengthOfFrame; i+=8)
97
 
98
      virtualMacCoreInterface.clockingTxRx.transmitValid <= DEASSERT;
99
      virtualMacCoreInterface.clockingTxRx.transmitEndOfPacket <= DEASSERT;
100
      virtualMacCoreInterface.clockingTxRx.transmitPacketLengthModulus <= 3'b0;
101
 
102
   endtask // send_packet
103
 
104
endclass // driver

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.