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

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [trunk/] [rtl/] [systemc/] [decoder_l2/] [decoder_l2.cpp] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//decoder_l2.cpp
2
 
3
/* ***** BEGIN LICENSE BLOCK *****
4
 * Version: MPL 1.1
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version
7
 * 1.1 (the "License"); you may not use this file except in compliance with
8
 * the License. You may obtain a copy of the License at
9
 * http://www.mozilla.org/MPL/
10
 *
11
 * Software distributed under the License is distributed on an "AS IS" basis,
12
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
 * for the specific language governing rights and limitations under the
14
 * License.
15
 *
16
 * The Original Code is HyperTransport Tunnel IP Core.
17
 *
18
 * The Initial Developer of the Original Code is
19
 * Ecole Polytechnique de Montreal.
20
 * Portions created by the Initial Developer are Copyright (C) 2005
21
 * the Initial Developer. All Rights Reserved.
22
 *
23
 * Contributor(s):
24
 *   Max-Elie Salomon
25
 *   Ami Castonguay <acastong@grm.polymtl.ca>
26
 *
27
 * Alternatively, the contents of this file may be used under the terms
28
 * of the Polytechnique HyperTransport Tunnel IP Core Source Code License
29
 * (the  "PHTICSCL License", see the file PHTICSCL.txt), in which case the
30
 * provisions of PHTICSCL License are applicable instead of those
31
 * above. If you wish to allow use of your version of this file only
32
 * under the terms of the PHTICSCL License and not to allow others to use
33
 * your version of this file under the MPL, indicate your decision by
34
 * deleting the provisions above and replace them with the notice and
35
 * other provisions required by the PHTICSCL License. If you do not delete
36
 * the provisions above, a recipient may use your version of this file
37
 * under either the MPL or the PHTICSCL License."
38
 *
39
 * ***** END LICENSE BLOCK ***** */
40
 
41
#include "decoder_l2.h"
42
 
43
#include "cd_state_machine_l3.h"
44
#include "cd_counter_l3.h"
45
#include "cd_cmd_buffer_l3.h"
46
#include "cd_cmdwdata_buffer_l3.h"
47
#include "cd_mux_l3.h"
48
#include "cd_nop_handler_l3.h"
49
#include "cd_history_rx_l3.h"
50
#include "cd_packet_crc_l3.h"
51
 
52
void decoder_l2::set_outputs()
53
{
54
        PacketCommand cmd = getPacketCommand(sc_bv<6>(lk_dword_cd.read()));
55
 
56
        cd_data_db = lk_dword_cd;
57
        cd_getaddr_db = getAddressSetCnt;
58
        cd_datalen_db = (sc_bv<4>)(lk_dword_cd.read().range(25,22));
59
        cd_vctype_db = getVirtualChannel(sc_bv<64>(lk_dword_cd.read()),cmd);
60
 
61
}
62
 
63
 
64
decoder_l2::decoder_l2( sc_module_name name) : sc_module(name)
65
{
66
 
67
        SC_METHOD(set_outputs);
68
        sensitive << lk_dword_cd << getAddressSetCnt;
69
 
70
 
71
        SM = new cd_state_machine_l3("SM");
72
 
73
        SM->clk(clk);
74
        SM->dWordIn(lk_dword_cd);
75
        SM->lk_lctl_cd(lk_lctl_cd);
76
        SM->lk_hctl_cd(lk_hctl_cd);
77
        SM->lk_available_cd(lk_available_cd);
78
        SM->cd_protocol_error_csr(cd_protocol_error_csr);
79
        SM->resetx(resetx);
80
        SM->end_of_count(end_of_count);
81
        SM->getAddressSetCnt(getAddressSetCnt);
82
        SM->cd_write_db(cd_write_db);
83
        //SM->decrCnt(decrCnt);
84
        SM->cd_available_ro(cd_available_ro);
85
        SM->enCtlwData1(enCtlWdata1);
86
        SM->enCtlwData2(enCtlWdata2);
87 11 acastong
#ifdef RETRY_MODE_ENABLED
88
        SM->selCtlPckt(selCtlPckt);
89 2 acastong
        SM->enCtl1(enCtl1);
90
        SM->enCtl2(enCtl2);
91 11 acastong
#endif
92 2 acastong
        SM->setNopCnt(setNopCnt);
93
        SM->cd_sync_detected_csr(cd_sync_detected_csr);
94 11 acastong
#ifdef RETRY_MODE_ENABLED
95
        SM->error64Bits(error64Bits);
96
#endif
97 2 acastong
        SM->error64BitsCtlwData(error64BitsCtlwData);
98
        SM->send_nop_notification(send_nop_notification);
99
        //SM->count_done(count_done);
100
        SM->cd_initiate_nonretry_disconnect_lk(cd_initiate_nonretry_disconnect_lk);
101
        SM->cd_data_pending_ro(cd_data_pending_ro);
102
#ifdef RETRY_MODE_ENABLED
103
        SM->cd_drop_db(cd_drop_db);
104
        SM->csr_retry(csr_retry);
105
        SM->cd_initiate_retry_disconnect(cd_initiate_retry_disconnect);
106
        SM->crc1_good(crc1_good);
107
        SM->crc2_good(crc2_good);
108
        SM->crc1_stomped(crc1_stomped);
109
        SM->crc2_stomped(crc2_stomped);
110
        SM->crc1_enable(crc1_enable);
111
        SM->crc2_enable(crc2_enable);
112
        SM->crc1_reset(crc1_reset);
113
        SM->crc2_reset(crc2_reset);
114
        SM->crc2_if_ctl(crc2_if_ctl);
115
        SM->cd_received_stomped_csr(cd_received_stomped_csr);
116
        SM->cd_received_non_flow_stomped_ro(cd_received_non_flow_stomped_ro);
117
        SM->lk_initiate_retry_disconnect(lk_initiate_retry_disconnect);
118
#endif
119
 
120
        CNT = new cd_counter_l3("CNT");
121
 
122
        CNT->clk(clk);
123
        CNT->resetx(resetx);
124
        CNT->setCnt(getAddressSetCnt);
125
        CNT->decrCnt(cd_write_db);
126
        CNT->data(lk_dword_cd);
127
        CNT->end_of_count(end_of_count);
128
        //CNT->count_done(count_done);
129
 
130 11 acastong
#ifdef RETRY_MODE_ENABLED
131 2 acastong
        CMD_BUF = new cd_cmd_buffer_l3("CMD_BUF");
132
 
133
        CMD_BUF->clk(clk);
134
        CMD_BUF->dataDword(lk_dword_cd);
135
        CMD_BUF->enCtl1(enCtl1);
136
        CMD_BUF->enCtl2(enCtl2);
137
        CMD_BUF->packet(ctlPacket0);
138
        CMD_BUF->error64Bits(error64Bits);
139
        CMD_BUF->resetx(resetx);
140 11 acastong
#endif  
141
 
142 2 acastong
        CMDWDATA_BUF = new cd_cmdwdata_buffer_l3("CMDWDATA_BUF");
143
 
144
        CMDWDATA_BUF->clk(clk);
145
        CMDWDATA_BUF->dataDword(lk_dword_cd);
146
        CMDWDATA_BUF->db_address_cd(db_address_cd);
147
        CMDWDATA_BUF->enCtl1(enCtlWdata1);
148
        CMDWDATA_BUF->enCtl2(enCtlWdata2);
149 11 acastong
#ifdef RETRY_MODE_ENABLED
150 2 acastong
        CMDWDATA_BUF->packet(ctlPacket1);
151 11 acastong
#else
152
        CMDWDATA_BUF->packet(cd_packet_ro);
153
#endif
154 2 acastong
        CMDWDATA_BUF->error64BitsCtlwData(error64BitsCtlwData);
155
        CMDWDATA_BUF->resetx(resetx);
156
        CMDWDATA_BUF->cd_data_pending_addr_ro(cd_data_pending_addr_ro);
157
 
158 11 acastong
#ifdef RETRY_MODE_ENABLED
159 2 acastong
        MUX = new cd_mux_l3("MUX");
160
 
161
        MUX->ctlPacket0(ctlPacket0);
162
        MUX->ctlPacket1(ctlPacket1);
163
        MUX->select(selCtlPckt);
164
        MUX->cd_packet_ro(cd_packet_ro);
165 11 acastong
#endif
166 2 acastong
 
167
        NOP_HANDLER = new cd_nop_handler_l3("NOP_HANDLER");
168
 
169
        NOP_HANDLER->clk(clk);
170
        NOP_HANDLER->resetx(resetx);
171
        NOP_HANDLER->lk_dword_cd(lk_dword_cd);
172
        NOP_HANDLER->setNopCnt(setNopCnt);
173
        NOP_HANDLER->cd_nopinfo_fc(cd_nopinfo_fc);
174
        NOP_HANDLER->cd_nop_received_fc(cd_nop_received_fc);
175
        NOP_HANDLER->send_nop_notification(send_nop_notification);
176
#ifdef RETRY_MODE_ENABLED
177
        NOP_HANDLER->cd_nop_ack_value_fc(cd_nop_ack_value_fc);
178
 
179
        HISTORY = new cd_history_rx_l3("HISTORY");
180
 
181
        HISTORY->clk(clk);
182
        HISTORY->resetx(resetx);
183
        HISTORY->incrCnt(cd_available_ro);
184
        HISTORY->cd_rx_next_pkt_to_ack_fc(cd_rx_next_pkt_to_ack_fc);
185
 
186
        packet_crc_unit = new cd_packet_crc_l3("CRC");
187
 
188
        packet_crc_unit->clk(clk);
189
        packet_crc_unit->resetx(resetx);
190
 
191
        packet_crc_unit->lk_dword_cd(lk_dword_cd);
192
        packet_crc_unit->lk_hctl_cd(lk_hctl_cd);
193
        packet_crc_unit->lk_lctl_cd(lk_lctl_cd);
194
 
195
        packet_crc_unit->crc1_enable(crc1_enable);
196
        packet_crc_unit->crc2_enable(crc2_enable);
197
        packet_crc_unit->crc1_reset(crc1_reset);
198
        packet_crc_unit->crc2_reset(crc2_reset);
199
        packet_crc_unit->crc2_if_ctl(crc2_if_ctl);
200
 
201
        packet_crc_unit->crc1_good(crc1_good);
202
        packet_crc_unit->crc2_good(crc2_good);
203
        packet_crc_unit->crc1_stomped(crc1_stomped);
204
        packet_crc_unit->crc2_stomped(crc2_stomped);
205
#endif
206
}
207
 
208
#ifdef SYSTEMC_SIM
209
decoder_l2::~decoder_l2(){
210
        delete SM;
211
        delete CNT;
212
        delete CMDWDATA_BUF;
213
        delete NOP_HANDLER;
214
#ifdef RETRY_MODE_ENABLED
215 11 acastong
        delete CMD_BUF;
216
        delete MUX;
217 2 acastong
        delete HISTORY;
218
        delete packet_crc_unit;
219
#endif
220
}
221
#endif
222
 
223
 
224
 
225
#ifndef SYSTEMC_SIM
226
#include "../core_synth/synth_control_packet.cpp"
227
#endif
228
 

powered by: WebSVN 2.1.0

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