Deleted Added
sdiff udiff text old ( 13161:8bef8ce2784f ) new ( 13179:7445c43d036b )
full compact
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

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

105 // We're "within" a parent module, ie we're being created while its
106 // constructor or end_of_elaboration callback is running.
107 parent = p->obj()->_sc_obj;
108 } else if (scheduler.current()) {
109 // Our parent is the currently running process.
110 parent = scheduler.current();
111 }
112
113 sc_gem5::pickUniqueName(parent, _basename);
114
115 if (parent)
116 addObject(&parent->_gem5_object->children, _sc_obj);
117 else
118 addObject(&topLevelObjects, _sc_obj);
119
120 addObject(&allObjects, _sc_obj);
121
122 _name = _basename;
123 sc_core::sc_object *sc_p = parent;
124 while (sc_p) {
125 _name = std::string(sc_p->basename()) + std::string(".") + _name;
126 sc_p = sc_p->get_parent_object();
127 }
128}
129
130Object::Object(sc_core::sc_object *_sc_obj, const Object &arg) :
131 Object(_sc_obj, arg._basename.c_str())
132{}
133
134Object &
135Object::operator = (const Object &)

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

254Object::delChildEvent(sc_core::sc_event *e)
255{
256 EventsIt it = std::find(events.begin(), events.end(), e);
257 assert(it != events.end());
258 std::swap(*it, events.back());
259 events.pop_back();
260}
261
262void
263Object::pickUniqueName(std::string &base)
264{
265 std::string seed = base;
266 while (!nameIsUnique(&children, &events, base))
267 base = ::sc_core::sc_gen_unique_name(seed.c_str());
268}
269
270void
271pickUniqueName(::sc_core::sc_object *parent, std::string &base)
272{
273 if (parent) {
274 Object::getFromScObject(parent)->pickUniqueName(base);
275 return;
276 }
277
278 std::string seed = base;
279 while (!nameIsUnique(&topLevelObjects, &topLevelEvents, base))
280 base = ::sc_core::sc_gen_unique_name(seed.c_str());
281}
282
283
284Objects topLevelObjects;
285Objects allObjects;
286
287const std::vector<sc_core::sc_object *> &
288getTopLevelScObjects()

--- 12 unchanged lines hidden ---