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

Subversion Repositories ht_tunnel

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//multiplexer_l3.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
 *   Jean-Francois Belanger
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 "multiplexer_l3.h"
42
 
43
multiplexer_l3::multiplexer_l3(sc_module_name name) : sc_module(name)
44
{
45
        SC_METHOD(mux);
46
        sensitive_pos << clk;
47
        sensitive_neg << resetx;
48
 
49
        SC_METHOD(output);
50
        sensitive << registered_output
51
#ifdef RETRY_MODE_ENABLED
52
                << crc_output << nop_crc_output <<
53
                select_crc_output << select_nop_crc_output
54
#endif
55
                ;
56
}
57
 
58
void multiplexer_l3::mux( void )
59
{
60
        if (resetx == false) {
61
                registered_output = 0;
62
        }
63
        else {  //fin du non-reset
64
 
65
 
66 13 acastong
#ifdef SYSTEMC_SIM
67
                //GCC comlains if it's not an int that is used for the switch
68
                //But for synthesis, I don't want to change it to an int because
69
                //by default an int has a 32 bit width, which is not what I
70
                //want for a MUX selector!
71
                switch ((int)fc_ctr_mux.read()) { //synopsys infer_mux
72
#else
73 2 acastong
                switch (fc_ctr_mux.read()) { //synopsys infer_mux
74 13 acastong
#endif          
75 2 acastong
                case FC_MUX_FWD_LSB:            //fowrard CMD is sent (LSB)
76
                        {
77
                        sc_bv<64> packet = fwd_packet.read().packet;
78
                        registered_output = packet.range(31,0);
79
                        }
80
                        break;
81
 
82
                case FC_MUX_FWD_MSB :           // Forward CMD is sent (MSB)
83
                        {
84
                        sc_bv<64> packet = fwd_packet.read().packet;
85
                        registered_output = packet.range(63,32);
86
                        }
87
                        break;
88
 
89
                case FC_MUX_DB_DATA:            // Forward data is sent
90
                        registered_output = db_data_fwd;
91
                        break;
92
 
93
 
94
                case FC_MUX_EH :                //Error handler packet is sent (data or CMD)
95
                        registered_output = eh_cmd_data_fc;
96
                        break;
97
 
98
                case FC_MUX_CSR:                //Csr packet is sent (data or CMD
99
                        registered_output = csr_dword_fc;
100
                        break;
101
 
102
                case FC_MUX_UI_LSB :            //user CMD is sent (LSB)
103
                        registered_output = user_packet.read().range(31,0);
104
                        break;
105
 
106
                case FC_MUX_UI_MSB:             //user CMD is sent (MSB)
107
                        registered_output = user_packet.read().range(63,32);
108
                        break;
109
 
110
                case FC_MUX_UI_DATA:            //User data is sent
111
                        registered_output = ui_data_fc;
112
                        break;
113
 
114
                case FC_MUX_NOP :               //nop_sent
115
 
116
                        registered_output = ht_nop_pkt;
117
 
118
                        break;
119
 
120
#ifdef RETRY_MODE_ENABLED
121
                case FC_MUX_HISTORY:
122
                        registered_output = history_packet;
123
                        break;
124
#endif
125
                default :               //Data not read, keep the same data : FC_MUX_FEEDBACK
126
                        registered_output = registered_output.read();
127
 
128
                }
129
 
130
        }//fin du non-reset
131
} // fin de fonction
132
 
133
void multiplexer_l3::output(){
134
#ifdef RETRY_MODE_ENABLED
135
        sc_uint<2> selector;
136
        selector[1] = select_crc_output;
137
        selector[0] = select_nop_crc_output;
138
 
139
        switch(selector){
140
        case 2:
141
                fc_dword_lk = crc_output.read();
142
                break;
143
        case 1:
144
                fc_dword_lk = nop_crc_output.read();
145
                break;
146
        default:
147
                fc_dword_lk = registered_output;
148
        }
149
#else
150
        fc_dword_lk = registered_output;
151
#endif
152
 
153
}
154
 
155
 
156
 
157
 
158
 

powered by: WebSVN 2.1.0

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