From 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 24 May 2018 01:37:55 -0700 Subject: systemc: Import tests from the Accellera systemc distribution. Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6 Reviewed-on: https://gem5-review.googlesource.com/10845 Reviewed-by: Giacomo Travaglini Maintainer: Gabe Black --- .../sim_control/sim_to_infinity/common.h | 46 +++++++++++++++ .../sim_control/sim_to_infinity/display.cpp | 59 +++++++++++++++++++ .../sim_control/sim_to_infinity/display.h | 67 ++++++++++++++++++++++ .../sim_to_infinity/golden/sim_to_infinity.log | 7 +++ .../sim_control/sim_to_infinity/main.cpp | 61 ++++++++++++++++++++ .../sim_control/sim_to_infinity/sim_to_infinity.f | 2 + 6 files changed, 242 insertions(+) create mode 100644 src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/common.h create mode 100644 src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/display.cpp create mode 100644 src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/display.h create mode 100644 src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/golden/sim_to_infinity.log create mode 100644 src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/main.cpp create mode 100644 src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/sim_to_infinity.f (limited to 'src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity') diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/common.h b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/common.h new file mode 100644 index 000000000..803cbc085 --- /dev/null +++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/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 signal_bool_vector; + +#endif diff --git a/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/display.cpp b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/display.cpp new file mode 100644 index 000000000..767afe922 --- /dev/null +++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/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_infinity/display.h b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/display.h new file mode 100644 index 000000000..a2efa2bd7 --- /dev/null +++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/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_infinity/golden/sim_to_infinity.log b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/golden/sim_to_infinity.log new file mode 100644 index 000000000..a711bd840 --- /dev/null +++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/golden/sim_to_infinity.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_infinity/main.cpp b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/main.cpp new file mode 100644 index 000000000..1f8b19cdd --- /dev/null +++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/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(); + 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_infinity/sim_to_infinity.f b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/sim_to_infinity.f new file mode 100644 index 000000000..a85c022c3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/unit/methodology/sim_control/sim_to_infinity/sim_to_infinity.f @@ -0,0 +1,2 @@ +sim_to_infinity/main.cpp +sim_to_infinity/display.cpp -- cgit v1.2.3