summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/kernel/sc_module/test09
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/kernel/sc_module/test09')
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log124
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp106
2 files changed, 230 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log b/src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log
new file mode 100644
index 000000000..f428ebc24
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test09/golden/test09.log
@@ -0,0 +1,124 @@
+SystemC Simulation
+0 s: ModuleBase
+0 s: NonModuleDerived
+0 s: ModuleDerived
+0 s: NonModuleDerived
+0 s: ModuleBase
+0 s: ModuleDerived
+500 ps: NonModuleDerived
+500 ps: ModuleBase
+500 ps: ModuleDerived
+1 ns: NonModuleDerived
+1 ns: ModuleBase
+1 ns: ModuleDerived
+1500 ps: NonModuleDerived
+1500 ps: ModuleBase
+1500 ps: ModuleDerived
+2 ns: NonModuleDerived
+2 ns: ModuleBase
+2 ns: ModuleDerived
+2500 ps: NonModuleDerived
+2500 ps: ModuleBase
+2500 ps: ModuleDerived
+3 ns: NonModuleDerived
+3 ns: ModuleBase
+3 ns: ModuleDerived
+3500 ps: NonModuleDerived
+3500 ps: ModuleBase
+3500 ps: ModuleDerived
+4 ns: NonModuleDerived
+4 ns: ModuleBase
+4 ns: ModuleDerived
+4500 ps: NonModuleDerived
+4500 ps: ModuleBase
+4500 ps: ModuleDerived
+5 ns: NonModuleDerived
+5 ns: ModuleBase
+5 ns: ModuleDerived
+5500 ps: NonModuleDerived
+5500 ps: ModuleBase
+5500 ps: ModuleDerived
+6 ns: NonModuleDerived
+6 ns: ModuleBase
+6 ns: ModuleDerived
+6500 ps: NonModuleDerived
+6500 ps: ModuleBase
+6500 ps: ModuleDerived
+7 ns: NonModuleDerived
+7 ns: ModuleBase
+7 ns: ModuleDerived
+7500 ps: NonModuleDerived
+7500 ps: ModuleBase
+7500 ps: ModuleDerived
+8 ns: NonModuleDerived
+8 ns: ModuleBase
+8 ns: ModuleDerived
+8500 ps: NonModuleDerived
+8500 ps: ModuleBase
+8500 ps: ModuleDerived
+9 ns: NonModuleDerived
+9 ns: ModuleBase
+9 ns: ModuleDerived
+9500 ps: NonModuleDerived
+9500 ps: ModuleBase
+9500 ps: ModuleDerived
+10 ns: NonModuleDerived
+10 ns: ModuleBase
+10 ns: ModuleDerived
+10500 ps: NonModuleDerived
+10500 ps: ModuleBase
+10500 ps: ModuleDerived
+11 ns: NonModuleDerived
+11 ns: ModuleBase
+11 ns: ModuleDerived
+11500 ps: NonModuleDerived
+11500 ps: ModuleBase
+11500 ps: ModuleDerived
+12 ns: NonModuleDerived
+12 ns: ModuleBase
+12 ns: ModuleDerived
+12500 ps: NonModuleDerived
+12500 ps: ModuleBase
+12500 ps: ModuleDerived
+13 ns: NonModuleDerived
+13 ns: ModuleBase
+13 ns: ModuleDerived
+13500 ps: NonModuleDerived
+13500 ps: ModuleBase
+13500 ps: ModuleDerived
+14 ns: NonModuleDerived
+14 ns: ModuleBase
+14 ns: ModuleDerived
+14500 ps: NonModuleDerived
+14500 ps: ModuleBase
+14500 ps: ModuleDerived
+15 ns: NonModuleDerived
+15 ns: ModuleBase
+15 ns: ModuleDerived
+15500 ps: NonModuleDerived
+15500 ps: ModuleBase
+15500 ps: ModuleDerived
+16 ns: NonModuleDerived
+16 ns: ModuleBase
+16 ns: ModuleDerived
+16500 ps: NonModuleDerived
+16500 ps: ModuleBase
+16500 ps: ModuleDerived
+17 ns: NonModuleDerived
+17 ns: ModuleBase
+17 ns: ModuleDerived
+17500 ps: NonModuleDerived
+17500 ps: ModuleBase
+17500 ps: ModuleDerived
+18 ns: NonModuleDerived
+18 ns: ModuleBase
+18 ns: ModuleDerived
+18500 ps: NonModuleDerived
+18500 ps: ModuleBase
+18500 ps: ModuleDerived
+19 ns: NonModuleDerived
+19 ns: ModuleBase
+19 ns: ModuleDerived
+19500 ps: NonModuleDerived
+19500 ps: ModuleBase
+19500 ps: ModuleDerived
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp b/src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp
new file mode 100644
index 000000000..a0f1b1b74
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test09/test09.cpp
@@ -0,0 +1,106 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test09.cpp -- Test derivation from and to sc_module instances.
+
+ Original Author: Andy Goodrich, Forte Design Systemc, Inc. 2003-10-01
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+// sc_module ---> non-sc_module
+
+SC_MODULE(ModuleBase)
+{
+ public:
+ SC_CTOR(ModuleBase)
+ {
+ }
+ void base_method()
+ {
+ cout << sc_time_stamp() << ": ModuleBase" << endl;
+ }
+ sc_in_clk m_clk;
+};
+
+class NonModuleDerived : public ModuleBase
+{
+ public:
+ SC_HAS_PROCESS(NonModuleDerived);
+ NonModuleDerived(sc_module_name name_) : ModuleBase(name_)
+ {
+ SC_METHOD(base_method)
+ sensitive << m_clk;
+ SC_METHOD(derived_method)
+ sensitive << m_clk;
+ }
+ void derived_method()
+ {
+ cout << sc_time_stamp() << ": NonModuleDerived" << endl;
+ }
+};
+
+// non-sc_module ---> sc_module
+
+class NonModuleBase
+{
+ public:
+ sc_in_clk m_clk;
+};
+
+SC_MODULE(ModuleDerived), public NonModuleBase
+{
+ SC_CTOR(ModuleDerived) : NonModuleBase()
+ {
+ SC_METHOD(derived_method)
+ sensitive << m_clk;
+ }
+ void derived_method()
+ {
+ cout << sc_time_stamp() << ": ModuleDerived" << endl;
+ }
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ NonModuleDerived non_derived("nonderived");
+ ModuleDerived derived("derived");
+ non_derived.m_clk(clock);
+ derived.m_clk(clock);
+
+ sc_start(20, SC_NS);
+ return 0;
+}
+
+
+