diff options
Diffstat (limited to 'src/systemc/tests/systemc/misc/cae_test/general/arith/addition')
51 files changed, 3972 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.cpp new file mode 100644 index 000000000..10eb25125 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.cpp @@ -0,0 +1,165 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + addition.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "addition.h" + +void addition::entry(){ + + int tmp1; + sc_bigint<4> tmp2; + sc_biguint<4> tmp3; + sc_bigint<8> tmp4; + sc_biguint<8> tmp5; + + // reset_loop + if (reset.read() == true) { + out_valid.write(false); + wait(); + } else wait(); + + // + // main loop + // + // + while(1) { + while(in_valid.read()==false) wait(); + wait(); + + //reading the inputs + tmp1 = in_value1.read(); + tmp2 = in_value2.read(); + tmp3 = in_value3.read(); + tmp4 = in_value4.read(); + tmp5 = in_value5.read(); + + //execute simple operations + tmp1 = tmp1 + 1; + tmp2 = tmp2 + 1; + tmp3 = tmp3 + 1; + tmp4 = tmp4 + 1; + tmp5 = tmp5 + 1; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + // execute increment post-operation and write outputs + out_value1.write(tmp1++); + out_value2.write(tmp2++); + out_value3.write(tmp3++); + out_value4.write(tmp4++); + out_value5.write(tmp5++); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + // execute increment pre-operation and write outputs + out_value1.write(++tmp1); + out_value2.write(++tmp2); + out_value3.write(++tmp3); + out_value4.write(++tmp4); + out_value5.write(++tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + //execute operations with overflow + tmp1 = tmp1 + 254; + tmp2 = tmp2 + 254; + tmp3 = tmp3 + 254; + tmp4 = tmp4 + 254; + tmp5 = tmp5 + 254; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + //execute operations with self assignment + tmp1 += 254; + tmp2 += 254; + tmp3 += 254; + tmp4 += 254; + tmp5 += 254; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + //execute operations with signed and unsigned mix and mixed bit width + tmp1 = (tmp3 + tmp2).to_int(); + tmp2 = tmp2 + tmp4; + tmp3 = tmp3 + tmp5; + tmp4 = tmp4 + tmp5; + tmp5 = tmp4 + tmp5; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.f b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.f new file mode 100644 index 000000000..b4ba6bd0f --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.f @@ -0,0 +1,4 @@ +addition/stimulus.cpp +addition/display.cpp +addition/addition.cpp +addition/main.cpp diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.h new file mode 100644 index 000000000..899bc9983 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/addition.h @@ -0,0 +1,114 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + addition.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + 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( addition ) +{ + SC_HAS_PROCESS( addition ); + + sc_in_clk clk; + + //==================================================================== + // [C] Always Needed Member Function + // -- constructor + // -- entry + //==================================================================== + + const sc_signal<bool>& reset ; + const sc_signal<int>& in_value1; + const sc_signal_bool_vector4& in_value2; + const sc_signal_bool_vector4& in_value3; + const sc_signal_bool_vector8& in_value4; + const sc_signal_bool_vector8& in_value5; + const sc_signal<bool>& in_valid; // Input port + sc_signal<int>& out_value1; // Output port + sc_signal_bool_vector4& out_value2; + sc_signal_bool_vector4& out_value3; + sc_signal_bool_vector8& out_value4; + sc_signal_bool_vector8& out_value5; + sc_signal<bool>& out_valid; + + // + // Constructor + // + + addition( + sc_module_name NAME, // reference name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal<int>& IN_VALUE1, + const sc_signal_bool_vector4& IN_VALUE2, + const sc_signal_bool_vector4& IN_VALUE3, + const sc_signal_bool_vector8& IN_VALUE4, + const sc_signal_bool_vector8& IN_VALUE5, + const sc_signal<bool>& IN_VALID, // Input port + sc_signal<int>& OUT_VALUE1, + sc_signal_bool_vector4& OUT_VALUE2, + sc_signal_bool_vector4& OUT_VALUE3, + sc_signal_bool_vector8& OUT_VALUE4, + sc_signal_bool_vector8& OUT_VALUE5, + sc_signal<bool>& OUT_VALID // Output port + ) + : + reset (RESET), // connection definition + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_value3 (IN_VALUE3), + in_value4 (IN_VALUE4), + in_value5 (IN_VALUE5), + in_valid (IN_VALID), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_value3 (OUT_VALUE3), + out_value4 (OUT_VALUE4), + out_value5 (OUT_VALUE5), + out_valid (OUT_VALID) + + { + 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/arith/addition/addition/common.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/common.h new file mode 100644 index 000000000..8a560ac63 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/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_signal<sc_bv<4> > sc_signal_bool_vector4; +typedef sc_signal<sc_bv<8> > sc_signal_bool_vector8; + +#endif diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/display.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/display.cpp new file mode 100644 index 000000000..38e5c8b61 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/display.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. + + *****************************************************************************/ + +/***************************************************************************** + + display.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + 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(1) { + // Reading Data, and Counter i,j is counted up. + while (in_valid.read()==false) wait(); + cout << "Display : " << in_data1.read() << " " + << in_data3.read() << " " + << in_data3.read() << " " + << in_data4.read() << " " + << in_data5.read() << " " + << " at " << sc_time_stamp() << endl; + + i++; + if(i == 24) sc_stop(); + wait(); + } +} + + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/display.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/display.h new file mode 100644 index 000000000..4c20196ac --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/display.h @@ -0,0 +1,77 @@ +/***************************************************************************** + + 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-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + 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<int>& in_data1; // Input port + const sc_signal_bool_vector4& in_data2; // Input port + const sc_signal_bool_vector4& in_data3; // Input port + const sc_signal_bool_vector8& in_data4; // Input port + const sc_signal_bool_vector8& in_data5; // Input port + const sc_signal<bool>& in_valid; + + display( sc_module_name NAME, + sc_clock& CLK, + const sc_signal<int>& IN_DATA1, + const sc_signal_bool_vector4& IN_DATA2, + const sc_signal_bool_vector4& IN_DATA3, + const sc_signal_bool_vector8& IN_DATA4, + const sc_signal_bool_vector8& IN_DATA5, + const sc_signal<bool>& IN_VALID + ) + : + in_data1(IN_DATA1), + in_data2(IN_DATA2), + in_data3(IN_DATA3), + in_data4(IN_DATA4), + in_data5(IN_DATA5), + in_valid(IN_VALID) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/golden/addition.log b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/golden/addition.log new file mode 100644 index 000000000..ee6b81b72 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/golden/addition.log @@ -0,0 +1,31 @@ +SystemC Simulation +Stimuli : 0 0 0 0 0 at 23 ns +Display : 1 0001 0001 00000001 00000001 at 27 ns +Display : 1 0001 0001 00000001 00000001 at 29 ns +Display : 3 0011 0011 00000011 00000011 at 31 ns +Display : 257 0001 0001 00000001 00000001 at 34 ns +Display : 511 1111 1111 11111111 11111111 at 37 ns +Display : 14 1110 1110 11111110 11111101 at 40 ns +Stimuli : 1 1 1 1 1 at 44 ns +Display : 2 0010 0010 00000010 00000010 at 48 ns +Display : 2 0010 0010 00000010 00000010 at 50 ns +Display : 4 0100 0100 00000100 00000100 at 52 ns +Display : 258 0010 0010 00000010 00000010 at 55 ns +Display : 512 0000 0000 00000000 00000000 at 58 ns +Display : 0 0000 0000 00000000 00000000 at 61 ns +Stimuli : 2 2 2 2 2 at 65 ns +Display : 3 0011 0011 00000011 00000011 at 69 ns +Display : 3 0011 0011 00000011 00000011 at 71 ns +Display : 5 0101 0101 00000101 00000101 at 73 ns +Display : 259 0011 0011 00000011 00000011 at 76 ns +Display : 513 0001 0001 00000001 00000001 at 79 ns +Display : 2 0010 0010 00000010 00000011 at 82 ns +Stimuli : 3 3 3 3 3 at 86 ns +Display : 4 0100 0100 00000100 00000100 at 90 ns +Display : 4 0100 0100 00000100 00000100 at 92 ns +Display : 6 0110 0110 00000110 00000110 at 94 ns +Display : 260 0100 0100 00000100 00000100 at 97 ns +Display : 514 0010 0010 00000010 00000010 at 100 ns +Display : 4 0100 0100 00000100 00000110 at 103 ns + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/main.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/main.cpp new file mode 100644 index 000000000..3e32605f9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/main.cpp @@ -0,0 +1,97 @@ +/***************************************************************************** + + 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-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "stimulus.h" +#include "display.h" +#include "addition.h" + +int sc_main (int argc , char *argv[]) { + sc_clock clock; + sc_signal<bool> reset; + sc_signal<int> stimulus_line1; + sc_signal_bool_vector4 stimulus_line2; + sc_signal_bool_vector4 stimulus_line3; + sc_signal_bool_vector8 stimulus_line4; + sc_signal_bool_vector8 stimulus_line5; + sc_signal<bool> input_valid; + sc_signal<bool> output_valid; + sc_signal<int> result_line1; + sc_signal_bool_vector4 result_line2; + sc_signal_bool_vector4 result_line3; + sc_signal_bool_vector8 result_line4; + sc_signal_bool_vector8 result_line5; + + stimulus stimulus1("stimulus_block", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + input_valid); + + addition addition1 ( "process_body", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + input_valid, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + output_valid); + + display display1 ( "display", + clock, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + output_valid); + + sc_start(); + return 0; +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/stimulus.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/stimulus.cpp new file mode 100644 index 000000000..2d43a45c4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/stimulus.cpp @@ -0,0 +1,87 @@ +/***************************************************************************** + + 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-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + 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 send_value1 = 0; + sc_signed send_value2(4); + sc_unsigned send_value3(4); + sc_signed send_value4(8); + sc_unsigned send_value5(8); + + + // sending some reset values + reset.write(true); + out_valid.write(false); + send_value2 = 0; + send_value3 = 0; + send_value4 = 0; + send_value5 = 0; + out_stimulus1.write(0); + out_stimulus2.write(0); + out_stimulus3.write(0); + out_stimulus4.write(0); + out_stimulus5.write(0); + wait(3); + reset.write(false); + // sending normal mode values + while(true){ + wait(20); + out_stimulus1.write( send_value1 ); + out_stimulus2.write( send_value2 ); + out_stimulus3.write( send_value3 ); + out_stimulus4.write( send_value4 ); + out_stimulus5.write( send_value5 ); + out_valid.write( true ); + cout << "Stimuli : " << send_value1 << " " + << send_value2 << " " + << send_value3 << " " + << send_value4 << " " + << send_value5 << " " << " at " + << sc_time_stamp() << endl; + send_value1++; + send_value2 = send_value2+1; + send_value3 = send_value3+1; + send_value4 = send_value4+1; + send_value5 = send_value5+1; + wait(); + out_valid.write( false ); + } +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/stimulus.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/stimulus.h new file mode 100644 index 000000000..b73fb9d4c --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/addition/stimulus.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + stimulus.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-05-12 + + *****************************************************************************/ + +/***************************************************************************** + + 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<bool>& reset; + sc_signal<int>& out_stimulus1; + sc_signal_bool_vector4& out_stimulus2; + sc_signal_bool_vector4& out_stimulus3; + sc_signal_bool_vector8& out_stimulus4; + sc_signal_bool_vector8& out_stimulus5; + sc_signal<bool>& out_valid; + + stimulus(sc_module_name NAME, + sc_clock& CLK, + sc_signal<bool>& RESET, + sc_signal<int>& OUT_STIMULUS1, + sc_signal_bool_vector4& OUT_STIMULUS2, + sc_signal_bool_vector4& OUT_STIMULUS3, + sc_signal_bool_vector8& OUT_STIMULUS4, + sc_signal_bool_vector8& OUT_STIMULUS5, + sc_signal<bool>& OUT_VALID + ) + : + reset(RESET), + out_stimulus1(OUT_STIMULUS1), + out_stimulus2(OUT_STIMULUS2), + out_stimulus3(OUT_STIMULUS3), + out_stimulus4(OUT_STIMULUS4), + out_stimulus5(OUT_STIMULUS5), + out_valid(OUT_VALID) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.cpp new file mode 100644 index 000000000..df19755c1 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.cpp @@ -0,0 +1,99 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + bitwidth.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "bitwidth.h" + +void bitwidth::entry(){ + + sc_bigint<4> tmp1; + sc_biguint<4> tmp2; + sc_bigint<6> tmp3; + sc_biguint<6> tmp4; + sc_bigint<8> tmp5; + sc_biguint<8> tmp6; + + // reset_loop + if (reset.read() == true) { + out_valid.write(false); + wait(); + } else wait(); + + // + // main loop + // + // + while(1) { + while(in_valid.read()==false) wait(); + wait(); + + //reading the inputs + tmp1 = in_value1.read(); + tmp2 = in_value2.read(); + tmp3 = in_value3.read(); + tmp4 = in_value4.read(); + tmp5 = in_value5.read(); + tmp6 = in_value6.read(); + + //execute simple operations + // expected bitwidth 4 4 4 signed + tmp1 = tmp1 + tmp2; + // expected bitwidth 4 6 6 signed + tmp3 = tmp1 + tmp3; + // expected bitwidth 4 4 6 signed + tmp6 = tmp2 + tmp1; + // expected bitwidth 8 8 6 signed + tmp4 = tmp5 + tmp6; + // expected bitwidth 6 8 4 unsigned + tmp2 = tmp4 + tmp6; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_value6.write(tmp6); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.f b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.f new file mode 100644 index 000000000..53a59162e --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.f @@ -0,0 +1,4 @@ +bitwidth/stimulus.cpp +bitwidth/display.cpp +bitwidth/bitwidth.cpp +bitwidth/main.cpp diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.h new file mode 100644 index 000000000..9ced486ea --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/bitwidth.h @@ -0,0 +1,120 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + bitwidth.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + 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( bitwidth ) +{ + SC_HAS_PROCESS( bitwidth ); + + sc_in_clk clk; + + //==================================================================== + // [C] Always Needed Member Function + // -- constructor + // -- entry + //==================================================================== + + const sc_signal<bool>& reset ; + const sc_signal_bool_vector4& in_value1; // Input port + const sc_signal_bool_vector4& in_value2; // Input port + const sc_signal_bool_vector6& in_value3; // Input port + const sc_signal_bool_vector6& in_value4; // Input port + const sc_signal_bool_vector8& in_value5; // Input port + const sc_signal_bool_vector8& in_value6; // Input port + const sc_signal<bool>& in_valid; // Input port + sc_signal_bool_vector4& out_value1; // Output port + sc_signal_bool_vector4& out_value2; // Output port + sc_signal_bool_vector6& out_value3; // Output port + sc_signal_bool_vector6& out_value4; // Output port + sc_signal_bool_vector8& out_value5; // Output port + sc_signal_bool_vector8& out_value6; // Output port + sc_signal<bool>& out_valid; // Output port + + // + // Constructor + // + + bitwidth ( + sc_module_name NAME, // referense name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal_bool_vector4& IN_VALUE1, + const sc_signal_bool_vector4& IN_VALUE2, + const sc_signal_bool_vector6& IN_VALUE3, + const sc_signal_bool_vector6& IN_VALUE4, + const sc_signal_bool_vector8& IN_VALUE5, + const sc_signal_bool_vector8& IN_VALUE6, + const sc_signal<bool>& IN_VALID, // Input port + sc_signal_bool_vector4& OUT_VALUE1, + sc_signal_bool_vector4& OUT_VALUE2, + sc_signal_bool_vector6& OUT_VALUE3, + sc_signal_bool_vector6& OUT_VALUE4, + sc_signal_bool_vector8& OUT_VALUE5, + sc_signal_bool_vector8& OUT_VALUE6, + sc_signal<bool>& OUT_VALID // Output port + ) + : + reset (RESET), + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_value3 (IN_VALUE3), + in_value4 (IN_VALUE4), + in_value5 (IN_VALUE5), + in_value6 (IN_VALUE6), + in_valid (IN_VALID), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_value3 (OUT_VALUE3), + out_value4 (OUT_VALUE4), + out_value5 (OUT_VALUE5), + out_value6 (OUT_VALUE6), + out_valid (OUT_VALID) + + { + 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/arith/addition/bitwidth/common.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/common.h new file mode 100644 index 000000000..2a49981d9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/common.h @@ -0,0 +1,47 @@ +/***************************************************************************** + + 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_bv<4> > sc_signal_bool_vector4; +typedef sc_signal<sc_bv<6> > sc_signal_bool_vector6; +typedef sc_signal<sc_bv<8> > sc_signal_bool_vector8; + +#endif diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/display.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/display.cpp new file mode 100644 index 000000000..76acd9e62 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/display.cpp @@ -0,0 +1,62 @@ +/***************************************************************************** + + 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-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + 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(1) { + // Reading Data, and Counter i,j is counted up.
+ while (in_valid.read()==false) wait(); + cout << "Display : " << in_data1.read() << " " + << in_data2.read() << " " + << in_data3.read() << " " + << in_data4.read() << " " + << in_data5.read() << " " + << in_data6.read() << " " + << " at " << sc_time_stamp() << endl; + + i++; + if(i == 24) sc_stop(); + wait(); + } +} + + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/display.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/display.h new file mode 100644 index 000000000..d35bb1abc --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/display.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + display.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + 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_vector4& in_data1; // Input port + const sc_signal_bool_vector4& in_data2; // Input port + const sc_signal_bool_vector6& in_data3; // Input port + const sc_signal_bool_vector6& in_data4; // Input port + const sc_signal_bool_vector8& in_data5; // Input port + const sc_signal_bool_vector8& in_data6; // Input port + const sc_signal<bool>& in_valid; + + display( sc_module_name NAME, + sc_clock& CLK, + const sc_signal_bool_vector4& IN_DATA1, + const sc_signal_bool_vector4& IN_DATA2, + const sc_signal_bool_vector6& IN_DATA3, + const sc_signal_bool_vector6& IN_DATA4, + const sc_signal_bool_vector8& IN_DATA5, + const sc_signal_bool_vector8& IN_DATA6, + const sc_signal<bool>& IN_VALID + ) + : + in_data1(IN_DATA1), + in_data2(IN_DATA2), + in_data3(IN_DATA3), + in_data4(IN_DATA4), + in_data5(IN_DATA5), + in_data6(IN_DATA6), + in_valid(IN_VALID) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/golden/bitwidth.log b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/golden/bitwidth.log new file mode 100644 index 000000000..d8f3d5726 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/golden/bitwidth.log @@ -0,0 +1,51 @@ +SystemC Simulation +Stimuli : 0 0 0 0 0 0 at 23 ns +Display : 0000 0000 000000 000000 00000000 00000000 at 27 ns +Stimuli : 2 2 8 8 32 32 at 44 ns +Display : 0100 1100 001100 100110 00100000 00000110 at 48 ns +Stimuli : 4 4 16 16 64 64 at 65 ns +Display : 1000 1000 001000 111100 01000000 11111100 at 69 ns +Stimuli : 6 6 24 24 96 96 at 86 ns +Display : 1100 0100 010100 100010 01100000 00000010 at 90 ns +Stimuli : -8 8 -32 32 -128 128 at 107 ns +Display : 0000 0000 100000 001000 10000000 00001000 at 111 ns +Stimuli : -6 10 -24 40 -96 160 at 128 ns +Display : 0100 1100 101100 101110 10100000 00001110 at 132 ns +Stimuli : -4 12 -16 48 -64 192 at 149 ns +Display : 1000 1000 101000 000100 11000000 00000100 at 153 ns +Stimuli : -2 14 -8 56 -32 224 at 170 ns +Display : 1100 0100 110100 101010 11100000 00001010 at 174 ns +Stimuli : 0 0 0 0 0 0 at 191 ns +Display : 0000 0000 000000 000000 00000000 00000000 at 195 ns +Stimuli : 2 2 8 8 32 32 at 212 ns +Display : 0100 1100 001100 100110 00100000 00000110 at 216 ns +Stimuli : 4 4 16 16 64 64 at 233 ns +Display : 1000 1000 001000 111100 01000000 11111100 at 237 ns +Stimuli : 6 6 24 24 96 96 at 254 ns +Display : 1100 0100 010100 100010 01100000 00000010 at 258 ns +Stimuli : -8 8 -32 32 -128 128 at 275 ns +Display : 0000 0000 100000 001000 10000000 00001000 at 279 ns +Stimuli : -6 10 -24 40 -96 160 at 296 ns +Display : 0100 1100 101100 101110 10100000 00001110 at 300 ns +Stimuli : -4 12 -16 48 -64 192 at 317 ns +Display : 1000 1000 101000 000100 11000000 00000100 at 321 ns +Stimuli : -2 14 -8 56 -32 224 at 338 ns +Display : 1100 0100 110100 101010 11100000 00001010 at 342 ns +Stimuli : 0 0 0 0 0 0 at 359 ns +Display : 0000 0000 000000 000000 00000000 00000000 at 363 ns +Stimuli : 2 2 8 8 32 32 at 380 ns +Display : 0100 1100 001100 100110 00100000 00000110 at 384 ns +Stimuli : 4 4 16 16 64 64 at 401 ns +Display : 1000 1000 001000 111100 01000000 11111100 at 405 ns +Stimuli : 6 6 24 24 96 96 at 422 ns +Display : 1100 0100 010100 100010 01100000 00000010 at 426 ns +Stimuli : -8 8 -32 32 -128 128 at 443 ns +Display : 0000 0000 100000 001000 10000000 00001000 at 447 ns +Stimuli : -6 10 -24 40 -96 160 at 464 ns +Display : 0100 1100 101100 101110 10100000 00001110 at 468 ns +Stimuli : -4 12 -16 48 -64 192 at 485 ns +Display : 1000 1000 101000 000100 11000000 00000100 at 489 ns +Stimuli : -2 14 -8 56 -32 224 at 506 ns +Display : 1100 0100 110100 101010 11100000 00001010 at 510 ns + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/main.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/main.cpp new file mode 100644 index 000000000..238dd032a --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/main.cpp @@ -0,0 +1,103 @@ +/***************************************************************************** + + 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-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "stimulus.h" +#include "display.h" +#include "bitwidth.h" + +int sc_main (int argc , char *argv[]) { + sc_clock clock; + sc_signal<bool> reset; + sc_signal_bool_vector4 stimulus_line1; + sc_signal_bool_vector4 stimulus_line2; + sc_signal_bool_vector6 stimulus_line3; + sc_signal_bool_vector6 stimulus_line4; + sc_signal_bool_vector8 stimulus_line5; + sc_signal_bool_vector8 stimulus_line6; + sc_signal<bool> input_valid; + sc_signal<bool> output_valid; + sc_signal_bool_vector4 result_line1; + sc_signal_bool_vector4 result_line2; + sc_signal_bool_vector6 result_line3; + sc_signal_bool_vector6 result_line4; + sc_signal_bool_vector8 result_line5; + sc_signal_bool_vector8 result_line6; + + stimulus stimulus1("stimulus_block", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + stimulus_line6, + input_valid); + + bitwidth bitwidth1 ( "process_body", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + stimulus_line6, + input_valid, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + result_line6, + output_valid); + + display display1 ( "display", + clock, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + result_line6, + output_valid); + + sc_start(); + return 0; +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/stimulus.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/stimulus.cpp new file mode 100644 index 000000000..15546d1b2 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/stimulus.cpp @@ -0,0 +1,94 @@ +/***************************************************************************** + + 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-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + 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() { + sc_signed send_value1(4); + sc_unsigned send_value2(4); + sc_signed send_value3(6); + sc_unsigned send_value4(6); + sc_signed send_value5(8); + sc_unsigned send_value6(8); + + + // sending some reset values + reset.write(true); + out_valid.write(false); + send_value1 = 0; + send_value2 = 0; + send_value3 = 0; + send_value4 = 0; + send_value5 = 0; + send_value6 = 0; + out_stimulus1.write(0); + out_stimulus2.write(0); + out_stimulus3.write(0); + out_stimulus4.write(0); + out_stimulus5.write(0); + out_stimulus6.write(0); + wait(3); + reset.write(false); + // sending normal mode values + while(true){ + wait(20); + out_stimulus1.write( send_value1 ); + out_stimulus2.write( send_value2 ); + out_stimulus3.write( send_value3 ); + out_stimulus4.write( send_value4 ); + out_stimulus5.write( send_value5 ); + out_stimulus6.write( send_value6 ); + out_valid.write( true ); + cout << "Stimuli : " << send_value1 << " " + << send_value2 << " " + << send_value3 << " " + << send_value4 << " " + << send_value5 << " " + << send_value6 << " " << " at " + << sc_time_stamp() << endl; + send_value1 = send_value1+2; + send_value2 = send_value2+2; + send_value3 = send_value3+8; + send_value4 = send_value4+8; + send_value5 = send_value5+32; + send_value6 = send_value6+32; + wait(); + out_valid.write( false ); + } +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/stimulus.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/stimulus.h new file mode 100644 index 000000000..edbd6be48 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/bitwidth/stimulus.h @@ -0,0 +1,83 @@ +/***************************************************************************** + + 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-08-02 + + *****************************************************************************/ + +/***************************************************************************** + + 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<bool>& reset; + sc_signal_bool_vector4& out_stimulus1; + sc_signal_bool_vector4& out_stimulus2; + sc_signal_bool_vector6& out_stimulus3; + sc_signal_bool_vector6& out_stimulus4; + sc_signal_bool_vector8& out_stimulus5; + sc_signal_bool_vector8& out_stimulus6; + sc_signal<bool>& out_valid; + + stimulus(sc_module_name NAME, + sc_clock& CLK, + sc_signal<bool>& RESET, + sc_signal_bool_vector4& OUT_STIMULUS1, + sc_signal_bool_vector4& OUT_STIMULUS2, + sc_signal_bool_vector6& OUT_STIMULUS3, + sc_signal_bool_vector6& OUT_STIMULUS4, + sc_signal_bool_vector8& OUT_STIMULUS5, + sc_signal_bool_vector8& OUT_STIMULUS6, + sc_signal<bool>& OUT_VALID + ) + : + reset(RESET), + out_stimulus1(OUT_STIMULUS1), + out_stimulus2(OUT_STIMULUS2), + out_stimulus3(OUT_STIMULUS3), + out_stimulus4(OUT_STIMULUS4), + out_stimulus5(OUT_STIMULUS5), + out_stimulus6(OUT_STIMULUS6), + out_valid(OUT_VALID) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/common.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/common.h new file mode 100644 index 000000000..1af56c523 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/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_bv<8> > sc_signal_bool_vector; + +#endif diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.cpp new file mode 100644 index 000000000..753647536 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.cpp @@ -0,0 +1,134 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + datatypes.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-14 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "datatypes.h" +#define true 1 +#define false 0 + +void datatypes::entry() + +{ + + sc_bigint<8> tmp1; + sc_bigint<8> tmp1r; + sc_biguint<8> tmp2; + sc_biguint<8> tmp2r; + long tmp3; + long tmp3r; + int tmp4; + int tmp4r; + short tmp5; + short tmp5r; + char tmp6; + char tmp6r; + +// define 1 dimensional array + int tmp7[2]; + char tmp8[2]; + // int tmp9[2]; + int* tmp9; + +// define sc_bool_vector + sc_bv<4> tmp10; + tmp10[3] = 0; tmp10[2] = 1; tmp10[1] = 0; tmp10[0] = 1; + +// define 2 dimentional array + sc_bv<1> tmp11[2]; + +// reset_loop + if (reset.read() == true) { + out_valid.write(false); + out_ack.write(false); + wait(); + } else wait(); + +// +// main loop +// + +// initialization of sc_array + + tmp7[0] = 3; + tmp7[1] = 12; + tmp8[0] = 'S'; + tmp8[1] = 'C'; + tmp9 = tmp7; + tmp11[0][0] = "1"; + tmp11[1][0] = "0"; + + + while(1) { + while(in_valid.read()==false) wait(); + + //reading the inputs + tmp1 = in_value1.read(); + tmp2 = in_value2.read(); + tmp3 = in_value3.read(); + tmp4 = in_value4.read(); + tmp5 = in_value5.read(); + tmp6 = in_value6.read(); + + out_ack.write(true); + + //execute mixed data type addition operations + tmp1r = tmp1 + tmp2 + (sc_bigint<1>)tmp1.range(0, 0) ; // #### + // tmp2r = tmp6 + tmp1 + int(tmp10[2]); // treat tmp10[2] as carry in + tmp2r = tmp6 + tmp1 + tmp10[2].to_bool(); // treat tmp10[2] as carry in + tmp3r = tmp4 + tmp6; + tmp4r = ++tmp5; + // tmp4r -= int(tmp11[0][0]); + tmp4r -= tmp11[0][0].to_bool(); + tmp5r = tmp6 + tmp4; + tmp6r = tmp8[0] + tmp9[1]; + + //write outputs + out_value1.write(tmp1r); + out_value2.write(tmp2r); + out_value3.write(tmp3r); + out_value4.write(tmp4r); + out_value5.write(tmp5r); + out_value6.write(tmp6r); + + out_valid.write(true); + wait(); + out_ack.write(false); + out_valid.write(false); + + } + +} // End + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.f b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.f new file mode 100644 index 000000000..64f4c05f1 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.f @@ -0,0 +1,4 @@ +datatypes/stimulus.cpp +datatypes/display.cpp +datatypes/datatypes.cpp +datatypes/main.cpp diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.h new file mode 100644 index 000000000..7ce8039e3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/datatypes.h @@ -0,0 +1,123 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + datatypes.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-14 + + *****************************************************************************/ + +/***************************************************************************** + + 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( datatypes ) +{ + SC_HAS_PROCESS( datatypes ); + + sc_in_clk clk; + + //==================================================================== + // [C] Always Needed Member Function + // -- constructor + // -- entry + //==================================================================== + + const sc_signal<bool>& reset ; + const sc_signal_bool_vector& in_value1; // Input port + const sc_signal_bool_vector& in_value2; // Input port + const sc_signal<long>& in_value3; // Input port + const sc_signal<int>& in_value4; // Input port + const sc_signal<short>& in_value5; // Input port + const sc_signal<char>& in_value6; // Input port + const sc_signal<bool>& in_valid; // Input port + sc_signal<bool>& out_ack; // Output port + sc_signal_bool_vector& out_value1; // Output port + sc_signal_bool_vector& out_value2; // Output port + sc_signal<long>& out_value3; // Output port + sc_signal<int>& out_value4; // Output port + sc_signal<short>& out_value5; // Output port + sc_signal<char>& out_value6; // Output port + sc_signal<bool>& out_valid; // Output port + + // + // Constructor + // + + datatypes( + sc_module_name NAME, // referense name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal_bool_vector& IN_VALUE1, + const sc_signal_bool_vector& IN_VALUE2, + const sc_signal<long>& IN_VALUE3, + const sc_signal<int>& IN_VALUE4, + const sc_signal<short>& IN_VALUE5, + const sc_signal<char>& IN_VALUE6, + const sc_signal<bool>& IN_VALID, + + sc_signal<bool>& OUT_ACK, + sc_signal_bool_vector& OUT_VALUE1, + sc_signal_bool_vector& OUT_VALUE2, + sc_signal<long>& OUT_VALUE3, + sc_signal<int>& OUT_VALUE4, + sc_signal<short>& OUT_VALUE5, + sc_signal<char>& OUT_VALUE6, + sc_signal<bool>& OUT_VALID + ) + : + reset (RESET), + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_value3 (IN_VALUE3), + in_value4 (IN_VALUE4), + in_value5 (IN_VALUE5), + in_value6 (IN_VALUE6), + in_valid (IN_VALID), + out_ack (OUT_ACK), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_value3 (OUT_VALUE3), + out_value4 (OUT_VALUE4), + out_value5 (OUT_VALUE5), + out_value6 (OUT_VALUE6), + out_valid (OUT_VALID) + + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,true); + }; + +//Process Functionality: Described in the member function below + void entry(); +}; + +// EOF + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/display.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/display.cpp new file mode 100644 index 000000000..ef7667e69 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/display.cpp @@ -0,0 +1,49 @@ +/***************************************************************************** + + 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-14 + + *****************************************************************************/ + +/***************************************************************************** + + 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() { + + while(true){ + do { wait(); } while ( in_valid == false ); + cout << "Display: " << in_value1.read() << " " << in_value2.read() << " " << in_value3.read() << " " << in_value4.read() << " " << in_value5.read() << " " << in_value6.read() << endl; + do { wait(); } while ( in_valid == true); + } + +} +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/display.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/display.h new file mode 100644 index 000000000..7804753f9 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/display.h @@ -0,0 +1,86 @@ +/***************************************************************************** + + 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-14 + + *****************************************************************************/ + +/***************************************************************************** + + 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_value1; // Output port + const sc_signal_bool_vector& in_value2; // Output port + const sc_signal<long>& in_value3; // Output port + const sc_signal<int>& in_value4; // Output port + const sc_signal<short>& in_value5; // Output port + const sc_signal<char>& in_value6; // Output port + const sc_signal<bool>& in_valid; // Output port + + // + // Constructor + // + + display( + sc_module_name NAME, // reference name + sc_clock& CLK, // clock + const sc_signal_bool_vector& IN_VALUE1, + const sc_signal_bool_vector& IN_VALUE2, + const sc_signal<long>& IN_VALUE3, + const sc_signal<int>& IN_VALUE4, + const sc_signal<short>& IN_VALUE5, + const sc_signal<char>& IN_VALUE6, + const sc_signal<bool>& IN_VALID + ) + : + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_value3 (IN_VALUE3), + in_value4 (IN_VALUE4), + in_value5 (IN_VALUE5), + in_value6 (IN_VALUE6), + in_valid (IN_VALID) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + }; + + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/golden/datatypes.log b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/golden/datatypes.log new file mode 100644 index 000000000..db69787de --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/golden/datatypes.log @@ -0,0 +1,203 @@ +SystemC Simulation +Stimuli: 0 1 12345678 -123456 20000 +Display: 00000001 01010011 -123374 20000 7698 _ +Stimuli: 1 3 12345683 -123453 20006 +Display: 00000011 01011000 -123367 20006 7705 _ +Stimuli: 2 5 12345688 -123450 20012 +Display: 00000111 01011101 -123360 20012 7712 _ +Stimuli: 3 7 12345693 -123447 20018 +Display: 00001001 01100010 -123353 20018 7719 _ +Stimuli: 4 9 12345698 -123444 20024 +Display: 00001101 01100111 -123346 20024 7726 _ +Stimuli: 5 11 12345703 -123441 20030 +Display: 00001111 01101100 -123339 20030 7733 _ +Stimuli: 6 13 12345708 -123438 20036 +Display: 00010011 01110001 -123332 20036 7740 _ +Stimuli: 7 15 12345713 -123435 20042 +Display: 00010101 01110110 -123325 20042 7747 _ +Stimuli: 8 17 12345718 -123432 20048 +Display: 00011001 01111011 -123318 20048 7754 _ +Stimuli: 9 19 12345723 -123429 20054 +Display: 00011011 10000000 -123311 20054 7761 _ +Stimuli: 10 21 12345728 -123426 20060 +Display: 00011111 10000101 -123304 20060 7768 _ +Stimuli: 11 23 12345733 -123423 20066 +Display: 00100001 10001010 -123297 20066 7775 _ +Stimuli: 12 25 12345738 -123420 20072 +Display: 00100101 10001111 -123546 20072 7526 _ +Stimuli: 13 27 12345743 -123417 20078 +Display: 00100111 10010100 -123539 20078 7533 _ +Stimuli: 14 29 12345748 -123414 20084 +Display: 00101011 10011001 -123532 20084 7540 _ +Stimuli: 15 31 12345753 -123411 20090 +Display: 00101101 10011110 -123525 20090 7547 _ +Stimuli: 16 33 12345758 -123408 20096 +Display: 00110001 10100011 -123518 20096 7554 _ +Stimuli: 17 35 12345763 -123405 20102 +Display: 00110011 10101000 -123511 20102 7561 _ +Stimuli: 18 37 12345768 -123402 20108 +Display: 00110111 10101101 -123504 20108 7568 _ +Stimuli: 19 39 12345773 -123399 20114 +Display: 00111001 10110010 -123497 20114 7575 _ +Stimuli: 20 41 12345778 -123396 20120 +Display: 00111101 10110111 -123490 20120 7582 _ +Stimuli: 21 43 12345783 -123393 20126 +Display: 00111111 10111100 -123483 20126 7589 _ +Stimuli: 22 45 12345788 -123390 20132 +Display: 01000011 11000001 -123476 20132 7596 _ +Stimuli: 23 47 12345793 -123387 20138 +Display: 01000101 11000110 -123469 20138 7603 _ +Stimuli: 24 49 12345798 -123384 20144 +Display: 01001001 11001011 -123462 20144 7610 _ +Stimuli: 25 51 12345803 -123381 20150 +Display: 01001011 11010000 -123455 20150 7617 _ +Stimuli: 26 53 12345808 -123378 20156 +Display: 01001111 11010101 -123448 20156 7624 _ +Stimuli: 27 55 12345813 -123375 20162 +Display: 01010001 11011010 -123441 20162 7631 _ +Stimuli: 28 57 12345818 -123372 20168 +Display: 01010101 11011111 -123434 20168 7638 _ +Stimuli: 29 59 12345823 -123369 20174 +Display: 01010111 11100100 -123427 20174 7645 _ +Stimuli: 30 61 12345828 -123366 20180 +Display: 01011011 11101001 -123420 20180 7652 _ +Stimuli: 31 63 12345833 -123363 20186 +Display: 01011101 11101110 -123413 20186 7659 _ +Stimuli: 32 65 12345838 -123360 20192 +Display: 01100001 11110011 -123406 20192 7666 _ +Stimuli: 33 67 12345843 -123357 20198 +Display: 01100011 11111000 -123399 20198 7673 _ +Stimuli: 34 69 12345848 -123354 20204 +Display: 01100111 11111101 -123392 20204 7680 _ +Stimuli: 35 71 12345853 -123351 20210 +Display: 01101001 00000010 -123385 20210 7687 _ +Stimuli: 36 73 12345858 -123348 20216 +Display: 01101101 00000111 -123378 20216 7694 _ +Stimuli: 37 75 12345863 -123345 20222 +Display: 01101111 00001100 -123371 20222 7701 _ +Stimuli: 38 77 12345868 -123342 20228 +Display: 01110011 00010001 -123364 20228 7708 _ +Stimuli: 39 79 12345873 -123339 20234 +Display: 01110101 00010110 -123357 20234 7715 _ +Stimuli: 40 81 12345878 -123336 20240 +Display: 01111001 00011011 -123350 20240 7722 _ +Stimuli: 41 83 12345883 -123333 20246 +Display: 01111011 00100000 -123343 20246 7729 _ +Stimuli: 42 85 12345888 -123330 20252 +Display: 01111111 00100101 -123336 20252 7736 _ +Stimuli: 43 87 12345893 -123327 20258 +Display: 10000001 00101010 -123329 20258 7743 _ +Stimuli: 44 89 12345898 -123324 20264 +Display: 10000101 00101111 -123322 20264 7750 _ +Stimuli: 45 91 12345903 -123321 20270 +Display: 10000111 00110100 -123315 20270 7757 _ +Stimuli: 46 93 12345908 -123318 20276 +Display: 10001011 00111001 -123308 20276 7764 _ +Stimuli: 47 95 12345913 -123315 20282 +Display: 10001101 00111110 -123301 20282 7771 _ +Stimuli: 48 97 12345918 -123312 20288 +Display: 10010001 01000011 -123294 20288 7778 _ +Stimuli: 49 99 12345923 -123309 20294 +Display: 10010011 01001000 -123287 20294 7785 _ +Stimuli: 50 101 12345928 -123306 20300 +Display: 10010111 01001101 -123280 20300 7792 _ +Stimuli: 51 103 12345933 -123303 20306 +Display: 10011001 01010010 -123273 20306 7799 _ +Stimuli: 52 105 12345938 -123300 20312 +Display: 10011101 01010111 -123266 20312 7806 _ +Stimuli: 53 107 12345943 -123297 20318 +Display: 10011111 01011100 -123259 20318 7813 _ +Stimuli: 54 109 12345948 -123294 20324 +Display: 10100011 01100001 -123252 20324 7820 _ +Stimuli: 55 111 12345953 -123291 20330 +Display: 10100101 01100110 -123245 20330 7827 _ +Stimuli: 56 113 12345958 -123288 20336 +Display: 10101001 01101011 -123238 20336 7834 _ +Stimuli: 57 115 12345963 -123285 20342 +Display: 10101011 01110000 -123231 20342 7841 _ +Stimuli: 58 117 12345968 -123282 20348 +Display: 10101111 01110101 -123224 20348 7848 _ +Stimuli: 59 119 12345973 -123279 20354 +Display: 10110001 01111010 -123217 20354 7855 _ +Stimuli: 60 121 12345978 -123276 20360 +Display: 10110101 01111111 -123210 20360 7862 _ +Stimuli: 61 123 12345983 -123273 20366 +Display: 10110111 10000100 -123203 20366 7869 _ +Stimuli: 62 125 12345988 -123270 20372 +Display: 10111011 10001001 -123196 20372 7876 _ +Stimuli: 63 127 12345993 -123267 20378 +Display: 10111101 10001110 -123189 20378 7883 _ +Stimuli: 64 -127 12345998 -123264 20384 +Display: 11000001 10010011 -123182 20384 7890 _ +Stimuli: 65 -125 12346003 -123261 20390 +Display: 11000011 10011000 -123175 20390 7897 _ +Stimuli: 66 -123 12346008 -123258 20396 +Display: 11000111 10011101 -123168 20396 7904 _ +Stimuli: 67 -121 12346013 -123255 20402 +Display: 11001001 10100010 -123161 20402 7911 _ +Stimuli: 68 -119 12346018 -123252 20408 +Display: 11001101 10100111 -123154 20408 7918 _ +Stimuli: 69 -117 12346023 -123249 20414 +Display: 11001111 10101100 -123147 20414 7925 _ +Stimuli: 70 -115 12346028 -123246 20420 +Display: 11010011 10110001 -123140 20420 7932 _ +Stimuli: 71 -113 12346033 -123243 20426 +Display: 11010101 10110110 -123133 20426 7939 _ +Stimuli: 72 -111 12346038 -123240 20432 +Display: 11011001 10111011 -123126 20432 7946 _ +Stimuli: 73 -109 12346043 -123237 20438 +Display: 11011011 11000000 -123119 20438 7953 _ +Stimuli: 74 -107 12346048 -123234 20444 +Display: 11011111 11000101 -123112 20444 7960 _ +Stimuli: 75 -105 12346053 -123231 20450 +Display: 11100001 11001010 -123105 20450 7967 _ +Stimuli: 76 -103 12346058 -123228 20456 +Display: 11100101 11001111 -123354 20456 7718 _ +Stimuli: 77 -101 12346063 -123225 20462 +Display: 11100111 11010100 -123347 20462 7725 _ +Stimuli: 78 -99 12346068 -123222 20468 +Display: 11101011 11011001 -123340 20468 7732 _ +Stimuli: 79 -97 12346073 -123219 20474 +Display: 11101101 11011110 -123333 20474 7739 _ +Stimuli: 80 -95 12346078 -123216 20480 +Display: 11110001 11100011 -123326 20480 7746 _ +Stimuli: 81 -93 12346083 -123213 20486 +Display: 11110011 11101000 -123319 20486 7753 _ +Stimuli: 82 -91 12346088 -123210 20492 +Display: 11110111 11101101 -123312 20492 7760 _ +Stimuli: 83 -89 12346093 -123207 20498 +Display: 11111001 11110010 -123305 20498 7767 _ +Stimuli: 84 -87 12346098 -123204 20504 +Display: 11111101 11110111 -123298 20504 7774 _ +Stimuli: 85 -85 12346103 -123201 20510 +Display: 11111111 11111100 -123291 20510 7781 _ +Stimuli: 86 -83 12346108 -123198 20516 +Display: 00000011 00000001 -123284 20516 7788 _ +Stimuli: 87 -81 12346113 -123195 20522 +Display: 00000101 00000110 -123277 20522 7795 _ +Stimuli: 88 -79 12346118 -123192 20528 +Display: 00001001 00001011 -123270 20528 7802 _ +Stimuli: 89 -77 12346123 -123189 20534 +Display: 00001011 00010000 -123263 20534 7809 _ +Stimuli: 90 -75 12346128 -123186 20540 +Display: 00001111 00010101 -123256 20540 7816 _ +Stimuli: 91 -73 12346133 -123183 20546 +Display: 00010001 00011010 -123249 20546 7823 _ +Stimuli: 92 -71 12346138 -123180 20552 +Display: 00010101 00011111 -123242 20552 7830 _ +Stimuli: 93 -69 12346143 -123177 20558 +Display: 00010111 00100100 -123235 20558 7837 _ +Stimuli: 94 -67 12346148 -123174 20564 +Display: 00011011 00101001 -123228 20564 7844 _ +Stimuli: 95 -65 12346153 -123171 20570 +Display: 00011101 00101110 -123221 20570 7851 _ +Stimuli: 96 -63 12346158 -123168 20576 +Display: 00100001 00110011 -123214 20576 7858 _ +Stimuli: 97 -61 12346163 -123165 20582 +Display: 00100011 00111000 -123207 20582 7865 _ +Stimuli: 98 -59 12346168 -123162 20588 +Display: 00100111 00111101 -123200 20588 7872 _ +Stimuli: 99 -57 12346173 -123159 20594 +Display: 00101001 01000010 -123193 20594 7879 _ + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/golden/datatypes.log.linuxaarch64 b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/golden/datatypes.log.linuxaarch64 new file mode 100644 index 000000000..27e506ff1 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/golden/datatypes.log.linuxaarch64 @@ -0,0 +1,203 @@ +SystemC Simulation +Stimuli: 0 1 12345678 -123456 20000 +Display: 00000001 01010011 -123374 20000 7698 _ +Stimuli: 1 3 12345683 -123453 20006 +Display: 00000011 01011000 -123367 20006 7705 _ +Stimuli: 2 5 12345688 -123450 20012 +Display: 00000111 01011101 -123360 20012 7712 _ +Stimuli: 3 7 12345693 -123447 20018 +Display: 00001001 01100010 -123353 20018 7719 _ +Stimuli: 4 9 12345698 -123444 20024 +Display: 00001101 01100111 -123346 20024 7726 _ +Stimuli: 5 11 12345703 -123441 20030 +Display: 00001111 01101100 -123339 20030 7733 _ +Stimuli: 6 13 12345708 -123438 20036 +Display: 00010011 01110001 -123332 20036 7740 _ +Stimuli: 7 15 12345713 -123435 20042 +Display: 00010101 01110110 -123325 20042 7747 _ +Stimuli: 8 17 12345718 -123432 20048 +Display: 00011001 01111011 -123318 20048 7754 _ +Stimuli: 9 19 12345723 -123429 20054 +Display: 00011011 10000000 -123311 20054 7761 _ +Stimuli: 10 21 12345728 -123426 20060 +Display: 00011111 10000101 -123304 20060 7768 _ +Stimuli: 11 23 12345733 -123423 20066 +Display: 00100001 10001010 -123297 20066 7775 _ +Stimuli: 12 25 12345738 -123420 20072 +Display: 00100101 10001111 -123290 20072 7782 _ +Stimuli: 13 27 12345743 -123417 20078 +Display: 00100111 10010100 -123283 20078 7789 _ +Stimuli: 14 29 12345748 -123414 20084 +Display: 00101011 10011001 -123276 20084 7796 _ +Stimuli: 15 31 12345753 -123411 20090 +Display: 00101101 10011110 -123269 20090 7803 _ +Stimuli: 16 33 12345758 -123408 20096 +Display: 00110001 10100011 -123262 20096 7810 _ +Stimuli: 17 35 12345763 -123405 20102 +Display: 00110011 10101000 -123255 20102 7817 _ +Stimuli: 18 37 12345768 -123402 20108 +Display: 00110111 10101101 -123248 20108 7824 _ +Stimuli: 19 39 12345773 -123399 20114 +Display: 00111001 10110010 -123241 20114 7831 _ +Stimuli: 20 41 12345778 -123396 20120 +Display: 00111101 10110111 -123234 20120 7838 _ +Stimuli: 21 43 12345783 -123393 20126 +Display: 00111111 10111100 -123227 20126 7845 _ +Stimuli: 22 45 12345788 -123390 20132 +Display: 01000011 11000001 -123220 20132 7852 _ +Stimuli: 23 47 12345793 -123387 20138 +Display: 01000101 11000110 -123213 20138 7859 _ +Stimuli: 24 49 12345798 -123384 20144 +Display: 01001001 11001011 -123206 20144 7866 _ +Stimuli: 25 51 12345803 -123381 20150 +Display: 01001011 11010000 -123199 20150 7873 _ +Stimuli: 26 53 12345808 -123378 20156 +Display: 01001111 11010101 -123192 20156 7880 _ +Stimuli: 27 55 12345813 -123375 20162 +Display: 01010001 11011010 -123185 20162 7887 _ +Stimuli: 28 57 12345818 -123372 20168 +Display: 01010101 11011111 -123178 20168 7894 _ +Stimuli: 29 59 12345823 -123369 20174 +Display: 01010111 11100100 -123171 20174 7901 _ +Stimuli: 30 61 12345828 -123366 20180 +Display: 01011011 11101001 -123164 20180 7908 _ +Stimuli: 31 63 12345833 -123363 20186 +Display: 01011101 11101110 -123157 20186 7915 _ +Stimuli: 32 65 12345838 -123360 20192 +Display: 01100001 11110011 -123150 20192 7922 _ +Stimuli: 33 67 12345843 -123357 20198 +Display: 01100011 11111000 -123143 20198 7929 _ +Stimuli: 34 69 12345848 -123354 20204 +Display: 01100111 11111101 -123136 20204 7936 _ +Stimuli: 35 71 12345853 -123351 20210 +Display: 01101001 00000010 -123129 20210 7943 _ +Stimuli: 36 73 12345858 -123348 20216 +Display: 01101101 00000111 -123122 20216 7950 _ +Stimuli: 37 75 12345863 -123345 20222 +Display: 01101111 00001100 -123115 20222 7957 _ +Stimuli: 38 77 12345868 -123342 20228 +Display: 01110011 00010001 -123108 20228 7964 _ +Stimuli: 39 79 12345873 -123339 20234 +Display: 01110101 00010110 -123101 20234 7971 _ +Stimuli: 40 81 12345878 -123336 20240 +Display: 01111001 00011011 -123094 20240 7978 _ +Stimuli: 41 83 12345883 -123333 20246 +Display: 01111011 00100000 -123087 20246 7985 _ +Stimuli: 42 85 12345888 -123330 20252 +Display: 01111111 00100101 -123080 20252 7992 _ +Stimuli: 43 87 12345893 -123327 20258 +Display: 10000001 00101010 -123073 20258 7999 _ +Stimuli: 44 89 12345898 -123324 20264 +Display: 10000101 00101111 -123322 20264 7750 _ +Stimuli: 45 91 12345903 -123321 20270 +Display: 10000111 00110100 -123315 20270 7757 _ +Stimuli: 46 93 12345908 -123318 20276 +Display: 10001011 00111001 -123308 20276 7764 _ +Stimuli: 47 95 12345913 -123315 20282 +Display: 10001101 00111110 -123301 20282 7771 _ +Stimuli: 48 97 12345918 -123312 20288 +Display: 10010001 01000011 -123294 20288 7778 _ +Stimuli: 49 99 12345923 -123309 20294 +Display: 10010011 01001000 -123287 20294 7785 _ +Stimuli: 50 101 12345928 -123306 20300 +Display: 10010111 01001101 -123280 20300 7792 _ +Stimuli: 51 103 12345933 -123303 20306 +Display: 10011001 01010010 -123273 20306 7799 _ +Stimuli: 52 105 12345938 -123300 20312 +Display: 10011101 01010111 -123266 20312 7806 _ +Stimuli: 53 107 12345943 -123297 20318 +Display: 10011111 01011100 -123259 20318 7813 _ +Stimuli: 54 109 12345948 -123294 20324 +Display: 10100011 01100001 -123252 20324 7820 _ +Stimuli: 55 111 12345953 -123291 20330 +Display: 10100101 01100110 -123245 20330 7827 _ +Stimuli: 56 113 12345958 -123288 20336 +Display: 10101001 01101011 -123238 20336 7834 _ +Stimuli: 57 115 12345963 -123285 20342 +Display: 10101011 01110000 -123231 20342 7841 _ +Stimuli: 58 117 12345968 -123282 20348 +Display: 10101111 01110101 -123224 20348 7848 _ +Stimuli: 59 119 12345973 -123279 20354 +Display: 10110001 01111010 -123217 20354 7855 _ +Stimuli: 60 121 12345978 -123276 20360 +Display: 10110101 01111111 -123210 20360 7862 _ +Stimuli: 61 123 12345983 -123273 20366 +Display: 10110111 10000100 -123203 20366 7869 _ +Stimuli: 62 125 12345988 -123270 20372 +Display: 10111011 10001001 -123196 20372 7876 _ +Stimuli: 63 127 12345993 -123267 20378 +Display: 10111101 10001110 -123189 20378 7883 _ +Stimuli: 64 -127 12345998 -123264 20384 +Display: 11000001 10010011 -123182 20384 7890 _ +Stimuli: 65 -125 12346003 -123261 20390 +Display: 11000011 10011000 -123175 20390 7897 _ +Stimuli: 66 -123 12346008 -123258 20396 +Display: 11000111 10011101 -123168 20396 7904 _ +Stimuli: 67 -121 12346013 -123255 20402 +Display: 11001001 10100010 -123161 20402 7911 _ +Stimuli: 68 -119 12346018 -123252 20408 +Display: 11001101 10100111 -123154 20408 7918 _ +Stimuli: 69 -117 12346023 -123249 20414 +Display: 11001111 10101100 -123147 20414 7925 _ +Stimuli: 70 -115 12346028 -123246 20420 +Display: 11010011 10110001 -123140 20420 7932 _ +Stimuli: 71 -113 12346033 -123243 20426 +Display: 11010101 10110110 -123133 20426 7939 _ +Stimuli: 72 -111 12346038 -123240 20432 +Display: 11011001 10111011 -123126 20432 7946 _ +Stimuli: 73 -109 12346043 -123237 20438 +Display: 11011011 11000000 -123119 20438 7953 _ +Stimuli: 74 -107 12346048 -123234 20444 +Display: 11011111 11000101 -123112 20444 7960 _ +Stimuli: 75 -105 12346053 -123231 20450 +Display: 11100001 11001010 -123105 20450 7967 _ +Stimuli: 76 -103 12346058 -123228 20456 +Display: 11100101 11001111 -123098 20456 7974 _ +Stimuli: 77 -101 12346063 -123225 20462 +Display: 11100111 11010100 -123091 20462 7981 _ +Stimuli: 78 -99 12346068 -123222 20468 +Display: 11101011 11011001 -123084 20468 7988 _ +Stimuli: 79 -97 12346073 -123219 20474 +Display: 11101101 11011110 -123077 20474 7995 _ +Stimuli: 80 -95 12346078 -123216 20480 +Display: 11110001 11100011 -123070 20480 8002 _ +Stimuli: 81 -93 12346083 -123213 20486 +Display: 11110011 11101000 -123063 20486 8009 _ +Stimuli: 82 -91 12346088 -123210 20492 +Display: 11110111 11101101 -123056 20492 8016 _ +Stimuli: 83 -89 12346093 -123207 20498 +Display: 11111001 11110010 -123049 20498 8023 _ +Stimuli: 84 -87 12346098 -123204 20504 +Display: 11111101 11110111 -123042 20504 8030 _ +Stimuli: 85 -85 12346103 -123201 20510 +Display: 11111111 11111100 -123035 20510 8037 _ +Stimuli: 86 -83 12346108 -123198 20516 +Display: 00000011 00000001 -123028 20516 8044 _ +Stimuli: 87 -81 12346113 -123195 20522 +Display: 00000101 00000110 -123021 20522 8051 _ +Stimuli: 88 -79 12346118 -123192 20528 +Display: 00001001 00001011 -123014 20528 8058 _ +Stimuli: 89 -77 12346123 -123189 20534 +Display: 00001011 00010000 -123007 20534 8065 _ +Stimuli: 90 -75 12346128 -123186 20540 +Display: 00001111 00010101 -123000 20540 8072 _ +Stimuli: 91 -73 12346133 -123183 20546 +Display: 00010001 00011010 -122993 20546 8079 _ +Stimuli: 92 -71 12346138 -123180 20552 +Display: 00010101 00011111 -122986 20552 8086 _ +Stimuli: 93 -69 12346143 -123177 20558 +Display: 00010111 00100100 -122979 20558 8093 _ +Stimuli: 94 -67 12346148 -123174 20564 +Display: 00011011 00101001 -122972 20564 8100 _ +Stimuli: 95 -65 12346153 -123171 20570 +Display: 00011101 00101110 -122965 20570 8107 _ +Stimuli: 96 -63 12346158 -123168 20576 +Display: 00100001 00110011 -122958 20576 8114 _ +Stimuli: 97 -61 12346163 -123165 20582 +Display: 00100011 00111000 -122951 20582 8121 _ +Stimuli: 98 -59 12346168 -123162 20588 +Display: 00100111 00111101 -122944 20588 8128 _ +Stimuli: 99 -57 12346173 -123159 20594 +Display: 00101001 01000010 -122937 20594 8135 _ + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/main.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/main.cpp new file mode 100644 index 000000000..ab653c040 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/main.cpp @@ -0,0 +1,108 @@ +/***************************************************************************** + + 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: Stan Liao, Synopsys, Inc., 1999-09-21 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "stimulus.h" +#include "display.h" +#include "datatypes.h" + +int sc_main (int argc , char *argv[]) { + sc_clock clock; + sc_signal<bool> reset; + sc_signal_bool_vector stimulus_line1; + sc_signal_bool_vector stimulus_line2; + sc_signal<long> stimulus_line3; + sc_signal<int> stimulus_line4; + sc_signal<short> stimulus_line5; + sc_signal<char> stimulus_line6; + sc_signal<bool> input_valid; + sc_signal<bool> ack; + sc_signal<bool> output_valid; + sc_signal_bool_vector result_line1; + sc_signal_bool_vector result_line2; + sc_signal<long> result_line3; + sc_signal<int> result_line4; + sc_signal<short> result_line5; + sc_signal<char> result_line6; + + output_valid = 0; + + stimulus stimulus1("stimulus_block", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + stimulus_line6, + input_valid, + ack); + + datatypes datatypes1( "process_body", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + stimulus_line6, + input_valid, + ack, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + result_line6, + output_valid); + + display display1( "display_block", + clock, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + result_line6, + output_valid); + + sc_start(); + return 0; +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/stimulus.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/stimulus.cpp new file mode 100644 index 000000000..79a2d896a --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/stimulus.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. + + *****************************************************************************/ + +/***************************************************************************** + + stimulus.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-14 + + *****************************************************************************/ + +/***************************************************************************** + + 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() { + + reset.write(true); + wait(); + reset.write(false); + + sc_signed tmp1(8); + sc_signed tmp2(8); + long tmp3; + int tmp4; + short tmp5; + char tmp6; + + int counter = 0; + tmp1 = "00000000"; + tmp2 = "00000001"; + tmp3 = 12345678; + tmp4 = -123456; + tmp5 = 20000; + tmp6 = 'R'; + + + while(counter<100){ + out_valid.write(true); + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_value6.write(tmp6); + cout << "Stimuli: " << tmp1 << " " << tmp2 << " " << tmp3 << " " << tmp4 << " " << tmp5 << " " << endl; + tmp1 = tmp1 + 1; + tmp2 = tmp2 + 2; + tmp3 = tmp3 + 5; + tmp4 = tmp4 + 3; + tmp5 = tmp5 + 6; + tmp6 = tmp6 + 4; + do { wait(); } while (in_ack==false); + out_valid.write(false); + counter++; + wait(); + } + sc_stop(); +} +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/stimulus.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/stimulus.h new file mode 100644 index 000000000..689995a6a --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/datatypes/stimulus.h @@ -0,0 +1,89 @@ +/***************************************************************************** + + 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-14 + + *****************************************************************************/ + +/***************************************************************************** + + 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<bool>& reset; + sc_signal_bool_vector& out_value1; // Output port + sc_signal_bool_vector& out_value2; // Output port + sc_signal<long>& out_value3; // Output port + sc_signal<int>& out_value4; // Output port + sc_signal<short>& out_value5; // Output port + sc_signal<char>& out_value6; // Output port + sc_signal<bool>& out_valid; // Output port + const sc_signal<bool>& in_ack; + + // + // Constructor + // + + stimulus( + sc_module_name NAME, // reference name + sc_clock& CLK, // clock + sc_signal<bool>& RESET, + sc_signal_bool_vector& OUT_VALUE1, + sc_signal_bool_vector& OUT_VALUE2, + sc_signal<long>& OUT_VALUE3, + sc_signal<int>& OUT_VALUE4, + sc_signal<short>& OUT_VALUE5, + sc_signal<char>& OUT_VALUE6, + sc_signal<bool>& OUT_VALID, + const sc_signal<bool>& IN_ACK + ) + : + reset (RESET), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_value3 (OUT_VALUE3), + out_value4 (OUT_VALUE4), + out_value5 (OUT_VALUE5), + out_value6 (OUT_VALUE6), + out_valid (OUT_VALID), + in_ack (IN_ACK) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + }; + void entry(); +}; +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/common.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/common.h new file mode 100644 index 000000000..b0b56195b --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/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_bv<5> > sc_signal_bool_vector; + +#endif diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/display.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/display.cpp new file mode 100644 index 000000000..64c5ee2b4 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/display.cpp @@ -0,0 +1,58 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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(1) { + // Reading Data, and Counter i,j is counted up.
+ while (in_valid.read()==false) wait(); + cout << "Display : " << in_data1.read() << " " + << in_data2.read() << " " + << " at " << sc_time_stamp() << endl; + + i++; + if(i == 24) sc_stop(); + wait(); + } +} + + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/display.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/display.h new file mode 100644 index 000000000..21e3c27fd --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/display.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + display.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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<int>& in_data1; // Input port + const sc_signal_bool_vector& in_data2; // Input port + const sc_signal<bool>& in_valid; + + display( sc_module_name NAME, + sc_clock& CLK, + const sc_signal<int>& IN_DATA1, + const sc_signal_bool_vector& IN_DATA2, + const sc_signal<bool>& IN_VALID + ) + : + in_data1(IN_DATA1), + in_data2(IN_DATA2), + in_valid(IN_VALID) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/golden/increment.log b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/golden/increment.log new file mode 100644 index 000000000..e8205e774 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/golden/increment.log @@ -0,0 +1,51 @@ +SystemC Simulation +Stimuli : 0 0 at 23 ns +Display : 3 00011 at 27 ns +Stimuli : 4 4 at 44 ns +Display : 7 00111 at 48 ns +Stimuli : 8 8 at 65 ns +Display : 11 01011 at 69 ns +Stimuli : 12 12 at 86 ns +Display : 15 01111 at 90 ns +Stimuli : 16 -16 at 107 ns +Display : 19 10011 at 111 ns +Stimuli : 20 -12 at 128 ns +Display : 23 10111 at 132 ns +Stimuli : 24 -8 at 149 ns +Display : 27 11011 at 153 ns +Stimuli : 28 -4 at 170 ns +Display : 31 11111 at 174 ns +Stimuli : 32 0 at 191 ns +Display : 35 00011 at 195 ns +Stimuli : 36 4 at 212 ns +Display : 39 00111 at 216 ns +Stimuli : 40 8 at 233 ns +Display : 43 01011 at 237 ns +Stimuli : 44 12 at 254 ns +Display : 47 01111 at 258 ns +Stimuli : 48 -16 at 275 ns +Display : 51 10011 at 279 ns +Stimuli : 52 -12 at 296 ns +Display : 55 10111 at 300 ns +Stimuli : 56 -8 at 317 ns +Display : 59 11011 at 321 ns +Stimuli : 60 -4 at 338 ns +Display : 63 11111 at 342 ns +Stimuli : 64 0 at 359 ns +Display : 67 00011 at 363 ns +Stimuli : 68 4 at 380 ns +Display : 71 00111 at 384 ns +Stimuli : 72 8 at 401 ns +Display : 75 01011 at 405 ns +Stimuli : 76 12 at 422 ns +Display : 79 01111 at 426 ns +Stimuli : 80 -16 at 443 ns +Display : 83 10011 at 447 ns +Stimuli : 84 -12 at 464 ns +Display : 87 10111 at 468 ns +Stimuli : 88 -8 at 485 ns +Display : 91 11011 at 489 ns +Stimuli : 92 -4 at 506 ns +Display : 95 11111 at 510 ns + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.cpp new file mode 100644 index 000000000..3b32d2317 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.cpp @@ -0,0 +1,85 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + increment.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "increment.h" + +void increment::entry(){ + + #define ONE 1 + const int eins = 1; + int tmp1; + sc_bigint<5> tmp2; + + // reset_loop + if (reset.read() == true) { + out_valid.write(false); + wait(); + } else wait(); + + // + // main loop + // + // + while(1) { + while(in_valid.read()==false) wait(); + wait(); + + //reading the inputs + tmp1 = in_value1.read(); + tmp2 = in_value2.read(); + + //execute simple operations + tmp1 = tmp1 + 1; + tmp1 = tmp1 + ONE; + tmp1 = tmp1 + eins; + tmp2 = tmp2 + 1; + tmp2 = tmp2 + ONE; + tmp2 = tmp2 + eins; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.f b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.f new file mode 100644 index 000000000..3e7b5f3b7 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.f @@ -0,0 +1,4 @@ +increment/stimulus.cpp +increment/display.cpp +increment/increment.cpp +increment/main.cpp diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.h new file mode 100644 index 000000000..30093ede8 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/increment.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + increment.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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( increment ) +{ + SC_HAS_PROCESS( increment ); + + sc_in_clk clk; + + //==================================================================== + // [C] Always Needed Member Function + // -- constructor + // -- entry + //==================================================================== + + const sc_signal<bool>& reset ; + const sc_signal<int>& in_value1; // Input port + const sc_signal_bool_vector& in_value2; // Input port + const sc_signal<bool>& in_valid; // Input port + sc_signal<int>& out_value1; // Output port + sc_signal_bool_vector& out_value2; // Output port + sc_signal<bool>& out_valid; // Output port + + // + // Constructor + // + + increment ( + sc_module_name NAME, // referense name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal<int>& IN_VALUE1, + const sc_signal_bool_vector& IN_VALUE2, + const sc_signal<bool>& IN_VALID, // Input port + sc_signal<int>& OUT_VALUE1, + sc_signal_bool_vector& OUT_VALUE2, + sc_signal<bool>& OUT_VALID // Output port + ) + : + reset (RESET), + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_valid (IN_VALID), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_valid (OUT_VALID) + + { + 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/arith/addition/increment/main.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/main.cpp new file mode 100644 index 000000000..6189f9dc5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/main.cpp @@ -0,0 +1,79 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "stimulus.h" +#include "display.h" +#include "increment.h" + +int sc_main (int argc , char *argv[]) { + sc_clock clock; + sc_signal<bool> reset; + sc_signal<int> stimulus_line1; + sc_signal_bool_vector stimulus_line2; + sc_signal<bool> input_valid; + sc_signal<bool> output_valid; + sc_signal<int> result_line1; + sc_signal_bool_vector result_line2; + + stimulus stimulus1("stimulus_block", + clock, + reset, + stimulus_line1, + stimulus_line2, + input_valid); + + increment increment1 ( "process_body", + clock, + reset, + stimulus_line1, + stimulus_line2, + input_valid, + result_line1, + result_line2, + output_valid); + + display display1 ( "display", + clock, + result_line1, + result_line2, + output_valid); + + sc_start(); + return 0; +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/stimulus.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/stimulus.cpp new file mode 100644 index 000000000..9f22a9c34 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/stimulus.cpp @@ -0,0 +1,69 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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 send_value1 = 0; + sc_signed send_value2(5); + + // sending some reset values + reset.write(true); + out_valid.write(false); + send_value2 = 0; + out_stimulus1.write(0); + out_stimulus2.write(0); + wait(3); + reset.write(false); + // sending normal mode values + while(true){ + wait(20); + out_stimulus1.write( send_value1 ); + out_stimulus2.write( send_value2 ); + out_valid.write( true ); + cout << "Stimuli : " << send_value1 << " " + << send_value2 << " at " + << sc_time_stamp() << endl; + send_value1 = send_value1+4; + send_value2 = send_value2+4; + wait(); + out_valid.write( false ); + } +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/stimulus.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/stimulus.h new file mode 100644 index 000000000..0bda545fa --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/increment/stimulus.h @@ -0,0 +1,71 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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<bool>& reset; + sc_signal<int>& out_stimulus1; + sc_signal_bool_vector& out_stimulus2; + sc_signal<bool>& out_valid; + + stimulus(sc_module_name NAME, + sc_clock& CLK, + sc_signal<bool>& RESET, + sc_signal<int>& OUT_STIMULUS1, + sc_signal_bool_vector& OUT_STIMULUS2, + sc_signal<bool>& OUT_VALID + ) + : + reset(RESET), + out_stimulus1(OUT_STIMULUS1), + out_stimulus2(OUT_STIMULUS2), + out_valid(OUT_VALID) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/common.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/common.h new file mode 100644 index 000000000..60baad076 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/common.h @@ -0,0 +1,49 @@ +/***************************************************************************** + + 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_bv<4> > sc_signal_bool_vector4; +typedef sc_signal<sc_bv<5> > sc_signal_bool_vector5; +typedef sc_signal<sc_bv<6> > sc_signal_bool_vector6; +typedef sc_signal<sc_bv<7> > sc_signal_bool_vector7; +typedef sc_signal<sc_bv<8> > sc_signal_bool_vector8; + +#endif diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/display.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/display.cpp new file mode 100644 index 000000000..b13920d6c --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/display.cpp @@ -0,0 +1,62 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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(1) { + // Reading Data, and Counter i,j is counted up.
+ while (in_valid.read()==false) wait(); + cout << "Display : " + << in_data1.read() << " " + << in_data3.read() << " " + << in_data3.read() << " " + << in_data4.read() << " " + << in_data5.read() << " " + << " at " << sc_time_stamp() << endl; + + i++; + if(i == 24) sc_stop(); + wait(); + } +} + + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/display.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/display.h new file mode 100644 index 000000000..524ee27b0 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/display.h @@ -0,0 +1,77 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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_vector4& in_data1; // Input port + const sc_signal_bool_vector5& in_data2; // Input port + const sc_signal_bool_vector6& in_data3; // Input port + const sc_signal_bool_vector7& in_data4; // Input port + const sc_signal_bool_vector8& in_data5; // Input port + const sc_signal<bool>& in_valid; + + display( sc_module_name NAME, + sc_clock& CLK, + const sc_signal_bool_vector4& IN_DATA1, + const sc_signal_bool_vector5& IN_DATA2, + const sc_signal_bool_vector6& IN_DATA3, + const sc_signal_bool_vector7& IN_DATA4, + const sc_signal_bool_vector8& IN_DATA5, + const sc_signal<bool>& IN_VALID + ) + : + in_data1(IN_DATA1), + in_data2(IN_DATA2), + in_data3(IN_DATA3), + in_data4(IN_DATA4), + in_data5(IN_DATA5), + in_valid(IN_VALID) + { + clk(CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/golden/sharing.log b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/golden/sharing.log new file mode 100644 index 000000000..dda9320f3 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/golden/sharing.log @@ -0,0 +1,39 @@ +SystemC Simulation +Stimuli : 0 0 0 0 0 at 23 ns +Display : 1010 001010 001010 0001010 00001010 at 27 ns +Display : 1011 001011 001011 0010100 00001011 at 30 ns +Stimuli : 1 1 1 1 1 at 44 ns +Display : 1011 001011 001011 0001011 00001011 at 48 ns +Display : 1100 001100 001100 0010101 00001100 at 51 ns +Stimuli : 2 2 2 2 2 at 65 ns +Display : 1100 001100 001100 0001100 00001100 at 69 ns +Display : 1101 001101 001101 0010110 00001101 at 72 ns +Stimuli : 3 3 3 3 3 at 86 ns +Display : 1101 001101 001101 0001101 00001101 at 90 ns +Display : 1110 001110 001110 0010111 00001110 at 93 ns +Stimuli : 4 4 4 4 4 at 107 ns +Display : 1110 001110 001110 0001110 00001110 at 111 ns +Display : 1111 001111 001111 0011000 00001111 at 114 ns +Stimuli : 5 5 5 5 5 at 128 ns +Display : 1111 001111 001111 0001111 00001111 at 132 ns +Display : 0000 010000 010000 0011001 00010000 at 135 ns +Stimuli : 6 6 6 6 6 at 149 ns +Display : 0000 010000 010000 0010000 00010000 at 153 ns +Display : 0001 010001 010001 0011010 00010001 at 156 ns +Stimuli : 7 7 7 7 7 at 170 ns +Display : 0001 010001 010001 0010001 00010001 at 174 ns +Display : 0010 010010 010010 0011011 00010010 at 177 ns +Stimuli : -8 8 8 8 8 at 191 ns +Display : 0010 010010 010010 0010010 00010010 at 195 ns +Display : 0011 010011 010011 0011100 00010011 at 198 ns +Stimuli : -7 9 9 9 9 at 212 ns +Display : 0011 010011 010011 0010011 00010011 at 216 ns +Display : 0100 010100 010100 0011101 00010100 at 219 ns +Stimuli : -6 10 10 10 10 at 233 ns +Display : 0100 010100 010100 0010100 00010100 at 237 ns +Display : 0101 010101 010101 0011110 00010101 at 240 ns +Stimuli : -5 11 11 11 11 at 254 ns +Display : 0101 010101 010101 0010101 00010101 at 258 ns +Display : 0110 010110 010110 0011111 00010110 at 261 ns + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/main.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/main.cpp new file mode 100644 index 000000000..056a41e79 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/main.cpp @@ -0,0 +1,97 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "stimulus.h" +#include "display.h" +#include "sharing.h" + +int sc_main (int argc , char *argv[]) { + sc_clock clock; + sc_signal<bool> reset; + sc_signal_bool_vector4 stimulus_line1; + sc_signal_bool_vector5 stimulus_line2; + sc_signal_bool_vector6 stimulus_line3; + sc_signal_bool_vector7 stimulus_line4; + sc_signal_bool_vector8 stimulus_line5; + sc_signal<bool> input_valid; + sc_signal<bool> output_valid; + sc_signal_bool_vector4 result_line1; + sc_signal_bool_vector5 result_line2; + sc_signal_bool_vector6 result_line3; + sc_signal_bool_vector7 result_line4; + sc_signal_bool_vector8 result_line5; + + stimulus stimulus1("stimulus_block", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + input_valid); + + sharing sharing1 ( "process_body", + clock, + reset, + stimulus_line1, + stimulus_line2, + stimulus_line3, + stimulus_line4, + stimulus_line5, + input_valid, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + output_valid); + + display display1 ( "display", + clock, + result_line1, + result_line2, + result_line3, + result_line4, + result_line5, + output_valid); + + sc_start(); + return 0; +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.cpp new file mode 100644 index 000000000..aa1dca4c5 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.cpp @@ -0,0 +1,109 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + sharing.cpp -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-09 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +#include "sharing.h" + +void sharing::entry(){ + + sc_bigint<4> tmp1; + sc_biguint<5> tmp2; + sc_bigint<6> tmp3; + sc_biguint<7> tmp4; + sc_biguint<8> tmp5; + + // reset_loop + if (reset.read() == true) { + out_valid.write(false); + wait(); + } else wait(); + + // + // main loop + // + // + while(1) { + while(in_valid.read()==false) wait(); + wait(); + + //reading the inputs + tmp1 = in_value1.read(); + tmp2 = in_value2.read(); + tmp3 = in_value3.read(); + tmp4 = in_value4.read(); + tmp5 = in_value5.read(); + + //execute simple operations + tmp1 = tmp1 + 10; + tmp2 = tmp2 + 10; + tmp3 = tmp3 + 10; + tmp4 = tmp4 + 10; + tmp5 = tmp5 + 10; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + //execute simple operations + tmp1 = tmp1 + 1; + tmp2 = tmp2 + 10; + tmp3 = tmp3 + 1; + tmp4 = tmp4 + 10; + tmp5 = tmp5 + 1; + wait(); + + // write outputs + out_value1.write(tmp1); + out_value2.write(tmp2); + out_value3.write(tmp3); + out_value4.write(tmp4); + out_value5.write(tmp5); + out_valid.write(true); + wait(); + out_valid.write(false); + wait(); + } +} + +// EOF + diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.f b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.f new file mode 100644 index 000000000..0c0f3ff29 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.f @@ -0,0 +1,4 @@ +sharing/stimulus.cpp +sharing/display.cpp +sharing/sharing.cpp +sharing/main.cpp diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.h new file mode 100644 index 000000000..d185d964c --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/sharing.h @@ -0,0 +1,108 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + sharing.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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( sharing ) +{ + SC_HAS_PROCESS( sharing ); + + sc_in_clk clk; + + const sc_signal<bool>& reset ; + const sc_signal_bool_vector4& in_value1; // Input port + const sc_signal_bool_vector5& in_value2; // Input port + const sc_signal_bool_vector6& in_value3; // Input port + const sc_signal_bool_vector7& in_value4; // Input port + const sc_signal_bool_vector8& in_value5; // Input port + const sc_signal<bool>& in_valid; // Input port + sc_signal_bool_vector4& out_value1; // Output port + sc_signal_bool_vector5& out_value2; // Output port + sc_signal_bool_vector6& out_value3; // Output port + sc_signal_bool_vector7& out_value4; // Output port + sc_signal_bool_vector8& out_value5; // Output port + sc_signal<bool>& out_valid; // Output port + + // + // Constructor + // + + sharing ( + sc_module_name NAME, // referense name + sc_clock& CLK, // clock + const sc_signal<bool>& RESET, + const sc_signal_bool_vector4& IN_VALUE1, + const sc_signal_bool_vector5& IN_VALUE2, + const sc_signal_bool_vector6& IN_VALUE3, + const sc_signal_bool_vector7& IN_VALUE4, + const sc_signal_bool_vector8& IN_VALUE5, + const sc_signal<bool>& IN_VALID, // Input port + sc_signal_bool_vector4& OUT_VALUE1, + sc_signal_bool_vector5& OUT_VALUE2, + sc_signal_bool_vector6& OUT_VALUE3, + sc_signal_bool_vector7& OUT_VALUE4, + sc_signal_bool_vector8& OUT_VALUE5, + sc_signal<bool>& OUT_VALID // Output port + ) + : + reset (RESET), + in_value1 (IN_VALUE1), + in_value2 (IN_VALUE2), + in_value3 (IN_VALUE3), + in_value4 (IN_VALUE4), + in_value5 (IN_VALUE5), + in_valid (IN_VALID), + out_value1 (OUT_VALUE1), + out_value2 (OUT_VALUE2), + out_value3 (OUT_VALUE3), + out_value4 (OUT_VALUE4), + out_value5 (OUT_VALUE5), + out_valid (OUT_VALID) + + { + 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/arith/addition/sharing/stimulus.cpp b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/stimulus.cpp new file mode 100644 index 000000000..7b71dd7a7 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/stimulus.cpp @@ -0,0 +1,88 @@ +/***************************************************************************** + + 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-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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() { + sc_bigint<4> send_value1; + sc_biguint<5> send_value2; + sc_bigint<6> send_value3; + sc_biguint<7> send_value4; + sc_biguint<8> send_value5; + + + // sending some reset values + reset.write(true); + out_valid.write(false); + send_value1 = 0; + send_value2 = 0; + send_value3 = 0; + send_value4 = 0; + send_value5 = 0; + out_stimulus1.write(0); + out_stimulus2.write(0); + out_stimulus3.write(0); + out_stimulus4.write(0); + out_stimulus5.write(0); + wait(3); + reset.write(false); + // sending normal mode values + while(true){ + wait(20); + out_stimulus1.write( send_value1 ); + out_stimulus2.write( send_value2 ); + out_stimulus3.write( send_value3 ); + out_stimulus4.write( send_value4 ); + out_stimulus5.write( send_value5 ); + out_valid.write( true ); + cout << "Stimuli : " << send_value1 << " " + << send_value2 << " " + << send_value3 << " " + << send_value4 << " " + << send_value5 << " " << " at " + << sc_time_stamp() << endl; + send_value1 = send_value1+1; + send_value2 = send_value2+1; + send_value3 = send_value3+1; + send_value4 = send_value4+1; + send_value5 = send_value5+1; + wait(); + out_valid.write( false ); + } +} + +// EOF diff --git a/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/stimulus.h b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/stimulus.h new file mode 100644 index 000000000..28a75e233 --- /dev/null +++ b/src/systemc/tests/systemc/misc/cae_test/general/arith/addition/sharing/stimulus.h @@ -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. + + *****************************************************************************/ + +/***************************************************************************** + + stimulus.h -- + + Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-09 + + *****************************************************************************/ + +/***************************************************************************** + + 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<bool>& reset; + sc_signal_bool_vector4& out_stimulus1; + sc_signal_bool_vector5& out_stimulus2; + sc_signal_bool_vector6& out_stimulus3; + sc_signal_bool_vector7& out_stimulus4; + sc_signal_bool_vector8& out_stimulus5; + sc_signal<bool>& out_valid; + + stimulus(sc_module_name NAME, + sc_clock& CLK, + sc_signal<bool>& RESET, + sc_signal_bool_vector4& OUT_STIMULUS1, + sc_signal_bool_vector5& OUT_STIMULUS2, + sc_signal_bool_vector6& OUT_STIMULUS3, + sc_signal_bool_vector7& OUT_STIMULUS4, + sc_signal_bool_vector8& OUT_STIMULUS5, + sc_signal<bool>& OUT_VALID + ) + : + reset(RESET), + out_stimulus1(OUT_STIMULUS1), + out_stimulus2(OUT_STIMULUS2), + out_stimulus3(OUT_STIMULUS3), + out_stimulus4(OUT_STIMULUS4), + out_stimulus5(OUT_STIMULUS5), + out_valid(OUT_VALID) + { + clk (CLK); + SC_CTHREAD( entry, clk.pos() ); + } + + void entry(); +}; + +// EOF |