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

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [tags/] [START/] [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->selCtlPckt(selCtlPckt);
86
        SM->enCtlwData1(enCtlWdata1);
87
        SM->enCtlwData2(enCtlWdata2);
88
        SM->enCtl1(enCtl1);
89
        SM->enCtl2(enCtl2);
90
        SM->setNopCnt(setNopCnt);
91
        SM->cd_sync_detected_csr(cd_sync_detected_csr);
92
        SM->error64Bits(error64Bits);;
93
        SM->error64BitsCtlwData(error64BitsCtlwData);
94
        SM->send_nop_notification(send_nop_notification);
95
        //SM->count_done(count_done);
96
        SM->cd_initiate_nonretry_disconnect_lk(cd_initiate_nonretry_disconnect_lk);
97
        SM->cd_data_pending_ro(cd_data_pending_ro);
98
#ifdef RETRY_MODE_ENABLED
99
        SM->cd_drop_db(cd_drop_db);
100
        SM->csr_retry(csr_retry);
101
        SM->cd_initiate_retry_disconnect(cd_initiate_retry_disconnect);
102
        SM->crc1_good(crc1_good);
103
        SM->crc2_good(crc2_good);
104
        SM->crc1_stomped(crc1_stomped);
105
        SM->crc2_stomped(crc2_stomped);
106
        SM->crc1_enable(crc1_enable);
107
        SM->crc2_enable(crc2_enable);
108
        SM->crc1_reset(crc1_reset);
109
        SM->crc2_reset(crc2_reset);
110
        SM->crc2_if_ctl(crc2_if_ctl);
111
        SM->cd_received_stomped_csr(cd_received_stomped_csr);
112
        SM->cd_received_non_flow_stomped_ro(cd_received_non_flow_stomped_ro);
113
        SM->lk_initiate_retry_disconnect(lk_initiate_retry_disconnect);
114
#endif
115
 
116
        CNT = new cd_counter_l3("CNT");
117
 
118
        CNT->clk(clk);
119
        CNT->resetx(resetx);
120
        CNT->setCnt(getAddressSetCnt);
121
        CNT->decrCnt(cd_write_db);
122
        CNT->data(lk_dword_cd);
123
        CNT->end_of_count(end_of_count);
124
        //CNT->count_done(count_done);
125
 
126
        CMD_BUF = new cd_cmd_buffer_l3("CMD_BUF");
127
 
128
        CMD_BUF->clk(clk);
129
        CMD_BUF->dataDword(lk_dword_cd);
130
        CMD_BUF->enCtl1(enCtl1);
131
        CMD_BUF->enCtl2(enCtl2);
132
        CMD_BUF->packet(ctlPacket0);
133
        CMD_BUF->error64Bits(error64Bits);
134
        CMD_BUF->resetx(resetx);
135
 
136
        CMDWDATA_BUF = new cd_cmdwdata_buffer_l3("CMDWDATA_BUF");
137
 
138
        CMDWDATA_BUF->clk(clk);
139
        CMDWDATA_BUF->dataDword(lk_dword_cd);
140
        CMDWDATA_BUF->db_address_cd(db_address_cd);
141
        CMDWDATA_BUF->enCtl1(enCtlWdata1);
142
        CMDWDATA_BUF->enCtl2(enCtlWdata2);
143
        CMDWDATA_BUF->packet(ctlPacket1);
144
        CMDWDATA_BUF->error64BitsCtlwData(error64BitsCtlwData);
145
        CMDWDATA_BUF->resetx(resetx);
146
        CMDWDATA_BUF->cd_data_pending_addr_ro(cd_data_pending_addr_ro);
147
 
148
        MUX = new cd_mux_l3("MUX");
149
 
150
        MUX->ctlPacket0(ctlPacket0);
151
        MUX->ctlPacket1(ctlPacket1);
152
        MUX->select(selCtlPckt);
153
        MUX->cd_packet_ro(cd_packet_ro);
154
 
155
        NOP_HANDLER = new cd_nop_handler_l3("NOP_HANDLER");
156
 
157
        NOP_HANDLER->clk(clk);
158
        NOP_HANDLER->resetx(resetx);
159
        NOP_HANDLER->lk_dword_cd(lk_dword_cd);
160
        NOP_HANDLER->setNopCnt(setNopCnt);
161
        NOP_HANDLER->cd_nopinfo_fc(cd_nopinfo_fc);
162
        NOP_HANDLER->cd_nop_received_fc(cd_nop_received_fc);
163
        NOP_HANDLER->send_nop_notification(send_nop_notification);
164
#ifdef RETRY_MODE_ENABLED
165
        NOP_HANDLER->cd_nop_ack_value_fc(cd_nop_ack_value_fc);
166
 
167
        HISTORY = new cd_history_rx_l3("HISTORY");
168
 
169
        HISTORY->clk(clk);
170
        HISTORY->resetx(resetx);
171
        HISTORY->incrCnt(cd_available_ro);
172
        HISTORY->cd_rx_next_pkt_to_ack_fc(cd_rx_next_pkt_to_ack_fc);
173
 
174
        packet_crc_unit = new cd_packet_crc_l3("CRC");
175
 
176
        packet_crc_unit->clk(clk);
177
        packet_crc_unit->resetx(resetx);
178
 
179
        packet_crc_unit->lk_dword_cd(lk_dword_cd);
180
        packet_crc_unit->lk_hctl_cd(lk_hctl_cd);
181
        packet_crc_unit->lk_lctl_cd(lk_lctl_cd);
182
 
183
        packet_crc_unit->crc1_enable(crc1_enable);
184
        packet_crc_unit->crc2_enable(crc2_enable);
185
        packet_crc_unit->crc1_reset(crc1_reset);
186
        packet_crc_unit->crc2_reset(crc2_reset);
187
        packet_crc_unit->crc2_if_ctl(crc2_if_ctl);
188
 
189
        packet_crc_unit->crc1_good(crc1_good);
190
        packet_crc_unit->crc2_good(crc2_good);
191
        packet_crc_unit->crc1_stomped(crc1_stomped);
192
        packet_crc_unit->crc2_stomped(crc2_stomped);
193
#endif
194
}
195
 
196
#ifdef SYSTEMC_SIM
197
decoder_l2::~decoder_l2(){
198
        delete SM;
199
        delete CNT;
200
        delete CMD_BUF;
201
        delete CMDWDATA_BUF;
202
        delete MUX;
203
        delete NOP_HANDLER;
204
#ifdef RETRY_MODE_ENABLED
205
        delete HISTORY;
206
        delete packet_crc_unit;
207
#endif
208
}
209
#endif
210
 
211
 
212
 
213
#ifndef SYSTEMC_SIM
214
#include "../core_synth/synth_control_packet.cpp"
215
#endif
216
 

powered by: WebSVN 2.1.0

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