diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-24 01:37:55 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-08 10:09:54 +0000 |
commit | 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch) | |
tree | 7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/misc/stars/star102573 | |
parent | 7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff) | |
download | gem5-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/stars/star102573')
3 files changed, 166 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/stars/star102573/COMPILE b/src/systemc/tests/systemc/misc/stars/star102573/COMPILE new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102573/COMPILE diff --git a/src/systemc/tests/systemc/misc/stars/star102573/for_nest.h b/src/systemc/tests/systemc/misc/stars/star102573/for_nest.h new file mode 100644 index 000000000..aa5ee10b8 --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102573/for_nest.h @@ -0,0 +1,70 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + for_nest.h -- + + Original Author: Preeti Panda, Janssen, Synopsys, Inc., 2000-08-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +SC_MODULE( for_nest ) +{ + SC_HAS_PROCESS( for_nest ); + + sc_in_clk clk; + + const sc_signal<bool>& reset; + const sc_signal<bool>& in_valid; + const sc_signal<int>& in_value; + sc_signal<bool>& out_valid; + sc_signal<int>& result; + + for_nest( + sc_module_name NAME, // referense name + sc_clock& CLOCK, // clock + const sc_signal<bool>& RESET, + const sc_signal<bool>& IN_VALID, + const sc_signal<int>& IN_VALUE, + sc_signal<bool>& OUT_VALID, + sc_signal<int>& RESULT + ) + : clk (CLOCK), // connection definition + reset (RESET), + in_valid (IN_VALID), + in_value (IN_VALUE), + out_valid (OUT_VALID), + result (RESULT) + { + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,true); + }; + void entry (); +}; diff --git a/src/systemc/tests/systemc/misc/stars/star102573/star102573.cpp b/src/systemc/tests/systemc/misc/stars/star102573/star102573.cpp new file mode 100644 index 000000000..60385dc6f --- /dev/null +++ b/src/systemc/tests/systemc/misc/stars/star102573/star102573.cpp @@ -0,0 +1,96 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + star102573.cpp -- + + Original Author: Preeti Panda, Synopsys, Inc., 2000-08-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include <systemc.h> +#include "for_nest.h" + +#define max 5 +#define max1 4 +#define max2 3 +#define max3 2 + +void for_nest::entry() +{ + + sc_signed tmp2(2); + sc_signed tmp4(4); + sc_signed tmp8(8); + sc_signed tmp6(6); + + int i, j, inp_tmp; + + result.write(0); + out_valid.write(false); + wait(); + + main_loop:while(1) { + + while (in_valid.read()==false) wait(); + out_valid.write(true); + wait(); + /* unrolled loop inside rolled loop */ + loop1:for (i=1; i<=max; i++) { + tmp2 = in_value.read(); + inp_tmp = tmp2.to_int() + i ; + loop2:for (j=1; j<=max1; j++) + inp_tmp = inp_tmp - tmp2.to_int() ; + result.write(inp_tmp); + wait(); + }; + out_valid.write(false); + wait(); + out_valid.write(true); + wait(); + + inp_tmp = in_value.read(); + wait(); + /* unrolled loop inside unrolled loop */ + loop3:for (i=1; i<=max2; i++) { + inp_tmp += i ; + loop4:for (j=1; j<=max3; j++) { + inp_tmp -= j ; + } + }; + result.write(inp_tmp); + out_valid.write(false); + wait(); + out_valid.write(true); + wait(); + + } +} + |