Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: pl_producer.cpp | |
4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | // | |
7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | // | |
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; version 2 of the License. | |
12 | // | |
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | // | |
22 | // For the avoidance of doubt, and except that if any non-GPL license | |
23 | // choice is available it will apply instead, Sun elects to use only | |
24 | // the General Public License version 2 (GPLv2) at this time for any | |
25 | // software where a choice of GPL license versions is made | |
26 | // available with the language indicating that GPLv2 or any later version | |
27 | // may be used, or where a choice of which version of the GPL is applied is | |
28 | // otherwise unspecified. | |
29 | // | |
30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | // CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | // have any questions. | |
33 | // | |
34 | // ========== Copyright Header End ============================================ | |
35 | #ifndef DLL_pl_producer_h | |
36 | #define DLL_pl_producer_h | |
37 | ||
38 | #include "dll_top.hpp" | |
39 | ||
40 | namespace pcie { | |
41 | ||
42 | /** This function produces DLLPs for PL **/ | |
43 | void dll_top::pl_dllp_producer() | |
44 | { | |
45 | LOG_DEBUG<<"DLL: pl_dllp_producer begins..."; | |
46 | try{ | |
47 | RefPciePacket send_packet; | |
48 | ||
49 | while(true) | |
50 | { | |
51 | if ( !queue_DLLP.empty() && !ltssm_L0s ) | |
52 | { | |
53 | //cout << sc_time_stamp() << "---- DLLP Queue Size: " << queue_DLLP.size() << endl; | |
54 | send_packet = queue_DLLP.front(); | |
55 | queue_DLLP.pop(); | |
56 | while(true){ | |
57 | if((send_packet->get_byte(0)==DLLP_ACK || send_packet->get_byte(0)== DLLP_NAK) && queue_DLLP.size()>=1){ | |
58 | if((queue_DLLP.front())->get_byte(0)==DLLP_ACK || (queue_DLLP.front())->get_byte(0)== DLLP_NAK){ | |
59 | //cout << "Aggregating DLLPs..." << endl; | |
60 | send_packet = queue_DLLP.front(); | |
61 | queue_DLLP.pop(); | |
62 | } | |
63 | else break; | |
64 | } | |
65 | else break; | |
66 | } | |
67 | LOG_DEBUG << "_DLL_: Sent packet to PL with PktId= " << send_packet->getPacketId() << " Size= " << send_packet->get_size() ; | |
68 | //cout << sc_time_stamp() << "\t\t\t\t\t| DLL: Sent DLLP " << send_packet->getPacketId() << " to PL." << endl; | |
69 | dll_pl_dllp_out.send_packet(send_packet); | |
70 | } | |
71 | WAIT(eventPlPktRdy); | |
72 | wait(sc_time(25,SC_NS),reset_ev);//Added | |
73 | }// while | |
74 | } | |
75 | catch(sc_exception &e){ | |
76 | LOG_DEBUG<<"DLL: Out of pl_dllp_producer"; | |
77 | } | |
78 | ||
79 | ||
80 | }// pl_producer | |
81 | ||
82 | ||
83 | /** This function produces TLPs for PL **/ | |
84 | void dll_top::pl_tlp_producer() | |
85 | { | |
86 | LOG_DEBUG<<"DLL: pl_tlp_producer begins..."; | |
87 | try{ | |
88 | RefPciePacket send_packet; | |
89 | sc_uint<12> rx_pkt_seq_num; | |
90 | sc_uint<8> byte_seq_num; | |
91 | ||
92 | while(true) | |
93 | { | |
94 | if ( !queue_TLP.empty() && !ltssm_L0s && FC_Init_Complete && Flag_FC1 && Flag_FC2) | |
95 | { | |
96 | send_packet = queue_TLP.front(); | |
97 | ||
98 | sent_first_stp_pkt=true; | |
99 | queue_TLP.pop(); | |
100 | LOG_DEBUG << "_DLL_: Sent packet to PL with PktId= " << send_packet->getPacketId() << " Size= " << send_packet->get_size() ; | |
101 | //cout << sc_time_stamp() << "\t\t\t\t\t| DLL: Sent TLP " << send_packet->getPacketId() << " to PL." << endl; | |
102 | dll_pl_tlp_out.send_packet(send_packet); | |
103 | buffer_add(send_packet); | |
104 | //replay_buffer.push(send_packet); | |
105 | byte_seq_num= send_packet->get_byte(1); | |
106 | rx_pkt_seq_num.range(11,8)=byte_seq_num.range(3,0); | |
107 | byte_seq_num= send_packet->get_byte(2); | |
108 | rx_pkt_seq_num.range(7,0)=byte_seq_num.range(7,0); | |
109 | LOG_DEBUG << "REPLAY_BUFFER: Added packet " << rx_pkt_seq_num ; | |
110 | } | |
111 | WAIT(eventPlPktRdy|fc_init2_complete_ev); | |
112 | }// while | |
113 | } | |
114 | catch(sc_exception &e){ | |
115 | LOG_DEBUG<<"DLL: Out of pl_tlp_producer"; | |
116 | } | |
117 | }// pl_producer | |
118 | } | |
119 | ||
120 | #endif |