summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/kernel/reset_signal_is
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/kernel/reset_signal_is')
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log8
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp106
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log10
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp84
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log9
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp80
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log10
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp84
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log63
-rw-r--r--src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp220
10 files changed, 674 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log
new file mode 100644
index 000000000..2fdc2c177
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/golden/test01.log
@@ -0,0 +1,8 @@
+SystemC Simulation
+Before start
+A: reset
+B: reset
+A: reset
+B: reset
+After reset true
+Ending
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.cpp
new file mode 100644
index 000000000..af0ca999e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test01/test01.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test01.cpp -- Test for reset_signal_is support.
+
+ Original Author: Andy Goodrich
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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_CTHREAD(test,m_clk.pos());
+ reset_signal_is( m_reset, false );
+ }
+ void test()
+ {
+ {
+ cout << "A: reset" << endl;
+ wait();
+ }
+ for (;;)
+ {
+ wait();
+ }
+ }
+ sc_in_clk m_clk;
+ sc_in<bool> m_reset;
+};
+
+SC_MODULE(B)
+{
+ B(sc_module_name name, sc_signal<bool>* reset_p ):
+ sc_module(name), m_reset_p(reset_p)
+ {
+ SC_HAS_PROCESS(B);
+ SC_CTHREAD(test,m_clk.pos());
+ reset_signal_is( *m_reset_p, false );
+ }
+ void test()
+ {
+ {
+ cout << "B: reset" << endl;
+ wait();
+ }
+ for (;;)
+ {
+ wait();
+ }
+ }
+ sc_in_clk m_clk;
+ sc_signal<bool>* m_reset_p;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clk;
+ sc_signal<bool> reset;
+ A a("a");
+ B b("b",&reset);
+
+ a.m_clk(clk);
+ a.m_reset(reset);
+ b.m_clk(clk);
+
+ cout << "Before start" << endl;
+ sc_start(2, SC_NS);
+ reset = true;
+ cout << "After reset true" << endl;
+ sc_start(3, SC_NS);
+ cout << "Ending" << endl;
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log
new file mode 100644
index 000000000..4d9276f04
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/golden/test02.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+0 s: initializing
+3 ns: waited 3
+4 ns: initializing
+7 ns: waited 3
+10 ns: waited 3
+12 ns: initializing
+15 ns: initializing
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp
new file mode 100644
index 000000000..2fc27a1f7
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test02/test02.cpp
@@ -0,0 +1,84 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() usage with SC_CTHREAD processes.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 12 August 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset,true);
+ SC_CTHREAD(resetter,m_clk.pos());
+ }
+ void cthread()
+ {
+ cout << sc_time_stamp() << ": initializing" << endl;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << ": waited 3" << endl;
+ }
+ }
+ void resetter()
+ {
+ m_reset = false;
+ wait(3);
+ m_reset = true;
+ wait(2);
+ m_reset = false;
+ wait(6);
+ m_reset = true;
+ wait(5);
+ sc_stop();
+ }
+ sc_in<bool> m_clk;
+ sc_inout<bool> m_reset;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log
new file mode 100644
index 000000000..41347fb58
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/golden/test03.log
@@ -0,0 +1,9 @@
+SystemC Simulation
+0 s: initializing
+3 ns: initializing
+6 ns: waited 3
+9 ns: waited 3
+11 ns: initializing
+14 ns: initializing
+17 ns: waited 3
+20 ns: waited 3
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp
new file mode 100644
index 000000000..e0cf86131
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test03/test03.cpp
@@ -0,0 +1,80 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() usage with SC_CTHREAD processes.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 12 August 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset,true);
+ }
+ void cthread()
+ {
+ cout << sc_time_stamp() << ": initializing" << endl;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << ": waited 3" << endl;
+ }
+ }
+ sc_in<bool> m_clk;
+ sc_in<bool> m_reset;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ reset = false;
+ sc_start(3, SC_NS);
+ reset = true;
+ sc_start(2, SC_NS);
+ reset = false;
+ sc_start(6, SC_NS);
+ reset = true;
+ sc_start(5, SC_NS);
+ reset = false;
+ sc_start(5, SC_NS);
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log
new file mode 100644
index 000000000..4d9276f04
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/golden/test04.log
@@ -0,0 +1,10 @@
+SystemC Simulation
+0 s: initializing
+3 ns: waited 3
+4 ns: initializing
+7 ns: waited 3
+10 ns: waited 3
+12 ns: initializing
+15 ns: initializing
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp
new file mode 100644
index 000000000..00b6676e2
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test04/test04.cpp
@@ -0,0 +1,84 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() with SC_CTHREAD processes and sc_out.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 12 August 2005
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ 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(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(cthread,m_clk.pos());
+ reset_signal_is(m_reset,true);
+ SC_CTHREAD(resetter,m_clk.pos());
+ }
+ void cthread()
+ {
+ cout << sc_time_stamp() << ": initializing" << endl;
+ for (;;)
+ {
+ wait(3);
+ cout << sc_time_stamp() << ": waited 3" << endl;
+ }
+ }
+ void resetter()
+ {
+ m_reset = false;
+ wait(3);
+ m_reset = true;
+ wait(2);
+ m_reset = false;
+ wait(6);
+ m_reset = true;
+ wait(5);
+ sc_stop();
+ }
+ sc_in<bool> m_clk;
+ sc_out<bool> m_reset;
+};
+
+int sc_main( int argc, char* argv[] )
+{
+ sc_clock clock;
+ DUT dut("dut");
+ sc_signal<bool> reset;
+
+ dut.m_clk(clock);
+ dut.m_reset(reset);
+
+ sc_start();
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log
new file mode 100644
index 000000000..efb2d4750
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/golden/test05.log
@@ -0,0 +1,63 @@
+SystemC Simulation
+0 s ... static method
+0 s ... static thread event wait
+0 s ... static thread timed wait
+0 s ... static thread clocked
+0 s ... static cthread
+1 ns ... dynamic method
+1 ns ... dynamic thread clocked
+1 ns ... dynamic thread event wait
+1 ns ... dynamic thread timed wait
+
+2500 ps asserting asynchronous reset
+2500 ps ... dynamic thread timed wait
+2500 ps ... dynamic thread event wait
+2500 ps ... dynamic thread clocked
+2500 ps ... static thread timed wait
+2500 ps ... static thread event wait
+2500 ps ... static thread clocked
+2500 ps ... static cthread
+3 ns ... static thread clocked
+3 ns ... static cthread
+3 ns ... dynamic thread clocked
+
+3500 ps clearing asynchronous reset
+
+5500 ps asserting synchronous reset
+6 ns ... static thread clocked
+6 ns ... static cthread
+6 ns ... dynamic thread clocked
+
+6500 ps clearing synchronous reset
+
+13500 ps asserting asynchronous reset
+13500 ps ... dynamic thread timed wait
+13500 ps ... dynamic thread event wait
+13500 ps ... dynamic thread clocked
+13500 ps ... static thread timed wait
+13500 ps ... static thread event wait
+13500 ps ... static thread clocked
+13500 ps ... static cthread
+14 ns ... static thread clocked
+14 ns ... static cthread
+14 ns ... dynamic thread clocked
+15 ns ... static thread clocked
+15 ns ... static cthread
+15 ns ... dynamic thread clocked
+
+15500 ps clearing asynchronous reset
+
+17500 ps asserting synchronous reset
+18 ns ... static thread clocked
+18 ns ... static cthread
+18 ns ... dynamic thread clocked
+19 ns ... static thread clocked
+19 ns ... static cthread
+19 ns ... dynamic thread clocked
+
+19500 ps clearing synchronous reset
+
+24500 ps terminating simulation
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+Program completed
diff --git a/src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp
new file mode 100644
index 000000000..d811a109e
--- /dev/null
+++ b/src/systemc/tests/systemc/kernel/reset_signal_is/test05/test05.cpp
@@ -0,0 +1,220 @@
+/*****************************************************************************
+
+ 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 -- Test reset_signal_is() and async_reset_signal_is() usage.
+
+ Original Author: Andy Goodrich, Forte Design Systems, 14 December 2006
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#define SC_INCLUDE_DYNAMIC_PROCESSES
+#include "systemc.h"
+
+SC_MODULE(DUT)
+{
+ SC_CTOR(DUT)
+ {
+ SC_CTHREAD(creator,m_clk.pos());
+ SC_CTHREAD(resetter,m_clk.neg());
+
+ // SET UP STATICALLY DEFINED PROCESSES:
+
+ SC_CTHREAD(static_cthread,m_clk.pos());
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ SC_METHOD(static_method);
+ reset_signal_is(m_areset,true);
+ SC_THREAD(static_thread_clocked);
+ sensitive << m_clk.pos();
+ dont_initialize();
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ SC_THREAD(static_thread_event);
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ SC_THREAD(static_thread_timed);
+ async_reset_signal_is(m_areset,true);
+ reset_signal_is(m_sreset,true);
+ }
+
+ // creator - create the dynamic processes after the start of simulation:
+ void creator()
+ {
+ sc_spawn_options options_method;
+ sc_spawn_options options_thread_clocked;
+ sc_spawn_options options_thread_event;
+ sc_spawn_options options_thread_timed;
+
+ wait(1);
+
+ options_method.reset_signal_is( m_areset, true );
+ options_method.spawn_method();
+ sc_spawn( sc_bind(&DUT::dynamic_method, this), "dynamic_method",
+ &options_method);
+
+ options_thread_clocked.async_reset_signal_is( m_areset, true );
+ options_thread_clocked.reset_signal_is( m_sreset, true );
+ options_thread_clocked.set_sensitivity( &m_clk.posedge_event() );
+ sc_spawn( sc_bind(&DUT::dynamic_thread_clocked, this),
+ "dynamic_thread_clocked", &options_thread_clocked);
+
+ options_thread_event.async_reset_signal_is( m_areset, true );
+ options_thread_event.reset_signal_is( m_sreset, true );
+ sc_spawn( sc_bind(&DUT::dynamic_thread_event, this),
+ "dynamic_thread_event", &options_thread_event);
+
+ options_thread_timed.async_reset_signal_is( m_areset, true );
+ options_thread_timed.reset_signal_is( m_sreset, true );
+ sc_spawn( sc_bind(&DUT::dynamic_thread_timed, this),
+ "dynamic_thread_timed", &options_thread_timed);
+
+ }
+
+ void dynamic_method()
+ {
+ cout << sc_time_stamp() << " ... dynamic method" << endl;
+ next_trigger(m_non_event);
+ }
+
+ void dynamic_thread_clocked()
+ {
+ cout << sc_time_stamp() << " ... dynamic thread clocked" << endl;
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void dynamic_thread_event()
+ {
+ cout << sc_time_stamp() << " ... dynamic thread event wait" << endl;
+ for (;;)
+ {
+ wait(m_non_event);
+ }
+ }
+
+ void dynamic_thread_timed()
+ {
+ cout << sc_time_stamp() << " ... dynamic thread timed wait" << endl;
+ for (;;)
+ {
+ wait(1000, SC_NS);
+ }
+ }
+
+
+ void resetter()
+ {
+ for ( int wait_i = 1; wait_i < 3; wait_i++ )
+ {
+ wait(2);
+ cout << endl << sc_time_stamp() << " asserting asynchronous reset"
+ << endl;
+ m_areset = true;
+ wait(wait_i);
+ cout << endl << sc_time_stamp() << " clearing asynchronous reset"
+ << endl;
+ m_areset = false;
+ wait(2);
+ cout << endl << sc_time_stamp() << " asserting synchronous reset"
+ << endl;
+ m_sreset = true;
+ wait(wait_i);
+ cout << endl << sc_time_stamp() << " clearing synchronous reset"
+ << endl;
+ m_sreset = false;
+ wait(5);
+ }
+ cout << endl << sc_time_stamp() << " terminating simulation" << endl;
+ sc_stop();
+ }
+
+ void static_cthread()
+ {
+ cout << sc_time_stamp() << " ... static cthread" << endl;
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void static_method()
+ {
+ cout << sc_time_stamp() << " ... static method" << endl;
+ next_trigger(m_non_event);
+ }
+
+ void static_thread_clocked()
+ {
+ cout << sc_time_stamp() << " ... static thread clocked" << endl;
+ for (;;)
+ {
+ wait();
+ }
+ }
+
+ void static_thread_event()
+ {
+ cout << sc_time_stamp() << " ... static thread event wait " << endl;
+ for (;;)
+ {
+ wait(m_non_event);
+ }
+ }
+
+ void static_thread_timed()
+ {
+ cout << sc_time_stamp() << " ... static thread timed wait " << endl;
+ for (;;)
+ {
+ wait(1000, SC_NS);
+ }
+ }
+
+ sc_signal<bool> m_areset;
+ sc_in<bool> m_clk;
+ sc_event m_non_event;
+ sc_signal<bool> m_sreset;
+};
+
+int sc_main(int argc, char* argv[])
+{
+ sc_clock clock;
+ DUT dut("dut");
+
+ dut.m_clk(clock);
+
+ sc_start();
+
+ cout << "Program completed" << endl;
+ return 0;
+}