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

Subversion Repositories xge_mac

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 antanguay
/**
2
 * Testbench file for verification environment of 10GE MAC Core.
3
 * @file: testbench.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
 * top block (module) mainly to instantiate all programs/modules and to generate clocks.
17
 * Clocks are generated as per specification requirements:
18
 *      Wishbone interface clock: 30 - 156MHz
19
 *      Simple Tx-Rx interface clock: 156.25 MHz
20
 *      XGMII Rx interface clock: 156.25 MHz
21
 *      XGMII Tx interface clock: 156.25 MHz
22
 *
23
 * This clock generator will create Wishbone interface clock at 78.125 MHz (cause it has
24
 * clock time of half of 156.25)
25
 * @param: clkWishboneInterface (wishbone interface clock or main clock, will be used to generate all other clocks)
26
 * @param: clkSimpleTxRxInterface
27
 * @param: clkXGMIIInterfaceRx
28
 * @param: clkXGMIIInterfaceTx
29
 */
30
 
31
module top ();
32
 
33
   bit  clkWishboneInterface;
34
   bit  clkSimpleTxRxInterface;
35
   bit  clkXGMIIInterfaceRx;
36
   bit  clkXGMIIInterfaceTx;
37
 
38
   initial begin
39
      clkWishboneInterface   = 0;
40
      clkSimpleTxRxInterface = 0;
41
      clkXGMIIInterfaceRx    = 0;
42
      clkXGMIIInterfaceTx    = 0;
43
   end
44
 
45
   initial forever #1600 clkWishboneInterface = ~clkWishboneInterface;
46
 
47
   // Creating all other clocks from wishbone clock to make it look better and easily
48
   // portable (arguable) However wishbone interface clock looses flexibility of having
49
   // any value to create 30-156MHz range
50
   // Following block can be modified to have each clock generated independently
51
   // and having more flexibility.
52
   always @(posedge clkWishboneInterface) begin
53
//   initial forever #3200 begin
54
      clkSimpleTxRxInterface = ~clkSimpleTxRxInterface;
55
      clkXGMIIInterfaceRx    = ~clkXGMIIInterfaceRx;
56
      clkXGMIIInterfaceTx    = ~clkXGMIIInterfaceTx;
57
   end
58
 
59
   initial begin
60
      $dumpfile ("toTest.dump");
61
      $dumpvars (0, top);
62
   end
63
 
64
   // Instantiation of Interface
65
   macCoreInterface instInterface (     .clkWishboneInterface   (clkWishboneInterface),
66
                                        .clkTxRxInterface       (clkSimpleTxRxInterface),
67
                                        .clkXGMIIInterfaceRx    (clkXGMIIInterfaceRx),
68
                                        .clkXGMIIInterfaceTx    (clkXGMIIInterfaceTx)
69
                                        );
70
 
71
   // Instantiation of MAC DUT
72
   xge_mac instMAC (    // Simple Tx-Rx interface signals
73
                        .clk_156m25     (instInterface.clkTxRxInterface),
74
 
75
                        .pkt_rx_ren     (instInterface.receiveReadEnable),
76
                        .pkt_rx_avail   (instInterface.receiveAvailable),
77
                        .pkt_rx_data    (instInterface.receivedData),
78
                        .pkt_rx_eop     (instInterface.receiveEndOfPacket),
79
                        .pkt_rx_err     (instInterface.receiveError),
80
                        .pkt_rx_mod     (instInterface.receivePacketLengthModulus),
81
                        .pkt_rx_sop     (instInterface.receiveStartOfPacket),
82
                        .pkt_rx_val     (instInterface.receiveValid),
83
 
84
                        .pkt_tx_data    (instInterface.transmitData),
85
                        .pkt_tx_eop     (instInterface.transmitEndOfPacket),
86
                        .pkt_tx_mod     (instInterface.transmitPacketLengthModulus),
87
                        .pkt_tx_sop     (instInterface.transmitStartOfPacket),
88
                        .pkt_tx_full    (instInterface.transmitFIFOFull),
89
                        .pkt_tx_val     (instInterface.transmitValid),
90
 
91
                        .reset_156m25_n (instInterface.rstTxRxInterface_n),
92
 
93
                        // XGMII interface signals
94
                        .clk_xgmii_rx   (instInterface.clkXGMIIInterfaceRx),
95
                        .reset_xgmii_rx_n (instInterface.rstXGMIIInterfaceRx_n),
96
                        .xgmii_rxc      (instInterface.xgmiiTransmitControl),
97
                        .xgmii_rxd      (instInterface.xgmiiTransmitData),
98
 
99
                        .clk_xgmii_tx   (instInterface.clkXGMIIInterfaceTx),
100
                        .reset_xgmii_tx_n (instInterface.rstXGMIIInterfaceTx_n),
101
                        .xgmii_txc      (instInterface.xgmiiTransmitControl),
102
                        .xgmii_txd      (instInterface.xgmiiTransmitData),
103
 
104
                        // Wishbone interface signals
105
                        .wb_clk_i       (instInterface.clkWishboneInterface),
106
                        .wb_rst_i       (instInterface.rstWishboneInterface),
107
                        .wb_adr_i       (instInterface.wishboneInputAddress),
108
                        .wb_cyc_i       (instInterface.wishboneCycle),
109
                        .wb_dat_i       (instInterface.wishboneInputData),
110
                        .wb_stb_i       (instInterface.wishboneStrobe),
111
                        .wb_we_i        (instInterface.wishboneWriteEnable),
112
 
113
                        .wb_ack_o       (instInterface.wishboneAck),
114
                        .wb_dat_o       (instInterface.wishboneOutputData),
115
                        .wb_int_o       (instInterface.wishboneInterrupt)
116
                        );
117
 
118
   // Testcase instatiation
119
   testcase instTest (  .driverTestInterface    (instInterface.TESTMOD  ),
120
                        .monitorTestInterface   (instInterface.TESTMOD  )
121
                        );
122
 
123
endmodule // top

powered by: WebSVN 2.1.0

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