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 --- .../general/control/case/balancing/balancing.cpp | 171 +++++++++++++++++++++ .../general/control/case/balancing/balancing.f | 4 + .../general/control/case/balancing/balancing.h | 102 ++++++++++++ .../general/control/case/balancing/common.h | 45 ++++++ .../general/control/case/balancing/display.cpp | 70 +++++++++ .../general/control/case/balancing/display.h | 78 ++++++++++ .../control/case/balancing/golden/balancing.log | 163 ++++++++++++++++++++ .../general/control/case/balancing/main.cpp | 95 ++++++++++++ .../general/control/case/balancing/stimulus.cpp | 68 ++++++++ .../general/control/case/balancing/stimulus.h | 75 +++++++++ 10 files changed, 871 insertions(+) create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.cpp create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.f create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.h create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/common.h create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.cpp create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.h create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/golden/balancing.log create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/main.cpp create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.cpp create mode 100644 src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.h (limited to 'src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing') diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.cpp b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.cpp new file mode 100644 index 000000000..b25ae0fa6 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.cpp @@ -0,0 +1,171 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + balancing.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-10-25 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "balancing.h" + + +void balancing::entry(){ + + sc_biguint<4> tmp1; + sc_bigint<4> tmp2; + sc_biguint<4> tmp3; + unsigned int tmpint; + sc_unsigned out_tmp2(12); + sc_unsigned out_tmp3(12); + + // reset_loop + if (reset.read() == true) { + out_value1.write(0); + out_value2.write(0); + out_value3.write(0); + out_valid1.write(false); + out_valid2.write(false); + out_valid3.write(false); + out_tmp2 = 0; + out_tmp3 = 0; + wait(); + } else wait(); + + // + // main loop + // + while(1) { + do { wait(); } while (in_valid == false); + + //reading inputs + tmp1 = in_value1.read(); + + //easy, just a bunch of different waits + out_valid1.write(true); + tmpint = tmp1.to_uint(); + switch (tmpint) { + case 4 : + wait(); + wait(); + wait(); + wait(); + out_value1.write(3); + wait(); + case 3 : + out_value1.write(2); + wait(); + wait(); + wait(); + case 2 : + out_value1.write(1); + wait(); + wait(); + default : + out_value1.write(tmp1); + wait(); + }; + out_valid1.write(false); + wait(); + + //the first branch should be pushed out in latency due to long delay + tmp2 = in_value2.read(); + tmp1 = tmp2; + out_valid2.write(true); + wait(); + tmpint = tmp1.to_uint(); + switch (tmpint) { + case 0 : + case 1 : + case 2 : + case 3 : + //long operation should extent latency + out_tmp2 = tmp2*tmp2*tmp2; + wait(); + case 4 : + case 5 : + case 6 : + case 7 : + //short operation should not extent latency + out_tmp2 = 4; + wait(); + case 8 | 9 | 10 | 11: + //wait statements should extent latency + out_tmp2 = 1; + wait(); + wait(); + wait(); + }; + wait(); + + out_value2.write( sc_biguint<4>( out_tmp2 ) ); + out_valid2.write(false); + wait(); + + //the first branch should be pushed out in latency due to long delay + tmp3 = in_value3.read(); + out_valid3.write(true); + wait(); + tmpint = tmp3.to_uint(); + switch (tmpint) { + case 0 : + case 1 : + case 2 : + case 3 : + //long operation should extent latency + out_tmp2 = tmp2*tmp2*tmp2; + wait(); + case 4 : + case 5 : + case 6 : + case 7 : + //short operation should not extent latency + out_tmp2 = 4; + case 8 : + case 9 : + case 10 : + case 11 : + //wait statements should extent latency + out_tmp2 = 1; + wait(); + wait(); + wait(); + }; + wait(); + out_value3.write( sc_biguint<4>( out_tmp3 ) ); + wait(); + out_valid3.write(false); + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.f b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.f new file mode 100644 index 000000000..0a6488983 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.f @@ -0,0 +1,4 @@ +balancing/balancing.cpp +balancing/display.cpp +balancing/main.cpp +balancing/stimulus.cpp diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.h b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.h new file mode 100644 index 000000000..a27e68018 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/balancing.h @@ -0,0 +1,102 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + balancing.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "common.h" + +SC_MODULE( balancing ) +{ + SC_HAS_PROCESS( balancing ); + + sc_in_clk clk; + + const sc_signal& reset ; + const sc_signal_bool_vector& in_value1; + const sc_signal_bool_vector& in_value2; + const sc_signal_bool_vector& in_value3; + const sc_signal& in_valid; + sc_signal_bool_vector& out_value1; + sc_signal_bool_vector& out_value2; + sc_signal_bool_vector& out_value3; + sc_signal& out_valid1; + sc_signal& out_valid2; + sc_signal& out_valid3; + + // + // Constructor + // + + balancing( + sc_module_name NAME, // reference name + sc_clock& CLK, // clock + const sc_signal& RESET, + const sc_signal_bool_vector& IN_VALUE1, + const sc_signal_bool_vector& IN_VALUE2, + const sc_signal_bool_vector& IN_VALUE3, + const sc_signal& IN_VALID, + sc_signal_bool_vector& OUT_VALUE1, + sc_signal_bool_vector& OUT_VALUE2, + sc_signal_bool_vector& OUT_VALUE3, + sc_signal& OUT_VALID1, + sc_signal& OUT_VALID2, + sc_signal& OUT_VALID3 + ) + : + reset (RESET), + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_value3 (IN_VALUE3), + in_valid (IN_VALID), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_value3 (OUT_VALUE3), + out_valid1 (OUT_VALID1), + out_valid2 (OUT_VALID2), + out_valid3 (OUT_VALID3) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,true); + }; + + // + + void entry (); + +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/common.h b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/common.h new file mode 100644 index 000000000..2a4edbad5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/common.h @@ -0,0 +1,45 @@ +/***************************************************************************** + + 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_signal > sc_signal_bool_vector; + +#endif diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.cpp b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.cpp new file mode 100644 index 000000000..55ff8cb26 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.cpp @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + display.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "display.h" + +void display::entry(){ + int i = 0; + + wait(2); + while(i++<20) { + // Reading Data, and Counter i,j is counted up. + while (in_valid1.read()==false) wait(); + while (in_valid1.read()==true) { + cout << "Display : in_data1 " << in_data1.read() << " " + << " at " << sc_time_stamp() << endl; + wait(); + }; + while (in_valid2.read()==false) wait(); + while (in_valid2.read()==true) { + cout << "Display : in_data2 " << in_data2.read() << " " + << " at " << sc_time_stamp() << endl; + wait(); + }; + while (in_valid3.read()==false) wait(); + while (in_valid3.read()==true) { + cout << "Display : in_data3 " << in_data3.read() << " " + << " at " << sc_time_stamp() << endl; + wait(); + }; + }; + sc_stop(); +} + + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.h b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.h new file mode 100644 index 000000000..f42a6b294 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/display.h @@ -0,0 +1,78 @@ +/***************************************************************************** + + 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: Rocco Jonack, Synopsys, Inc., 1999-07-30 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "common.h" + +SC_MODULE( display ) +{ + SC_HAS_PROCESS( display ); + + sc_in_clk clk; + + const sc_signal_bool_vector& in_data1; // Input port + const sc_signal_bool_vector& in_data2; // Input port + const sc_signal_bool_vector& in_data3; // Input port + const sc_signal& in_valid1; + const sc_signal& in_valid2; + const sc_signal& in_valid3; + + display( sc_module_name NAME, + sc_clock& CLK, + const sc_signal_bool_vector& IN_DATA1, + const sc_signal_bool_vector& IN_DATA2, + const sc_signal_bool_vector& IN_DATA3, + const sc_signal& IN_VALID1, + const sc_signal& IN_VALID2, + const sc_signal& IN_VALID3 + ) + : + in_data1(IN_DATA1), + in_data2(IN_DATA2), + in_data3(IN_DATA3), + in_valid1(IN_VALID1), + in_valid2(IN_VALID2), + in_valid3(IN_VALID3) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/golden/balancing.log b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/golden/balancing.log new file mode 100644 index 000000000..264e09ae0 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/golden/balancing.log @@ -0,0 +1,163 @@ +SystemC Simulation +Stimuli: stim1= 0 stim2= 0 stim3= 0 at 2 ns +Display : in_data1 0000 at 4 ns +Display : in_data2 0000 at 6 ns +Display : in_data2 0000 at 7 ns +Display : in_data2 0000 at 8 ns +Display : in_data2 0000 at 9 ns +Display : in_data2 0000 at 10 ns +Display : in_data2 0000 at 11 ns +Display : in_data2 0000 at 12 ns +Display : in_data3 0000 at 14 ns +Display : in_data3 0000 at 15 ns +Display : in_data3 0000 at 16 ns +Display : in_data3 0000 at 17 ns +Stimuli: stim1= 1 stim2= 1 stim3= 1 at 18 ns +Display : in_data3 0000 at 18 ns +Display : in_data3 0000 at 19 ns +Display : in_data3 0000 at 20 ns +Stimuli: stim1= 2 stim2= 2 stim3= 2 at 34 ns +Display : in_data1 0001 at 36 ns +Display : in_data1 0001 at 37 ns +Display : in_data1 0010 at 38 ns +Display : in_data2 0001 at 40 ns +Display : in_data2 0001 at 41 ns +Display : in_data2 0001 at 42 ns +Display : in_data2 0001 at 43 ns +Display : in_data2 0001 at 44 ns +Display : in_data2 0001 at 45 ns +Display : in_data2 0001 at 46 ns +Display : in_data3 0000 at 48 ns +Display : in_data3 0000 at 49 ns +Stimuli: stim1= 3 stim2= 3 stim3= 3 at 50 ns +Display : in_data3 0000 at 50 ns +Display : in_data3 0000 at 51 ns +Display : in_data3 0000 at 52 ns +Display : in_data3 0000 at 53 ns +Display : in_data3 0000 at 54 ns +Stimuli: stim1= 4 stim2= 4 stim3= 4 at 66 ns +Display : in_data1 0010 at 68 ns +Display : in_data1 0010 at 69 ns +Display : in_data1 0010 at 70 ns +Display : in_data1 0010 at 71 ns +Display : in_data1 0011 at 72 ns +Display : in_data1 0010 at 73 ns +Display : in_data1 0010 at 74 ns +Display : in_data1 0010 at 75 ns +Display : in_data1 0001 at 76 ns +Display : in_data1 0001 at 77 ns +Display : in_data1 0100 at 78 ns +Display : in_data2 0001 at 80 ns +Display : in_data2 0001 at 81 ns +Stimuli: stim1= 5 stim2= 5 stim3= 5 at 82 ns +Display : in_data2 0001 at 82 ns +Display : in_data2 0001 at 83 ns +Display : in_data2 0001 at 84 ns +Display : in_data2 0001 at 85 ns +Display : in_data3 0000 at 87 ns +Display : in_data3 0000 at 88 ns +Display : in_data3 0000 at 89 ns +Display : in_data3 0000 at 90 ns +Display : in_data3 0000 at 91 ns +Display : in_data3 0000 at 92 ns +Stimuli: stim1= 6 stim2= 6 stim3= 6 at 98 ns +Display : in_data1 0110 at 100 ns +Display : in_data2 0001 at 102 ns +Display : in_data2 0001 at 103 ns +Display : in_data2 0001 at 104 ns +Display : in_data2 0001 at 105 ns +Display : in_data2 0001 at 106 ns +Display : in_data2 0001 at 107 ns +Display : in_data3 0000 at 109 ns +Display : in_data3 0000 at 110 ns +Display : in_data3 0000 at 111 ns +Display : in_data3 0000 at 112 ns +Display : in_data3 0000 at 113 ns +Stimuli: stim1= 7 stim2= 7 stim3= 7 at 114 ns +Display : in_data3 0000 at 114 ns +Display : in_data1 0111 at 116 ns +Display : in_data2 0001 at 118 ns +Display : in_data2 0001 at 119 ns +Display : in_data2 0001 at 120 ns +Display : in_data2 0001 at 121 ns +Display : in_data2 0001 at 122 ns +Display : in_data2 0001 at 123 ns +Display : in_data3 0000 at 125 ns +Display : in_data3 0000 at 126 ns +Display : in_data3 0000 at 127 ns +Display : in_data3 0000 at 128 ns +Display : in_data3 0000 at 129 ns +Stimuli: stim1= 8 stim2= 8 stim3= 8 at 130 ns +Display : in_data3 0000 at 130 ns +Display : in_data1 1000 at 132 ns +Display : in_data2 0001 at 134 ns +Display : in_data2 0001 at 135 ns +Display : in_data3 0000 at 137 ns +Display : in_data3 0000 at 138 ns +Display : in_data3 0000 at 139 ns +Display : in_data3 0000 at 140 ns +Display : in_data3 0000 at 141 ns +Display : in_data3 0000 at 142 ns +Stimuli: stim1= 9 stim2= 9 stim3= 9 at 146 ns +Display : in_data1 1001 at 148 ns +Display : in_data2 0001 at 150 ns +Display : in_data2 0001 at 151 ns +Display : in_data3 0000 at 153 ns +Display : in_data3 0000 at 154 ns +Display : in_data3 0000 at 155 ns +Display : in_data3 0000 at 156 ns +Display : in_data3 0000 at 157 ns +Display : in_data3 0000 at 158 ns +Stimuli: stim1= 10 stim2= 10 stim3= 10 at 162 ns +Display : in_data1 1010 at 164 ns +Display : in_data2 0001 at 166 ns +Display : in_data2 0001 at 167 ns +Display : in_data3 0000 at 169 ns +Display : in_data3 0000 at 170 ns +Display : in_data3 0000 at 171 ns +Display : in_data3 0000 at 172 ns +Display : in_data3 0000 at 173 ns +Display : in_data3 0000 at 174 ns +Stimuli: stim1= 11 stim2= 11 stim3= 11 at 178 ns +Display : in_data1 1011 at 180 ns +Display : in_data2 0001 at 182 ns +Display : in_data2 0001 at 183 ns +Display : in_data2 0001 at 184 ns +Display : in_data2 0001 at 185 ns +Display : in_data2 0001 at 186 ns +Display : in_data3 0000 at 188 ns +Display : in_data3 0000 at 189 ns +Display : in_data3 0000 at 190 ns +Display : in_data3 0000 at 191 ns +Display : in_data3 0000 at 192 ns +Display : in_data3 0000 at 193 ns +Stimuli: stim1= 12 stim2= 12 stim3= 12 at 194 ns +Display : in_data1 1100 at 196 ns +Display : in_data2 0001 at 198 ns +Display : in_data2 0001 at 199 ns +Display : in_data3 0000 at 201 ns +Display : in_data3 0000 at 202 ns +Display : in_data3 0000 at 203 ns +Stimuli: stim1= 13 stim2= 13 stim3= 13 at 210 ns +Display : in_data1 1101 at 212 ns +Display : in_data2 0001 at 214 ns +Display : in_data2 0001 at 215 ns +Display : in_data3 0000 at 217 ns +Display : in_data3 0000 at 218 ns +Display : in_data3 0000 at 219 ns +Stimuli: stim1= 14 stim2= 14 stim3= 14 at 226 ns +Display : in_data1 1110 at 228 ns +Display : in_data2 0001 at 230 ns +Display : in_data2 0001 at 231 ns +Display : in_data3 0000 at 233 ns +Display : in_data3 0000 at 234 ns +Display : in_data3 0000 at 235 ns +Stimuli: stim1= 15 stim2= 15 stim3= 15 at 242 ns +Display : in_data1 1111 at 244 ns +Display : in_data2 0001 at 246 ns +Display : in_data2 0001 at 247 ns +Display : in_data3 0000 at 249 ns +Display : in_data3 0000 at 250 ns +Display : in_data3 0000 at 251 ns + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/main.cpp b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/main.cpp new file mode 100644 index 000000000..177cebdfb --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/main.cpp @@ -0,0 +1,95 @@ +/***************************************************************************** + + 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: Rocco Jonack, Synopsys, Inc., 1999-07-30 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "balancing.h" +#include "stimulus.h" +#include "display.h" + +int sc_main (int argc , char *argv[]) { + sc_clock clock; + sc_signal reset; + sc_signal_bool_vector stim1; + sc_signal_bool_vector stim2; + sc_signal_bool_vector stim3; + sc_signal input_valid; + sc_signal_bool_vector result1; + sc_signal_bool_vector result2; + sc_signal_bool_vector result3; + sc_signal output_valid1; + sc_signal output_valid2; + sc_signal output_valid3; + + + balancing balancing1 ( "process_body", + clock, + reset, + stim1, + stim2, + stim3, + input_valid, + result1, + result2, + result3, + output_valid1, + output_valid2, + output_valid3 + ); + + stimulus stimulus1 ("stimulus", + clock, + reset, + stim1, + stim2, + stim3, + input_valid); + + display display1 ("display", + clock, + result1, + result2, + result3, + output_valid1, + output_valid2, + output_valid3 + ); + + sc_start(); + return 0; +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.cpp b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.cpp new file mode 100644 index 000000000..65f97f5d6 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.cpp @@ -0,0 +1,68 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + stimulus.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "stimulus.h" + +void stimulus::entry() { + +int i; + + // sending some reset values + reset.write(true); + stim1.write(0); + stim2.write(0); + stim3.write(0); + wait(); + reset.write(false); + wait(); + for (i=0; i<= 15; i++) { + stim1.write(i); + stim2.write(i); + stim3.write(i); + input_valid.write(true); + cout << "Stimuli: stim1= " << i << " stim2= " << i << " stim3= " << i + << " at " << sc_time_stamp() << endl; + wait(); + input_valid.write(false); + wait(15); + } + + sc_stop(); +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.h b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.h new file mode 100644 index 000000000..a03d3e296 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/control/case/balancing/stimulus.h @@ -0,0 +1,75 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + stimulus.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + +#include "common.h" + +SC_MODULE( stimulus ) +{ + SC_HAS_PROCESS( stimulus ); + + sc_in_clk clk; + + sc_signal& reset; + sc_signal_bool_vector& stim1; + sc_signal_bool_vector& stim2; + sc_signal_bool_vector& stim3; + sc_signal& input_valid; + + stimulus(sc_module_name NAME, + sc_clock& CLK, + sc_signal& RESET, + sc_signal_bool_vector& STIM1, + sc_signal_bool_vector& STIM2, + sc_signal_bool_vector& STIM3, + sc_signal& INPUT_VALID + ) + : + reset(RESET), + stim1(STIM1), + stim2(STIM2), + stim3(STIM3), + input_valid(INPUT_VALID) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF -- cgit v1.2.3