Deleted Added
sdiff udiff text old ( 6999:f226c098c393 ) new ( 7002:48a19d52d939 )
full compact
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 182 unchanged lines hidden (view full) ---

191 *
192 * Auto generated C++ code started by $__file__:$__line__
193 * Created by slicc definition of Module "${{self.short}}"
194 */
195
196#ifndef ${ident}_CONTROLLER_H
197#define ${ident}_CONTROLLER_H
198
199#include "params/$c_ident.hh"
200
201#include "mem/ruby/common/Global.hh"
202#include "mem/ruby/common/Consumer.hh"
203#include "mem/ruby/slicc_interface/AbstractController.hh"
204#include "mem/protocol/TransitionResult.hh"
205#include "mem/protocol/Types.hh"
206#include "mem/protocol/${ident}_Profiler.hh"
207''')
208
209 seen_types = set()
210 for var in self.objects:
211 if var.type.ident not in seen_types and not var.type.isPrimitive:
212 code('#include "mem/protocol/${{var.type.c_ident}}.hh"')
213 seen_types.add(var.type.ident)
214
215 # for adding information to the protocol debug trace
216 code('''
217extern stringstream ${ident}_transitionComment;
218
219class $c_ident : public AbstractController {
220#ifdef CHECK_COHERENCE
221#endif /* CHECK_COHERENCE */
222public:
223 typedef ${c_ident}Params Params;
224 $c_ident(const Params *p);
225 static int getNumControllers();
226 void init();
227 MessageBuffer* getMandatoryQueue() const;
228 const int & getVersion() const;
229 const string toString() const;
230 const string getName() const;
231 const MachineType getMachineType() const;
232 void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
233 void print(ostream& out) const;
234 void printConfig(ostream& out) const;
235 void wakeup();
236 void printStats(ostream& out) const;
237 void clearStats();
238 void blockOnQueue(Address addr, MessageBuffer* port);
239 void unblock(Address addr);
240private:
241''')
242
243 code.indent()
244 # added by SS
245 for param in self.config_parameters:
246 if param.pointer:
247 code('${{param.type_ast.type}}* m_${{param.ident}}_ptr;')
248 else:
249 code('${{param.type_ast.type}} m_${{param.ident}};')
250
251 code('''
252int m_number_of_TBEs;
253
254TransitionResult doTransition(${ident}_Event event, ${ident}_State state, const Address& addr); // in ${ident}_Transitions.cc
255TransitionResult doTransitionWorker(${ident}_Event event, ${ident}_State state, ${ident}_State& next_state, const Address& addr); // in ${ident}_Transitions.cc
256string m_name;
257int m_transitions_per_cycle;
258int m_buffer_size;
259int m_recycle_latency;
260map< string, string > m_cfg;
261NodeID m_version;
262Network* m_net_ptr;
263MachineID m_machineID;
264bool m_is_blocking;
265map< Address, MessageBuffer* > m_block_map;
266${ident}_Profiler s_profiler;
267static int m_num_controllers;
268// Internal functions

--- 38 unchanged lines hidden (view full) ---

307
308 code('''
309/** \\file $ident.cc
310 *
311 * Auto generated C++ code started by $__file__:$__line__
312 * Created by slicc definition of Module "${{self.short}}"
313 */
314
315#include "mem/ruby/common/Global.hh"
316#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
317#include "mem/protocol/${ident}_Controller.hh"
318#include "mem/protocol/${ident}_State.hh"
319#include "mem/protocol/${ident}_Event.hh"
320#include "mem/protocol/Types.hh"
321#include "mem/ruby/system/System.hh"
322''')
323
324 # include object classes
325 seen_types = set()
326 for var in self.objects:
327 if var.type.ident not in seen_types and not var.type.isPrimitive:
328 code('#include "mem/protocol/${{var.type.c_ident}}.hh"')
329 seen_types.add(var.type.ident)

--- 528 unchanged lines hidden (view full) ---

858
859 code('''
860// Auto generated C++ code started by $__file__:$__line__
861// ${ident}: ${{self.short}}
862
863#ifndef ${ident}_PROFILER_H
864#define ${ident}_PROFILER_H
865
866#include "mem/ruby/common/Global.hh"
867#include "mem/protocol/${ident}_State.hh"
868#include "mem/protocol/${ident}_Event.hh"
869
870class ${ident}_Profiler {
871 public:
872 ${ident}_Profiler();
873 void setVersion(int version);
874 void countTransition(${ident}_State state, ${ident}_Event event);
875 void possibleTransition(${ident}_State state, ${ident}_Event event);
876 void dumpStats(ostream& out) const;
877 void clearStats();
878
879 private:
880 int m_counters[${ident}_State_NUM][${ident}_Event_NUM];
881 int m_event_counters[${ident}_Event_NUM];
882 bool m_possible[${ident}_State_NUM][${ident}_Event_NUM];
883 int m_version;
884};

--- 45 unchanged lines hidden (view full) ---

930 assert(m_possible[state][event]);
931 m_counters[state][event]++;
932 m_event_counters[event]++;
933}
934void ${ident}_Profiler::possibleTransition(${ident}_State state, ${ident}_Event event)
935{
936 m_possible[state][event] = true;
937}
938void ${ident}_Profiler::dumpStats(ostream& out) const
939{
940 out << " --- ${ident} " << m_version << " ---" << endl;
941 out << " - Event Counts -" << endl;
942 for (int event = 0; event < ${ident}_Event_NUM; event++) {
943 int count = m_event_counters[event];
944 out << (${ident}_Event) event << " " << count << endl;
945 }
946 out << endl;
947 out << " - Transitions -" << endl;

--- 193 unchanged lines hidden ---