module.cc (13079:e7e261dd975b) module.cc (13091:81fceed26e1e)
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

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

27 * Authors: Gabe Black
28 */
29
30#include "systemc/core/module.hh"
31
32#include <cassert>
33
34#include "base/logging.hh"
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

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

27 * Authors: Gabe Black
28 */
29
30#include "systemc/core/module.hh"
31
32#include <cassert>
33
34#include "base/logging.hh"
35#include "systemc/ext/core/sc_port.hh"
35#include "systemc/ext/utils/sc_report_handler.hh"
36
37namespace sc_gem5
38{
39
40namespace
41{
42

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

80{
81 panic_if(!_modules.size(), "Popping from empty module list.\n");
82 panic_if(_modules.back() != this,
83 "Popping module which isn't at the end of the module list.\n");
84 panic_if(_new_module, "Pop with unfinished module.\n");
85 _modules.pop_back();
86}
87
36#include "systemc/ext/utils/sc_report_handler.hh"
37
38namespace sc_gem5
39{
40
41namespace
42{
43

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

81{
82 panic_if(!_modules.size(), "Popping from empty module list.\n");
83 panic_if(_modules.back() != this,
84 "Popping module which isn't at the end of the module list.\n");
85 panic_if(_new_module, "Pop with unfinished module.\n");
86 _modules.pop_back();
87}
88
89void
90Module::bindPorts(std::vector<const ::sc_core::sc_bind_proxy *> &proxies)
91{
92 panic_if(proxies.size() > ports.size(),
93 "Trying to bind %d interfaces/ports to %d ports.\n",
94 proxies.size(), ports.size());
95
96 auto proxyIt = proxies.begin();
97 auto portIt = ports.begin();
98 for (; proxyIt != proxies.end(); proxyIt++, portIt++) {
99 auto proxy = *proxyIt;
100 auto port = *portIt;
101 if (proxy->interface())
102 port->vbind(*proxy->interface());
103 else
104 port->vbind(*proxy->port());
105 }
106}
107
88Module *
89currentModule()
90{
91 if (_modules.empty())
92 return nullptr;
93 return _modules.back();
94}
95

--- 23 unchanged lines hidden ---
108Module *
109currentModule()
110{
111 if (_modules.empty())
112 return nullptr;
113 return _modules.back();
114}
115

--- 23 unchanged lines hidden ---