object.cc (12988:df70e73818e4) object.cc (13045:ccedccd0d93d)
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

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

73
74Object::Object(sc_core::sc_object *_sc_obj, const char *obj_name) :
75 _sc_obj(_sc_obj), _basename(obj_name), parent(nullptr)
76{
77 if (_basename == "")
78 _basename = "object";
79
80 Module *p = currentModule();
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

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

73
74Object::Object(sc_core::sc_object *_sc_obj, const char *obj_name) :
75 _sc_obj(_sc_obj), _basename(obj_name), parent(nullptr)
76{
77 if (_basename == "")
78 _basename = "object";
79
80 Module *p = currentModule();
81 if (!p)
82 p = callbackModule();
81
82 Module *n = newModule();
83 if (n) {
84 // We are a module in the process of being constructed.
85 n->finish(this);
86 }
87
88 if (p) {
89 // We're "within" a parent module, ie we're being created while its
83
84 Module *n = newModule();
85 if (n) {
86 // We are a module in the process of being constructed.
87 n->finish(this);
88 }
89
90 if (p) {
91 // We're "within" a parent module, ie we're being created while its
90 // constructor is running.
92 // constructor or end_of_elaboration callback is running.
91 parent = p->obj()->_sc_obj;
92 addObject(&parent->_gem5_object->children, _sc_obj);
93 } else if (scheduler.current()) {
94 // Our parent is the currently running process.
95 parent = scheduler.current();
96 } else {
97 // We're a top level object.
98 addObject(&topLevelObjects, _sc_obj);

--- 162 unchanged lines hidden ---
93 parent = p->obj()->_sc_obj;
94 addObject(&parent->_gem5_object->children, _sc_obj);
95 } else if (scheduler.current()) {
96 // Our parent is the currently running process.
97 parent = scheduler.current();
98 } else {
99 // We're a top level object.
100 addObject(&topLevelObjects, _sc_obj);

--- 162 unchanged lines hidden ---