summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/v1.0/module_name
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/misc/v1.0/module_name')
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log161
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp228
2 files changed, 389 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log b/src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log
new file mode 100644
index 000000000..dbee91c11
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log
@@ -0,0 +1,161 @@
+SystemC Simulation
+block_f 32
+block_e 0
+tb_proc
+tb2_proc
+a = 49597
+b = 41218
+c = 760938885
+block_d 0
+block_f 33
+block_e 1
+tb_proc
+tb2_proc
+a = 20635
+b = 40894
+c = -1246516011
+block_d 1
+block_f 34
+block_e 2
+tb_proc
+tb2_proc
+a = 16767
+b = 17233
+c = -15844000
+block_d 2
+block_f 35
+block_e 3
+tb_proc
+tb2_proc
+a = 36246
+b = 28171
+c = 520167275
+block_d 3
+block_f 36
+block_e 4
+tb_proc
+tb2_proc
+a = 60879
+b = 49566
+c = 1249464285
+block_d 4
+block_f 37
+block_e 5
+tb_proc
+tb2_proc
+a = 10971
+b = 24107
+c = -460784608
+block_d 5
+block_f 38
+block_e 6
+tb_proc
+tb2_proc
+a = 30561
+b = 49648
+c = -1530949183
+block_d 6
+block_f 39
+block_e 7
+tb_proc
+tb2_proc
+a = 50031
+b = 12559
+c = -1949594816
+block_d 7
+block_f 40
+block_e 8
+tb_proc
+tb2_proc
+a = 23787
+b = 35674
+c = -706812907
+block_d 8
+block_f 41
+block_e 9
+tb_proc
+tb2_proc
+a = 43320
+b = 37558
+c = 466019036
+block_d 9
+block_f 42
+block_e 10
+tb_proc
+tb2_proc
+a = 840
+b = 18689
+c = -348573121
+block_d 10
+block_f 43
+block_e 11
+tb_proc
+tb2_proc
+a = 62466
+b = 6308
+c = -432757004
+block_d 11
+block_f 44
+block_e 12
+tb_proc
+tb2_proc
+a = 46271
+b = 49801
+c = -339134160
+block_d 12
+block_f 45
+block_e 13
+tb_proc
+tb2_proc
+a = 43433
+b = 22683
+c = 1371907000
+block_d 13
+block_f 46
+block_e 14
+tb_proc
+tb2_proc
+a = 35494
+b = 35259
+c = 16626955
+block_d 14
+block_f 47
+block_e 15
+tb_proc
+tb2_proc
+a = 29020
+b = 19555
+c = 459762375
+block_d 15
+block_f 48
+block_e 16
+tb_proc
+tb2_proc
+a = 10941
+b = 49656
+c = 1948954441
+block_d 16
+block_f 49
+block_e 17
+tb_proc
+tb2_proc
+a = 60450
+b = 27709
+c = -1408553477
+block_d 17
+block_f 50
+block_e 18
+tb_proc
+tb2_proc
+a = 1353
+b = 31160
+c = -969114991
+block_d 18
+block_f 51
+block_e 19
+tb_proc
+tb2_proc
+a = 55880
+b = 62232
+c = -750247424
+block_d 19
diff --git a/src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp b/src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp
new file mode 100644
index 000000000..3cdae1f91
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp
@@ -0,0 +1,228 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ module_name.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+int numbers[] = { 49597, 41218, 20635, 40894, 16767, 17233, 36246, 28171, 60879, 49566, 10971, 24107, 30561, 49648, 50031, 12559, 23787, 35674, 43320, 37558, 840, 18689, 62466, 6308, 46271, 49801, 43433, 22683, 35494, 35259, 29020, 19555, 10941, 49656, 60450, 27709, 1353, 31160, 55880, 62232, 15190, 1315, 20803, 45751, 50963, 5298, 58311, 9215, 2378 };
+
+int numbers_index = 0;
+
+struct example : sc_module {
+ sc_in_clk clk;
+ sc_in<int> a;
+ sc_in<int> b;
+ sc_out<int> c;
+
+ sc_signal<int> d;
+ sc_signal<int> e;
+
+ void block_a();
+ void block_b();
+ void block_c();
+ void block_d();
+ void block_e();
+ void block_f();
+
+ SC_CTOR(example)
+ {
+ SC_METHOD( block_a );
+ sensitive << a;
+ sensitive << b;
+
+ SC_METHOD( block_b );
+ sensitive << a << b;
+
+ SC_METHOD( block_c );
+ sensitive << d << e;
+
+ SC_CTHREAD( block_d, clk.neg() );
+
+ SC_CTHREAD( block_e, clk.pos() );
+
+ SC_CTHREAD( block_f, clk.pos() );
+ }
+};
+
+void
+example::block_a()
+{
+ d = a + b;
+}
+
+void
+example::block_b()
+{
+ e = a - b;
+}
+
+void
+example::block_c()
+{
+ c = d * e;
+}
+
+void
+example::block_d()
+{
+ int i = 0;
+ while (true) {
+ cout << "block_d " << i << endl;
+ i++;
+ wait();
+ }
+}
+
+void
+example::block_e()
+{
+ int i = 0;
+ while (true) {
+ cout << "block_e " << i << endl;
+ i++;
+ wait();
+ }
+}
+
+void
+example::block_f()
+{
+ int i = 32;
+ while (true) {
+ cout << "block_f " << i << endl;
+ i++;
+ wait();
+ }
+}
+
+struct tb : sc_module {
+ sc_in_clk clk;
+ sc_out<int> a;
+
+ void tb_proc();
+
+ SC_CTOR(tb)
+ {
+ SC_CTHREAD( tb_proc, clk.pos() );
+ }
+};
+
+void
+tb::tb_proc()
+{
+ while (true) {
+ a = numbers[numbers_index % (sizeof(numbers)/sizeof(numbers[0]))];
+ numbers_index++;
+ cout << "tb_proc " << endl;
+ wait();
+ }
+}
+
+struct tb2 : sc_module {
+ sc_in_clk clk;
+ sc_out<int> b;
+
+ void tb2_proc();
+
+ SC_CTOR(tb2)
+ {
+ SC_CTHREAD( tb2_proc, clk.pos() );
+ }
+};
+
+void
+tb2::tb2_proc()
+{
+ while (true) {
+ b = numbers[numbers_index % (sizeof(numbers)/sizeof(numbers[0]))];
+ numbers_index++;
+ cout << "tb2_proc " << endl;
+ wait();
+ }
+}
+
+SC_MODULE( monitor )
+{
+ SC_HAS_PROCESS( monitor );
+
+ const sc_signal<int>& a;
+ const sc_signal<int>& b;
+ const sc_signal<int>& c;
+
+ monitor( sc_module_name,
+ const sc_signal<int>& A,
+ const sc_signal<int>& B,
+ const sc_signal<int>& C ) :
+ a(A), b(B), c(C)
+ {
+ SC_METHOD( entry );
+ sensitive << a;
+ sensitive << b;
+ sensitive << c;
+ }
+ void entry();
+};
+
+void
+monitor::entry()
+{
+ if (a.event()) cout << "a = " << a << endl;
+ if (b.event()) cout << "b = " << b << endl;
+ if (c.event()) cout << "c = " << c << endl;
+}
+
+int
+sc_main( int argc, char* argv[] )
+{
+ sc_signal<int> a("a");
+ sc_signal<int> b("b");
+ sc_signal<int> c("c");
+ sc_clock clk("clk", 10, SC_NS);
+
+ example ex1("ex1");
+ ex1(clk, a, b, c);
+
+ tb tbb1("tbb1");
+ tbb1(clk, a);
+
+ tb2 tbb2("tbb2");
+ tbb2(clk, b);
+
+ monitor mon("mon", a, b, c);
+
+ sc_start(200, SC_NS);
+ return 0;
+}