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

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [trunk/] [rtl/] [systemc/] [reordering_l2/] [fetch_packet_l3.h] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 acastong
//fetch_packet_l3.h
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is HyperTransport Tunnel IP Core.
16
 *
17
 * The Initial Developer of the Original Code is
18
 * Ecole Polytechnique de Montreal.
19
 * Portions created by the Initial Developer are Copyright (C) 2005
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Ami Castonguay <acastong@grm.polymtl.ca>
24
 *
25
 * Alternatively, the contents of this file may be used under the terms
26
 * of the Polytechnique HyperTransport Tunnel IP Core Source Code License
27
 * (the  "PHTICSCL License", see the file PHTICSCL.txt), in which case the
28
 * provisions of PHTICSCL License are applicable instead of those
29
 * above. If you wish to allow use of your version of this file only
30
 * under the terms of the PHTICSCL License and not to allow others to use
31
 * your version of this file under the MPL, indicate your decision by
32
 * deleting the provisions above and replace them with the notice and
33
 * other provisions required by the PHTICSCL License. If you do not delete
34
 * the provisions above, a recipient may use your version of this file
35
 * under either the MPL or the PHTICSCL License."
36
 *
37
 * ***** END LICENSE BLOCK ***** */
38
 
39
#ifndef FETCH_PACKET_L3_H
40
#define FETCH_PACKET_L3_H
41
 
42
#include "../core_synth/synth_datatypes.h"
43
#include "../core_synth/constants.h"
44
 
45
///Fetches complete packets from embedded memory
46
/**
47
        @description To minimize the number of flip-flops
48
                necessary in the buffers, most of the fields of
49
                packets are stored in an embedded memory and only
50
                a pointer to that data is reorganized in the buffers.
51
 
52
                This module takes that pointer, fetches the data and
53
                reconstructs the original packet that was received
54
                by the entrance_reordering_l3 module.
55
 
56
        @author Ami Castonguay
57
 
58
*/
59
class fetch_packet_l3: public sc_module
60
{
61
public:
62
        ///////////////////////////////////
63
        // Clock and resetx
64
        ///////////////////////////////////
65
        ///System clock
66
        sc_in<bool> clk;
67
        ///System reset (active low)
68
        sc_in<bool> resetx;
69
 
70
        ///////////////////////////////////
71
        // Inputs
72
        ///////////////////////////////////
73
 
74
        ///Packet from posted buffers
75
        //@{
76
        sc_in<sc_uint<LOG2_NB_OF_BUFFERS> > posted_packet_addr[2];
77
#ifdef ENABLE_REORDERING
78
        sc_in<bool > posted_packet_passpw[2];
79
        sc_in<sc_uint<4> > posted_packet_seqid[2];
80
        sc_in<bool > posted_packet_chain[2];
81
        sc_in<sc_uint<LOG2_NB_OF_BUFFERS+1> >   posted_packet_nposted_refid[2];
82
        sc_in<sc_uint<LOG2_NB_OF_BUFFERS+1> >   posted_packet_response_refid[2];
83
#endif
84
        sc_in<bool> posted_available[2];
85
        //@}
86
 
87
        //Packet from nposted buffers
88
        //@{
89
        sc_in<sc_uint<LOG2_NB_OF_BUFFERS> > nposted_packet_addr[2];
90
#ifdef ENABLE_REORDERING
91
        sc_in<bool > nposted_packet_passpw[2];
92
        sc_in<sc_uint<4> > nposted_packet_seqid[2];
93
#endif
94
        sc_in<bool> nposted_available[2];
95
        //@}
96
 
97
        ///Packet from response buffers
98
        //@{
99
        sc_in<sc_uint<LOG2_NB_OF_BUFFERS> > response_packet_addr[2];
100
#ifdef ENABLE_REORDERING
101
        sc_in<bool > response_packet_passpw[2];
102
#endif
103
        sc_in<bool> response_available[2];
104
        //@}
105
 
106
        ///Data from memory
107
        sc_in<sc_bv<CMD_BUFFER_MEM_WIDTH> > command_packet_rd_data_ro[2];
108
 
109
        ///Packet types requested
110
        sc_in<bool> posted_requested[2];
111
        sc_in<bool> nposted_requested[2];
112
        sc_in<bool> response_requested[2];
113
 
114
        ///////////////////////////////////
115
        // Outputs
116
        ///////////////////////////////////
117
        ///If posted packets are being consumed
118
        sc_out<bool> ack_posted[2];
119
        ///If nposted packets are being consumed
120
        sc_out<bool> ack_nposted[2];
121
        ///If response packets are being consumed
122
        sc_out<bool> ack_response[2];
123
 
124
        ///Address to retrieve data from memory
125
        sc_out<sc_uint<LOG2_NB_OF_BUFFERS+2> > ro_command_packet_rd_addr[2];
126
 
127
        ///The fetched retrieved packet (for both destinations)
128
        sc_out<syn_ControlPacketComplete> fetched_packet[2];
129
        ///If there is a fetched packet available (for both destinations)
130
        sc_out<bool> fetched_packet_available[2];
131
        ///The virtual channel of the fetched packet (for both destinations)
132
        sc_out<VirtualChannel> fetched_packet_vc[2];
133
 
134
        ///The nposted refid for packet fetched  (order it arrived relative to posted packets) (for both destinations)
135
        sc_out<sc_uint<LOG2_NB_OF_BUFFERS+1> > fetched_packet_nposted_refid[2];
136
        ///The response refid for packet fetched  (order it arrived relative to posted packets) (for both destinations)
137
        sc_out<sc_uint<LOG2_NB_OF_BUFFERS+1> > fetched_packet_response_refid[2];
138
 
139
        ////////////////////////////////////
140
        // Registers
141
        ////////////////////////////////////
142
#ifdef ENABLE_REORDERING
143
        /**
144
                Selected packets are deleted in the actual buffers immediately, but the data
145
                from the memory only arrives a cycle later.  So for that cycle, packet data
146
                from the VC's are stored in registers
147
        */
148
        ///Passpw value of the packet
149
        sc_signal<bool > packet_passpw[2];
150
        ///SeqID value of the packet
151
        sc_signal<sc_uint<4> > packet_seqid[2];
152
        ///chain value of the packet
153
        sc_signal<bool > packet_chain[2];
154
#else
155
        ///If we are in the middle of a chain
156
        /** When reordering is active, the chain bit needs to be identified
157
                when it arrives in the buffers because it affects the reordering
158
                rules.  But when reordering is no activated, we can wait to
159
                calculate it until after the buffers.  Actually, it could probably
160
                be calculated even later and save a tad bit of resources, but doing
161
                it here is easy to implement and to understand.
162
 
163
                This is to know if a packet is part of a chain (produced from the
164
                chain field of the packet).
165
        */
166
        sc_signal<bool > currently_posted_chain[2];
167
#endif
168
 
169
        ///Virtual channel of the packet
170
        sc_signal<VirtualChannel> packet_vc[2];
171
        ///If there was a packet fetched of the packet
172
        sc_signal<bool> packet_fetched[2];
173
 
174
        ////////////////////////////////////
175
        // Misc signals
176
        ////////////////////////////////////
177
 
178
        ///Inter-process communication - the virtual channel of the packet selected
179
        sc_signal<VirtualChannel> selected_vc[2];
180
        ///If there was a packet that was selected
181
        sc_signal<bool> packet_selected[2];
182
 
183
        ////////////////////////////////////
184
        // Processes and consctructor
185
        ////////////////////////////////////
186
 
187
        ///Select a packet to extract from the buffers and ack it
188
        void select_and_ack_packet();
189
        ///Handle everything that is registered
190
        void register_signals();
191
        ///Once data arrives from the memory, the final packet must be reconstructed
192
        /**
193
                Some fields of packets that are sent to the virtual
194
                channels buffers (registers) because they are needed to evaluate
195
                reordering rules.  Because those bits are stored in registers, there is
196
                no need to store them in the memory too, so the position of these bits
197
                are re-used for other applications
198
        */
199
        void reconstruct_packet();
200
 
201
        ///SystemC Macro
202
        SC_HAS_PROCESS(fetch_packet_l3);
203
 
204
        ///Consctructor
205
        fetch_packet_l3(sc_module_name name);
206
 
207
#if SYSTEMC_SIM
208
        ///Destructor
209
        virtual ~fetch_packet_l3(){}
210
#endif
211
};
212
 
213
#endif
214
 

powered by: WebSVN 2.1.0

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