summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/kernel/sc_module
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/kernel/sc_module')
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log1
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp179
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log11
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp179
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log1
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp179
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log18
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp105
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log34
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp143
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log5
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp60
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log7
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp55
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log4
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp53
-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
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log6
-rw-r--r--src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp72
20 files changed, 1342 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test01/golden/test01.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp b/src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp
new file mode 100644
index 000000000..156ada47f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test01/test01.cpp
@@ -0,0 +1,179 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test01.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of positional binding
+
+#include "systemc.h"
+
+template <class T>
+SC_MODULE( prim_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ SC_CTOR( prim_source ) {}
+};
+
+template <class T>
+SC_MODULE( prim_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+
+ SC_CTOR( prim_transfer ) {}
+};
+
+template <class T>
+SC_MODULE( prim_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ SC_CTOR( prim_sink ) {}
+};
+
+template <class T>
+SC_MODULE( hier_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_source<T> prim_source1;
+
+ SC_CTOR( hier_source )
+ : prim_source1( "prim_source1" )
+ {
+ prim_source1( out, port_out);
+ }
+};
+
+template <class T>
+SC_MODULE( hier_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_transfer<T> prim_transfer1;
+
+ SC_CTOR( hier_transfer )
+ : prim_transfer1( "prim_transfer1" )
+ {
+ prim_transfer1( in, port_in, out, port_out);
+ }
+};
+
+template <class T>
+SC_MODULE( hier_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier_sink )
+ : prim_sink1( "prim_sink1" )
+ {
+ prim_sink1( in, port_in );
+ }
+};
+
+template <class T>
+SC_MODULE( hier1 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ prim_source<T> prim_source1;
+ prim_transfer<T> prim_transfer1;
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier1 )
+ : prim_source1( "prim_source1" ),
+ prim_transfer1( "prim_transfer1" ),
+ prim_sink1( "prim_sink1" )
+ {
+ prim_source1( sig1, sig2);
+ prim_transfer1( sig1, sig2, sig3, sig4);
+ prim_sink1( sig3, sig4);
+ }
+};
+
+template <class T>
+SC_MODULE( hier2 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ hier_source<T> hier_source1;
+ hier_transfer<T> hier_transfer1;
+ hier_sink<T> hier_sink1;
+
+ SC_CTOR( hier2 )
+ : hier_source1( "hier_source1" ),
+ hier_transfer1( "hier_transfer1" ),
+ hier_sink1( "hier_sink1" )
+ {
+ hier_source1( sig1, sig2);
+ hier_transfer1( sig1, sig2, sig3, sig4);
+ hier_sink1( sig3, sig4);
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ hier1<int> hier1_int( "hier1_int" );
+ hier1<bool> hier1_bool( "hier1_bool" );
+ hier1<sc_logic> hier1_logic( "hier1_logic" );
+
+ hier2<int> hier2_int( "hier2_int" );
+ hier2<bool> hier2_bool( "hier2_bool" );
+ hier2<sc_logic> hier2_logic( "hier2_logic" );
+
+ sc_start(0, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log
new file mode 100644
index 000000000..642bb49f7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test02/golden/test02.log
@@ -0,0 +1,11 @@
+SystemC Simulation
+
+Info: (I804) /IEEE_Std_1666/deprecated: positional binding using << or , is deprecated, use () instead.
+
+Info: (I804) /IEEE_Std_1666/deprecated: You can turn off warnings about
+ IEEE 1666 deprecated features by placing this method call
+ as the first statement in your sc_main() function:
+
+ sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated",
+ sc_core::SC_DO_NOTHING );
+
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp b/src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp
new file mode 100644
index 000000000..8ff9f9072
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test02/test02.cpp
@@ -0,0 +1,179 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test02.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of positional binding -- general test of operator ,
+
+#include "systemc.h"
+
+template <class T>
+SC_MODULE( prim_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ SC_CTOR( prim_source ) {}
+};
+
+template <class T>
+SC_MODULE( prim_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+
+ SC_CTOR( prim_transfer ) {}
+};
+
+template <class T>
+SC_MODULE( prim_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ SC_CTOR( prim_sink ) {}
+};
+
+template <class T>
+SC_MODULE( hier_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_source<T> prim_source1;
+
+ SC_CTOR( hier_source )
+ : prim_source1( "prim_source1" )
+ {
+ prim_source1, out, port_out;
+ }
+};
+
+template <class T>
+SC_MODULE( hier_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_transfer<T> prim_transfer1;
+
+ SC_CTOR( hier_transfer )
+ : prim_transfer1( "prim_transfer1" )
+ {
+ prim_transfer1, in, port_in, out, port_out;
+ }
+};
+
+template <class T>
+SC_MODULE( hier_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier_sink )
+ : prim_sink1( "prim_sink1" )
+ {
+ prim_sink1, in, port_in;
+ }
+};
+
+template <class T>
+SC_MODULE( hier1 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ prim_source<T> prim_source1;
+ prim_transfer<T> prim_transfer1;
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier1 )
+ : prim_source1( "prim_source1" ),
+ prim_transfer1( "prim_transfer1" ),
+ prim_sink1( "prim_sink1" )
+ {
+ prim_source1, sig1, sig2;
+ prim_transfer1, sig1, sig2, sig3, sig4;
+ prim_sink1, sig3, sig4;
+ }
+};
+
+template <class T>
+SC_MODULE( hier2 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ hier_source<T> hier_source1;
+ hier_transfer<T> hier_transfer1;
+ hier_sink<T> hier_sink1;
+
+ SC_CTOR( hier2 )
+ : hier_source1( "hier_source1" ),
+ hier_transfer1( "hier_transfer1" ),
+ hier_sink1( "hier_sink1" )
+ {
+ hier_source1, sig1, sig2;
+ hier_transfer1, sig1, sig2, sig3, sig4;
+ hier_sink1, sig3, sig4;
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ hier1<int> hier1_int( "hier1_int" );
+ hier1<bool> hier1_bool( "hier1_bool" );
+ hier1<sc_logic> hier1_logic( "hier1_logic" );
+
+ hier2<int> hier2_int( "hier2_int" );
+ hier2<bool> hier2_bool( "hier2_bool" );
+ hier2<sc_logic> hier2_logic( "hier2_logic" );
+
+ sc_start(0, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test03/golden/test03.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp b/src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp
new file mode 100644
index 000000000..e6c34483d
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test03/test03.cpp
@@ -0,0 +1,179 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test03.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of positional binding -- general test of operator ()
+
+#include "systemc.h"
+
+template <class T>
+SC_MODULE( prim_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ SC_CTOR( prim_source ) {}
+};
+
+template <class T>
+SC_MODULE( prim_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+
+ SC_CTOR( prim_transfer ) {}
+};
+
+template <class T>
+SC_MODULE( prim_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ SC_CTOR( prim_sink ) {}
+};
+
+template <class T>
+SC_MODULE( hier_source )
+{
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_source<T> prim_source1;
+
+ SC_CTOR( hier_source )
+ : prim_source1( "prim_source1" )
+ {
+ prim_source1( out, port_out );
+ }
+};
+
+template <class T>
+SC_MODULE( hier_transfer )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+ sc_out<T> out;
+ sc_port<sc_signal_out_if<T> > port_out;
+
+ prim_transfer<T> prim_transfer1;
+
+ SC_CTOR( hier_transfer )
+ : prim_transfer1( "prim_transfer1" )
+ {
+ prim_transfer1( in, port_in, out, port_out );
+ }
+};
+
+template <class T>
+SC_MODULE( hier_sink )
+{
+ sc_in<T> in;
+ sc_port<sc_signal_in_if<T> > port_in;
+
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier_sink )
+ : prim_sink1( "prim_sink1" )
+ {
+ prim_sink1( in, port_in );
+ }
+};
+
+template <class T>
+SC_MODULE( hier1 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ prim_source<T> prim_source1;
+ prim_transfer<T> prim_transfer1;
+ prim_sink<T> prim_sink1;
+
+ SC_CTOR( hier1 )
+ : prim_source1( "prim_source1" ),
+ prim_transfer1( "prim_transfer1" ),
+ prim_sink1( "prim_sink1" )
+ {
+ prim_source1( sig1, sig2 );
+ prim_transfer1( sig1, sig2, sig3, sig4 );
+ prim_sink1( sig3, sig4 );
+ }
+};
+
+template <class T>
+SC_MODULE( hier2 )
+{
+ sc_signal<T> sig1;
+ sc_signal<T> sig2;
+ sc_signal<T> sig3;
+ sc_signal<T> sig4;
+
+ hier_source<T> hier_source1;
+ hier_transfer<T> hier_transfer1;
+ hier_sink<T> hier_sink1;
+
+ SC_CTOR( hier2 )
+ : hier_source1( "hier_source1" ),
+ hier_transfer1( "hier_transfer1" ),
+ hier_sink1( "hier_sink1" )
+ {
+ hier_source1( sig1, sig2 );
+ hier_transfer1( sig1, sig2, sig3, sig4 );
+ hier_sink1( sig3, sig4 );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ hier1<int> hier1_int( "hier1_int" );
+ hier1<bool> hier1_bool( "hier1_bool" );
+ hier1<sc_logic> hier1_logic( "hier1_logic" );
+
+ hier2<int> hier2_int( "hier2_int" );
+ hier2<bool> hier2_bool( "hier2_bool" );
+ hier2<sc_logic> hier2_logic( "hier2_logic" );
+
+ sc_start(0, SC_NS);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log
new file mode 100644
index 000000000..17539c402
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test04/golden/test04.log
@@ -0,0 +1,18 @@
+SystemC Simulation
+signal_0
+signal_1
+a
+b
+c
+a.port_0
+a.port_1
+b.port_0
+b.port_1
+c.a
+c.b
+c.signal_0
+c.signal_1
+c.a.port_0
+c.a.port_1
+c.b.port_0
+c.b.port_1
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp b/src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp
new file mode 100644
index 000000000..14b7970c7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test04/test04.cpp
@@ -0,0 +1,105 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test04.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of the unique name generation for objects
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in<int> in;
+ sc_out<int> out;
+ SC_CTOR( mod_a ) {}
+};
+
+SC_MODULE( mod_b )
+{
+ sc_out<int> out;
+ sc_in<int> in;
+ SC_CTOR( mod_b ) {}
+};
+
+SC_MODULE( mod_c )
+{
+ mod_a a;
+ mod_b b;
+ sc_signal<int> sig1;
+ sc_signal<int> sig2;
+ SC_CTOR( mod_c ) : a("a"), b("b")
+ {
+ a.in( sig1 );
+ a.out( sig2 );
+ b.out( sig1 );
+ b.in( sig2 );
+ }
+};
+
+int
+sc_main( int, char*[] )
+{
+ sc_signal<int> sig1;
+ sc_signal<int> sig2;
+ mod_a a("a");
+ mod_b b("b");
+ mod_c c("c");
+ a.in( sig1 );
+ a.out( sig2 );
+ b.out( sig1 );
+ b.in( sig2 );
+
+ sc_start(0, SC_NS);
+
+ cout << sig1.name() << endl;
+ cout << sig2.name() << endl;
+ cout << a.name() << endl;
+ cout << b.name() << endl;
+ cout << c.name() << endl;
+ cout << a.in.name() << endl;
+ cout << a.out.name() << endl;
+ cout << b.out.name() << endl;
+ cout << b.in.name() << endl;
+ cout << c.a.name() << endl;
+ cout << c.b.name() << endl;
+ cout << c.sig1.name() << endl;
+ cout << c.sig2.name() << endl;
+ cout << c.a.in.name() << endl;
+ cout << c.a.out.name() << endl;
+ cout << c.b.out.name() << endl;
+ cout << c.b.in.name() << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log
new file mode 100644
index 000000000..d923779ad
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test05/golden/test05.log
@@ -0,0 +1,34 @@
+SystemC Simulation
+1
+1
+2
+2
+500 ps
+***
+sc_module a
+sc_module b
+sc_clock clock_0
+sc_signal signal_0
+sc_module c
+sc_method_process clock_0_posedge_action_0
+sc_method_process clock_0_negedge_action_0
+***
+sc_in a.port_0
+sc_out a.port_1
+sc_method_process a.main_action
+***
+sc_in b.port_0
+sc_thread_process b.main_action
+***
+sc_in c.port_0
+sc_module c.a
+sc_module c.b
+sc_signal c.signal_0
+sc_cthread_process c.main_action
+***
+sc_in c.a.port_0
+sc_out c.a.port_1
+sc_method_process c.a.main_action
+***
+sc_in c.b.port_0
+sc_thread_process c.b.main_action
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp b/src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp
new file mode 100644
index 000000000..8bdad10ea
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test05/test05.cpp
@@ -0,0 +1,143 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test05.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of the child objects of a module and the simcontext
+
+#include "systemc.h"
+
+SC_MODULE( mod_a )
+{
+ sc_in_clk clk;
+ sc_out<int> out;
+
+ int a;
+
+ void main_action()
+ {
+ out = ++ a;
+ }
+
+ SC_CTOR( mod_a )
+ {
+ SC_METHOD( main_action );
+ sensitive << clk.pos();
+ a = 0;
+ }
+};
+
+SC_MODULE( mod_b )
+{
+ sc_in<int> in;
+
+ void main_action()
+ {
+ while( true ) {
+ wait();
+ cout << in.read() << endl;
+ }
+ }
+
+ SC_CTOR( mod_b )
+ {
+ SC_THREAD( main_action );
+ sensitive << in;
+ }
+};
+
+SC_MODULE( mod_c )
+{
+ sc_in_clk clk;
+
+ void main_action()
+ {
+ while( true ) {
+ cout << sc_time_stamp() << endl;
+ wait();
+ }
+ }
+
+ mod_a a;
+ mod_b b;
+ sc_signal<int> sig;
+
+ SC_CTOR( mod_c )
+ : a( "a" ), b( "b" )
+ {
+ SC_CTHREAD( main_action, clk.neg() );
+ a.clk( clk );
+ a.out( sig );
+ b.in( sig );
+ }
+};
+
+void
+print_child_objects( const ::std::vector<sc_object*>& child_objects_ )
+{
+ int size = child_objects_.size();
+ cout << "***\n";
+ for( int i = 0; i < size; ++ i ) {
+ sc_object* object = child_objects_[i];
+ cout << object->kind() << " " << object->name() << endl;
+ }
+}
+
+int
+sc_main( int, char*[] )
+{
+ mod_a a( "a" );
+ mod_b b( "b" );
+ sc_clock clk;
+ sc_signal<int> sig;
+
+ a.clk( clk );
+ a.out( sig );
+ b.in( sig );
+
+ mod_c c( "c" );
+ c.clk( clk );
+
+ sc_start(1, SC_NS);
+
+ print_child_objects( sc_get_top_level_objects() );
+ print_child_objects( a.get_child_objects() );
+ print_child_objects( b.get_child_objects() );
+ print_child_objects( c.get_child_objects() );
+ print_child_objects( c.a.get_child_objects() );
+ print_child_objects( c.b.get_child_objects() );
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log b/src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log
new file mode 100644
index 000000000..015bf7741
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test06/golden/test06.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+Warning: (W569) sc_module(const char*), sc_module(const std::string&) have been deprecated, use sc_module(const sc_module_name&): module_a
+In file: <removed by verify.pl>
+module_a
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp b/src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp
new file mode 100644
index 000000000..9abf0ea0b
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test06/test06.cpp
@@ -0,0 +1,60 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test06.cpp --
+
+ Original Author: Ucar Aziz, Synopsys, Inc., 2002-02-15
+ Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of the sc_module::sc_module(const std::string&)
+
+#include "systemc.h"
+
+
+SC_MODULE( mod_a )
+{
+
+ mod_a(const std::string &m) : sc_module(m)
+ { end_module(); }
+
+};
+
+
+int
+sc_main( int, char*[] )
+{
+ const std::string nm = "module_a";
+ mod_a a(nm );
+ cout<<a.name()<<endl;;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log b/src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log
new file mode 100644
index 000000000..03a39e2a6
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test07/golden/test07.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+
+Warning: (W569) sc_module(const char*), sc_module(const std::string&) have been deprecated, use sc_module(const sc_module_name&): m
+In file: <removed by verify.pl>
+
+Warning: (W509) module construction not properly completed: did you forget to add a sc_module_name parameter to your module constructor?: module 'm'
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp b/src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp
new file mode 100644
index 000000000..f6ed8aa54
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test07/test07.cpp
@@ -0,0 +1,55 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test07.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-03-22
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of missing sc_module_name ctor parameter warning
+
+#include "systemc.h"
+
+SC_MODULE( my_mod )
+{
+ my_mod( const char* nm ) : sc_module( nm ) {}
+};
+
+int
+sc_main( int, char*[] )
+{
+ my_mod m( "m" );
+
+ sc_start();
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log b/src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log
new file mode 100644
index 000000000..be94b9e0f
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test08/golden/test08.log
@@ -0,0 +1,4 @@
+SystemC Simulation
+
+Error: (E533) module name stack is empty: did you forget to add a sc_module_name parameter to your module constructor?
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp b/src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp
new file mode 100644
index 000000000..cea5c11d7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test08/test08.cpp
@@ -0,0 +1,53 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test08.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-03-22
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// test of missing sc_module_name ctor parameter error
+
+#include "systemc.h"
+
+SC_MODULE( my_mod )
+{
+ my_mod() {}
+};
+
+int
+sc_main( int, char*[] )
+{
+ my_mod m;
+
+ return 0;
+}
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;
+}
+
+
+
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log b/src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log
new file mode 100644
index 000000000..9f139851e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test10/golden/test10.log
@@ -0,0 +1,6 @@
+SystemC Simulation
+0 s
+0 s
+500 ps
+1 ns
+1500 ps
diff --git a/src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp b/src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp
new file mode 100644
index 000000000..87716b7fb
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/sc_module/test10/test10.cpp
@@ -0,0 +1,72 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test10.cpp -- Test sc_module::set_stack_size
+
+ Original Author: Andy Goodrich, Forte Design Systemc, Inc. 2003-10-13
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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(A)
+{
+ SC_CTOR(A)
+ {
+ SC_THREAD(thread);
+ sensitive << m_clk;
+ set_stack_size(0x600000);
+ }
+ void thread()
+ {
+ int x[0x100000]; // Grab a lot of stack...
+ x[0x100000-1] = 42; // ... and then modify the last location`
+
+ for (;;)
+ {
+ cout << sc_time_stamp() << endl;
+ wait();
+ }
+ }
+ sc_in_clk m_clk;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ A a("a");
+ a.m_clk(clock);
+
+ sc_start(2, SC_NS);
+
+ return 0;
+}