@@ -92,17 +92,122 @@ void Chipper::Display( ostream & os ) const
92
92
os << " Nothing to display" << endl; // Ameya: Just for sake of avoiding pure virual func
93
93
}
94
94
95
- void Chipper::ReadInputs ()
95
+ void Chipper::ReadInputs () // HH : Performs the function of reading flits from channel into input buffer
96
96
{
97
- cout << " Nothing to display " << endl; // Ameya: Just for sake of avoiding pure virual func
97
+ // HH : Receiving flits from channel into input buffer, no credits received, as in event_router
98
98
}
99
99
100
- void Chipper::WriteOutputs ()
100
+ // HH Definition of _ReceiveFlits: inserts flit into buffer from channel corresponding to current sim time
101
+ int Chipper::_IncomingFlits ( )
101
102
{
102
- cout << " Nothing to display" << endl; // Ameya: Just for sake of avoiding pure virual func
103
+ Flit *f;
104
+ map< int ,Flit* > buffer_timed;
105
+ receive_time = GetSimTime ();
106
+ for ( int input = 0 ; input < _inputs; ++input ) {
107
+ f = _input_channels[input]->Receive ();
108
+ if ( f ) {
109
+ _input_buffer[input].insert ( pair (receive_time,f) );
110
+ }
111
+ }
103
112
}
104
113
105
- void Chipper::_InternalStep ()
114
+ void Chipper::WriteOutputs () // HH : Performs the function of sending flits from output buffer into channel
106
115
{
107
- cout << " Nothing to display" << endl; // Ameya: Just for sake of avoiding pure virual func
108
- }
116
+ _SendFlits ( ); // HH : Sending flits from output buffer into input channel, no credits sent, as in event_router
117
+ }
118
+
119
+ // HH Definition of _Sendflits in Chipper class same as that in class event_router
120
+ void Chipper::_SendFlits ( int pair_time)
121
+ {
122
+ map<int ,Flit*> buffer_timed;
123
+ Flit *f;
124
+ for ( int output = 0 ; output < _outputs; ++output ) {
125
+ // if ( !_output_buffer[output].empty( ) ) {
126
+ // Flit *f = _output_buffer[output].front( );
127
+ // _output_buffer[output].pop( );
128
+ // _output_channels[output]->Send( f );
129
+ buffer_timed = _output_buffer.back ;
130
+ f = buffer_timed.find ( pair_time);
131
+ if (f){
132
+ _output_channels[output]->Send ( f );
133
+ }
134
+ }
135
+ }
136
+
137
+ void Chipper::_InternalStep ( )
138
+ {
139
+ // Receive incoming flits
140
+ int pair_time = _IncomingFlits ( );
141
+ // HH : Need to make the time the flits are received global in order to know when the input flits were
142
+ // were paired into the map
143
+ // Have to pass this onto subsequent functions to find the correct flit from each buffer
144
+ // I am thinking pair_time should be updated at each stage with GetSimTime and then passed onto next stage
145
+ // Eject flits which have reached their desitnation
146
+ _EjectFlits ();
147
+
148
+ _Buffer_to_stage1 ();
149
+
150
+ _stage1_to_stage2 ();
151
+
152
+
153
+
154
+ }
155
+
156
+ // Added by HH
157
+ void _EjectFlits (){
158
+ Flit *f;
159
+
160
+ for ( int input = 0 ; input < _inputs; ++input ) {
161
+ // f = _input_buffer[input].pop;
162
+
163
+ if ( f->dest == GetID () ) {
164
+ ;
165
+ }
166
+ else if {
167
+
168
+ }
169
+ else
170
+ }
171
+ }
172
+
173
+ void Chipper::_Buffer_to_stage1 ()
174
+ {
175
+ map<int , Flit *> intermediate_1;
176
+ int input = 0 ;
177
+ for ( int input = 0 ; input < _inputs; ++input ){
178
+ intermediate = _input_buffer[input];
179
+ for ( map<int , Flit*>::iterator it = intermediate_1.begin () ; it = intermediate_1.end () ; ++it ){ // Nandan: Adding the delay associated with the pipe
180
+ if (pair_time == it->first ){
181
+ it->first = it->first + delay_pipe_1;
182
+ }
183
+ }
184
+ stage_1[input] = _input_buffer[input];
185
+ }
186
+ }
187
+
188
+ void Chipper::_stage1_to_stage2 ()
189
+ {
190
+ msp<int , Flit *> intermediate_2;
191
+ int input = 0 ;
192
+ for ( int input = 0 ; input < _inputs; ++input ){ // Nandan: Adding the delay associated with the pipe
193
+ intermediate = _stage_1[input];
194
+ for ( map<int , Flit*>::iterator it = intermediate_2.begin () ; it = intermediate_2.end () ; ++it ){
195
+ if (pair_time == it->first ){
196
+ it->first = it->first + delay_pipe_2;
197
+ }
198
+ }
199
+ stage_2[input] = _stage_1[input];
200
+ }
201
+ }
202
+ // Added by HH : scheme for determining Golden_packet as in chipper paper(not exactly)
203
+ // Returning the packet id that is to be made golden by just dividing time_elapsed by L instead of
204
+ // keeping track of all the packets in the network. (I don't know if a maximum number of packets is available)
205
+ // Instead of iterating over all possible packet ids called "transaction ids" from all nodes, just iterate over
206
+ // packet ids which uniquely identifies each packet
207
+ int Chipper::Golden_Packet (int L) // Parameter L is obtained from before from another function
208
+ {
209
+ int time_elapsed = GetSimTime ();
210
+ int epoch_no = time_elapsed/L; // L is the golden epoch, needs to be defined as the upper
211
+ // bound of the maximum time taken by a golden packet to reach its destination
212
+ return epoch_no;
213
+ }
0 commit comments