summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-05-24 01:37:55 -0700
committerGabe Black <gabeblack@google.com>2018-08-08 10:09:54 +0000
commit16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch)
tree7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time
parent7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff)
downloadgem5-16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f.tar.xz
systemc: Import tests from the Accellera systemc distribution.
Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6 Reviewed-on: https://gem5-review.googlesource.com/10845 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time')
-rw-r--r--src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/common.h46
-rw-r--r--src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.cpp59
-rw-r--r--src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.h67
-rw-r--r--src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/golden/sim_to_time.log7
-rw-r--r--src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/main.cpp61
-rw-r--r--src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/sim_to_time.f2
6 files changed, 242 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/common.h b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/common.h
new file mode 100644
index 000000000..803cbc085
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/common.h
@@ -0,0 +1,46 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ common.h --
+
+ 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:
+
+ *****************************************************************************/
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#include "systemc.h"
+
+typedef sc_bv<16> bool_vector;
+typedef sc_signal<bool_vector> signal_bool_vector;
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.cpp b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.cpp
new file mode 100644
index 000000000..767afe922
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.cpp
@@ -0,0 +1,59 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ display.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:
+
+ *****************************************************************************/
+
+ /*****************************************/
+ /* Implementation Filename: display.cc */
+ /*****************************************/
+
+#include "display.h"
+
+void displayp::entry()
+{
+ bool_vector tmp;
+
+ cout << sc_time_stamp() << " : STARTING SIM \n" << endl;
+
+ while (true) {
+
+ tmp = prime.read();
+ wait();
+
+ cout << sc_time_stamp() << " : STOPPING SIM - stop button" << endl;
+ sc_stop();
+
+ }
+}
diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.h b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.h
new file mode 100644
index 000000000..a2efa2bd7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/display.h
@@ -0,0 +1,67 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ display.h --
+
+ 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:
+
+ *****************************************************************************/
+
+ /***************************************/
+ /* Interface Filename: display.h */
+ /***************************************/
+
+#include "common.h"
+
+SC_MODULE( displayp )
+{
+ SC_HAS_PROCESS( displayp );
+
+ sc_in_clk clk;
+
+ // Inputs
+ const signal_bool_vector& prime;
+
+ // Constructor
+ displayp (sc_module_name NAME,
+ sc_clock& TICK,
+ const signal_bool_vector& PRIME )
+
+ :
+ prime (PRIME)
+
+ {
+ clk (TICK);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ void entry();
+};
diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/golden/sim_to_time.log b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/golden/sim_to_time.log
new file mode 100644
index 000000000..a711bd840
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/golden/sim_to_time.log
@@ -0,0 +1,7 @@
+SystemC Simulation
+0 s : STARTING SIM
+
+6 ns : STOPPING SIM - stop button
+
+Info: /OSCI/SystemC: Simulation stopped by user.
+6 ns : STOPPING SIM - start button
diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/main.cpp b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/main.cpp
new file mode 100644
index 000000000..c0d3b7bc7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/main.cpp
@@ -0,0 +1,61 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.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:
+
+ *****************************************************************************/
+
+ /***************************************/
+ /* Main Filename: main.cc */
+ /***************************************/
+
+#include "display.h"
+
+int sc_main(int ac, char *av[])
+{
+
+// Signal Instantiation
+ signal_bool_vector prime ("prime");
+
+// Clock Instantiation
+ sc_clock clk ("CLK", 6, SC_NS, 0.5, 0, SC_NS); // 167 Mhz
+
+// Process Instantiation
+
+ displayp T2 ("T2", clk, prime);
+
+// Simulation Run Control
+ sc_start( 30, SC_NS, SC_EXIT_ON_STARVATION );
+ cout << sc_time_stamp() << " : STOPPING SIM - start button" << endl;
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/sim_to_time.f b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/sim_to_time.f
new file mode 100644
index 000000000..c91f75391
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_time/sim_to_time.f
@@ -0,0 +1,2 @@
+sim_to_time/main.cpp
+sim_to_time/display.cpp