diff options
Diffstat (limited to 'src/systemc/tests/systemc/misc/user_guide/param_model')
8 files changed, 744 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/common.h b/src/systemc/tests/systemc/misc/user_guide/param_model/common.h new file mode 100644 index 000000000..43c767bcc --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/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> > signal_bool_vector; + +#endif diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/golden/param_model.log b/src/systemc/tests/systemc/misc/user_guide/param_model/golden/param_model.log new file mode 100644 index 000000000..8b3af8297 --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/golden/param_model.log @@ -0,0 +1,260 @@ +SystemC Simulation +35 ns : RESET off ...by stim +60 ns : 0 + 0 + 1 = 1 => carry = 0 sum = 00001 +100 ns : 1 + 0 + 0 = 1 => carry = 0 sum = 00001 +140 ns : 2 + 0 + 1 = 3 => carry = 0 sum = 00011 +180 ns : 3 + 0 + 0 = 3 => carry = 0 sum = 00011 +220 ns : 4 + 0 + 1 = 5 => carry = 0 sum = 00101 +260 ns : 5 + 0 + 0 = 5 => carry = 0 sum = 00101 +300 ns : 6 + 0 + 1 = 7 => carry = 0 sum = 00111 +340 ns : 7 + 0 + 0 = 7 => carry = 0 sum = 00111 +380 ns : 8 + 0 + 1 = 9 => carry = 0 sum = 01001 +420 ns : 9 + 0 + 0 = 9 => carry = 0 sum = 01001 +460 ns : 10 + 0 + 1 = 11 => carry = 0 sum = 01011 +500 ns : 11 + 0 + 0 = 11 => carry = 0 sum = 01011 +540 ns : 12 + 0 + 1 = 13 => carry = 0 sum = 01101 +580 ns : 13 + 0 + 0 = 13 => carry = 0 sum = 01101 +620 ns : 14 + 0 + 1 = 15 => carry = 0 sum = 01111 +660 ns : 15 + 0 + 0 = 15 => carry = 0 sum = 01111 +700 ns : 0 + 1 + 1 = 2 => carry = 0 sum = 00010 +740 ns : 1 + 1 + 0 = 2 => carry = 0 sum = 00010 +780 ns : 2 + 1 + 1 = 4 => carry = 0 sum = 00100 +820 ns : 3 + 1 + 0 = 4 => carry = 0 sum = 00100 +860 ns : 4 + 1 + 1 = 6 => carry = 0 sum = 00110 +900 ns : 5 + 1 + 0 = 6 => carry = 0 sum = 00110 +940 ns : 6 + 1 + 1 = 8 => carry = 0 sum = 01000 +980 ns : 7 + 1 + 0 = 8 => carry = 0 sum = 01000 +1020 ns : 8 + 1 + 1 = 10 => carry = 0 sum = 01010 +1060 ns : 9 + 1 + 0 = 10 => carry = 0 sum = 01010 +1100 ns : 10 + 1 + 1 = 12 => carry = 0 sum = 01100 +1140 ns : 11 + 1 + 0 = 12 => carry = 0 sum = 01100 +1180 ns : 12 + 1 + 1 = 14 => carry = 0 sum = 01110 +1220 ns : 13 + 1 + 0 = 14 => carry = 0 sum = 01110 +1260 ns : 14 + 1 + 1 = 16 => carry = 0 sum = 10000 +1300 ns : 15 + 1 + 0 = 16 => carry = 0 sum = 10000 +1340 ns : 0 + 2 + 1 = 3 => carry = 0 sum = 00011 +1380 ns : 1 + 2 + 0 = 3 => carry = 0 sum = 00011 +1420 ns : 2 + 2 + 1 = 5 => carry = 0 sum = 00101 +1460 ns : 3 + 2 + 0 = 5 => carry = 0 sum = 00101 +1500 ns : 4 + 2 + 1 = 7 => carry = 0 sum = 00111 +1540 ns : 5 + 2 + 0 = 7 => carry = 0 sum = 00111 +1580 ns : 6 + 2 + 1 = 9 => carry = 0 sum = 01001 +1620 ns : 7 + 2 + 0 = 9 => carry = 0 sum = 01001 +1660 ns : 8 + 2 + 1 = 11 => carry = 0 sum = 01011 +1700 ns : 9 + 2 + 0 = 11 => carry = 0 sum = 01011 +1740 ns : 10 + 2 + 1 = 13 => carry = 0 sum = 01101 +1780 ns : 11 + 2 + 0 = 13 => carry = 0 sum = 01101 +1820 ns : 12 + 2 + 1 = 15 => carry = 0 sum = 01111 +1860 ns : 13 + 2 + 0 = 15 => carry = 0 sum = 01111 +1900 ns : 14 + 2 + 1 = 17 => carry = 0 sum = 10001 +1940 ns : 15 + 2 + 0 = 17 => carry = 0 sum = 10001 +1980 ns : 0 + 3 + 1 = 4 => carry = 0 sum = 00100 +2020 ns : 1 + 3 + 0 = 4 => carry = 0 sum = 00100 +2060 ns : 2 + 3 + 1 = 6 => carry = 0 sum = 00110 +2100 ns : 3 + 3 + 0 = 6 => carry = 0 sum = 00110 +2140 ns : 4 + 3 + 1 = 8 => carry = 0 sum = 01000 +2180 ns : 5 + 3 + 0 = 8 => carry = 0 sum = 01000 +2220 ns : 6 + 3 + 1 = 10 => carry = 0 sum = 01010 +2260 ns : 7 + 3 + 0 = 10 => carry = 0 sum = 01010 +2300 ns : 8 + 3 + 1 = 12 => carry = 0 sum = 01100 +2340 ns : 9 + 3 + 0 = 12 => carry = 0 sum = 01100 +2380 ns : 10 + 3 + 1 = 14 => carry = 0 sum = 01110 +2420 ns : 11 + 3 + 0 = 14 => carry = 0 sum = 01110 +2460 ns : 12 + 3 + 1 = 16 => carry = 0 sum = 10000 +2500 ns : 13 + 3 + 0 = 16 => carry = 0 sum = 10000 +2540 ns : 14 + 3 + 1 = 18 => carry = 0 sum = 10010 +2580 ns : 15 + 3 + 0 = 18 => carry = 0 sum = 10010 +2620 ns : 0 + 4 + 1 = 5 => carry = 0 sum = 00101 +2660 ns : 1 + 4 + 0 = 5 => carry = 0 sum = 00101 +2700 ns : 2 + 4 + 1 = 7 => carry = 0 sum = 00111 +2740 ns : 3 + 4 + 0 = 7 => carry = 0 sum = 00111 +2780 ns : 4 + 4 + 1 = 9 => carry = 0 sum = 01001 +2820 ns : 5 + 4 + 0 = 9 => carry = 0 sum = 01001 +2860 ns : 6 + 4 + 1 = 11 => carry = 0 sum = 01011 +2900 ns : 7 + 4 + 0 = 11 => carry = 0 sum = 01011 +2940 ns : 8 + 4 + 1 = 13 => carry = 0 sum = 01101 +2980 ns : 9 + 4 + 0 = 13 => carry = 0 sum = 01101 +3020 ns : 10 + 4 + 1 = 15 => carry = 0 sum = 01111 +3060 ns : 11 + 4 + 0 = 15 => carry = 0 sum = 01111 +3100 ns : 12 + 4 + 1 = 17 => carry = 0 sum = 10001 +3140 ns : 13 + 4 + 0 = 17 => carry = 0 sum = 10001 +3180 ns : 14 + 4 + 1 = 19 => carry = 0 sum = 10011 +3220 ns : 15 + 4 + 0 = 19 => carry = 0 sum = 10011 +3260 ns : 0 + 5 + 1 = 6 => carry = 0 sum = 00110 +3300 ns : 1 + 5 + 0 = 6 => carry = 0 sum = 00110 +3340 ns : 2 + 5 + 1 = 8 => carry = 0 sum = 01000 +3380 ns : 3 + 5 + 0 = 8 => carry = 0 sum = 01000 +3420 ns : 4 + 5 + 1 = 10 => carry = 0 sum = 01010 +3460 ns : 5 + 5 + 0 = 10 => carry = 0 sum = 01010 +3500 ns : 6 + 5 + 1 = 12 => carry = 0 sum = 01100 +3540 ns : 7 + 5 + 0 = 12 => carry = 0 sum = 01100 +3580 ns : 8 + 5 + 1 = 14 => carry = 0 sum = 01110 +3620 ns : 9 + 5 + 0 = 14 => carry = 0 sum = 01110 +3660 ns : 10 + 5 + 1 = 16 => carry = 0 sum = 10000 +3700 ns : 11 + 5 + 0 = 16 => carry = 0 sum = 10000 +3740 ns : 12 + 5 + 1 = 18 => carry = 0 sum = 10010 +3780 ns : 13 + 5 + 0 = 18 => carry = 0 sum = 10010 +3820 ns : 14 + 5 + 1 = 20 => carry = 0 sum = 10100 +3860 ns : 15 + 5 + 0 = 20 => carry = 0 sum = 10100 +3900 ns : 0 + 6 + 1 = 7 => carry = 0 sum = 00111 +3940 ns : 1 + 6 + 0 = 7 => carry = 0 sum = 00111 +3980 ns : 2 + 6 + 1 = 9 => carry = 0 sum = 01001 +4020 ns : 3 + 6 + 0 = 9 => carry = 0 sum = 01001 +4060 ns : 4 + 6 + 1 = 11 => carry = 0 sum = 01011 +4100 ns : 5 + 6 + 0 = 11 => carry = 0 sum = 01011 +4140 ns : 6 + 6 + 1 = 13 => carry = 0 sum = 01101 +4180 ns : 7 + 6 + 0 = 13 => carry = 0 sum = 01101 +4220 ns : 8 + 6 + 1 = 15 => carry = 0 sum = 01111 +4260 ns : 9 + 6 + 0 = 15 => carry = 0 sum = 01111 +4300 ns : 10 + 6 + 1 = 17 => carry = 0 sum = 10001 +4340 ns : 11 + 6 + 0 = 17 => carry = 0 sum = 10001 +4380 ns : 12 + 6 + 1 = 19 => carry = 0 sum = 10011 +4420 ns : 13 + 6 + 0 = 19 => carry = 0 sum = 10011 +4460 ns : 14 + 6 + 1 = 21 => carry = 0 sum = 10101 +4500 ns : 15 + 6 + 0 = 21 => carry = 0 sum = 10101 +4540 ns : 0 + 7 + 1 = 8 => carry = 0 sum = 01000 +4580 ns : 1 + 7 + 0 = 8 => carry = 0 sum = 01000 +4620 ns : 2 + 7 + 1 = 10 => carry = 0 sum = 01010 +4660 ns : 3 + 7 + 0 = 10 => carry = 0 sum = 01010 +4700 ns : 4 + 7 + 1 = 12 => carry = 0 sum = 01100 +4740 ns : 5 + 7 + 0 = 12 => carry = 0 sum = 01100 +4780 ns : 6 + 7 + 1 = 14 => carry = 0 sum = 01110 +4820 ns : 7 + 7 + 0 = 14 => carry = 0 sum = 01110 +4860 ns : 8 + 7 + 1 = 16 => carry = 0 sum = 10000 +4900 ns : 9 + 7 + 0 = 16 => carry = 0 sum = 10000 +4940 ns : 10 + 7 + 1 = 18 => carry = 0 sum = 10010 +4980 ns : 11 + 7 + 0 = 18 => carry = 0 sum = 10010 +5020 ns : 12 + 7 + 1 = 20 => carry = 0 sum = 10100 +5060 ns : 13 + 7 + 0 = 20 => carry = 0 sum = 10100 +5100 ns : 14 + 7 + 1 = 22 => carry = 0 sum = 10110 +5140 ns : 15 + 7 + 0 = 22 => carry = 0 sum = 10110 +5180 ns : 0 + 8 + 1 = 9 => carry = 0 sum = 01001 +5220 ns : 1 + 8 + 0 = 9 => carry = 0 sum = 01001 +5260 ns : 2 + 8 + 1 = 11 => carry = 0 sum = 01011 +5300 ns : 3 + 8 + 0 = 11 => carry = 0 sum = 01011 +5340 ns : 4 + 8 + 1 = 13 => carry = 0 sum = 01101 +5380 ns : 5 + 8 + 0 = 13 => carry = 0 sum = 01101 +5420 ns : 6 + 8 + 1 = 15 => carry = 0 sum = 01111 +5460 ns : 7 + 8 + 0 = 15 => carry = 0 sum = 01111 +5500 ns : 8 + 8 + 1 = 17 => carry = 0 sum = 10001 +5540 ns : 9 + 8 + 0 = 17 => carry = 0 sum = 10001 +5580 ns : 10 + 8 + 1 = 19 => carry = 0 sum = 10011 +5620 ns : 11 + 8 + 0 = 19 => carry = 0 sum = 10011 +5660 ns : 12 + 8 + 1 = 21 => carry = 0 sum = 10101 +5700 ns : 13 + 8 + 0 = 21 => carry = 0 sum = 10101 +5740 ns : 14 + 8 + 1 = 23 => carry = 0 sum = 10111 +5780 ns : 15 + 8 + 0 = 23 => carry = 0 sum = 10111 +5820 ns : 0 + 9 + 1 = 10 => carry = 0 sum = 01010 +5860 ns : 1 + 9 + 0 = 10 => carry = 0 sum = 01010 +5900 ns : 2 + 9 + 1 = 12 => carry = 0 sum = 01100 +5940 ns : 3 + 9 + 0 = 12 => carry = 0 sum = 01100 +5980 ns : 4 + 9 + 1 = 14 => carry = 0 sum = 01110 +6020 ns : 5 + 9 + 0 = 14 => carry = 0 sum = 01110 +6060 ns : 6 + 9 + 1 = 16 => carry = 0 sum = 10000 +6100 ns : 7 + 9 + 0 = 16 => carry = 0 sum = 10000 +6140 ns : 8 + 9 + 1 = 18 => carry = 0 sum = 10010 +6180 ns : 9 + 9 + 0 = 18 => carry = 0 sum = 10010 +6220 ns : 10 + 9 + 1 = 20 => carry = 0 sum = 10100 +6260 ns : 11 + 9 + 0 = 20 => carry = 0 sum = 10100 +6300 ns : 12 + 9 + 1 = 22 => carry = 0 sum = 10110 +6340 ns : 13 + 9 + 0 = 22 => carry = 0 sum = 10110 +6380 ns : 14 + 9 + 1 = 24 => carry = 0 sum = 11000 +6420 ns : 15 + 9 + 0 = 24 => carry = 0 sum = 11000 +6460 ns : 0 + 10 + 1 = 11 => carry = 0 sum = 01011 +6500 ns : 1 + 10 + 0 = 11 => carry = 0 sum = 01011 +6540 ns : 2 + 10 + 1 = 13 => carry = 0 sum = 01101 +6580 ns : 3 + 10 + 0 = 13 => carry = 0 sum = 01101 +6620 ns : 4 + 10 + 1 = 15 => carry = 0 sum = 01111 +6660 ns : 5 + 10 + 0 = 15 => carry = 0 sum = 01111 +6700 ns : 6 + 10 + 1 = 17 => carry = 0 sum = 10001 +6740 ns : 7 + 10 + 0 = 17 => carry = 0 sum = 10001 +6780 ns : 8 + 10 + 1 = 19 => carry = 0 sum = 10011 +6820 ns : 9 + 10 + 0 = 19 => carry = 0 sum = 10011 +6860 ns : 10 + 10 + 1 = 21 => carry = 0 sum = 10101 +6900 ns : 11 + 10 + 0 = 21 => carry = 0 sum = 10101 +6940 ns : 12 + 10 + 1 = 23 => carry = 0 sum = 10111 +6980 ns : 13 + 10 + 0 = 23 => carry = 0 sum = 10111 +7020 ns : 14 + 10 + 1 = 25 => carry = 0 sum = 11001 +7060 ns : 15 + 10 + 0 = 25 => carry = 0 sum = 11001 +7100 ns : 0 + 11 + 1 = 12 => carry = 0 sum = 01100 +7140 ns : 1 + 11 + 0 = 12 => carry = 0 sum = 01100 +7180 ns : 2 + 11 + 1 = 14 => carry = 0 sum = 01110 +7220 ns : 3 + 11 + 0 = 14 => carry = 0 sum = 01110 +7260 ns : 4 + 11 + 1 = 16 => carry = 0 sum = 10000 +7300 ns : 5 + 11 + 0 = 16 => carry = 0 sum = 10000 +7340 ns : 6 + 11 + 1 = 18 => carry = 0 sum = 10010 +7380 ns : 7 + 11 + 0 = 18 => carry = 0 sum = 10010 +7420 ns : 8 + 11 + 1 = 20 => carry = 0 sum = 10100 +7460 ns : 9 + 11 + 0 = 20 => carry = 0 sum = 10100 +7500 ns : 10 + 11 + 1 = 22 => carry = 0 sum = 10110 +7540 ns : 11 + 11 + 0 = 22 => carry = 0 sum = 10110 +7580 ns : 12 + 11 + 1 = 24 => carry = 0 sum = 11000 +7620 ns : 13 + 11 + 0 = 24 => carry = 0 sum = 11000 +7660 ns : 14 + 11 + 1 = 26 => carry = 0 sum = 11010 +7700 ns : 15 + 11 + 0 = 26 => carry = 0 sum = 11010 +7740 ns : 0 + 12 + 1 = 13 => carry = 0 sum = 01101 +7780 ns : 1 + 12 + 0 = 13 => carry = 0 sum = 01101 +7820 ns : 2 + 12 + 1 = 15 => carry = 0 sum = 01111 +7860 ns : 3 + 12 + 0 = 15 => carry = 0 sum = 01111 +7900 ns : 4 + 12 + 1 = 17 => carry = 0 sum = 10001 +7940 ns : 5 + 12 + 0 = 17 => carry = 0 sum = 10001 +7980 ns : 6 + 12 + 1 = 19 => carry = 0 sum = 10011 +8020 ns : 7 + 12 + 0 = 19 => carry = 0 sum = 10011 +8060 ns : 8 + 12 + 1 = 21 => carry = 0 sum = 10101 +8100 ns : 9 + 12 + 0 = 21 => carry = 0 sum = 10101 +8140 ns : 10 + 12 + 1 = 23 => carry = 0 sum = 10111 +8180 ns : 11 + 12 + 0 = 23 => carry = 0 sum = 10111 +8220 ns : 12 + 12 + 1 = 25 => carry = 0 sum = 11001 +8260 ns : 13 + 12 + 0 = 25 => carry = 0 sum = 11001 +8300 ns : 14 + 12 + 1 = 27 => carry = 0 sum = 11011 +8340 ns : 15 + 12 + 0 = 27 => carry = 0 sum = 11011 +8380 ns : 0 + 13 + 1 = 14 => carry = 0 sum = 01110 +8420 ns : 1 + 13 + 0 = 14 => carry = 0 sum = 01110 +8460 ns : 2 + 13 + 1 = 16 => carry = 0 sum = 10000 +8500 ns : 3 + 13 + 0 = 16 => carry = 0 sum = 10000 +8540 ns : 4 + 13 + 1 = 18 => carry = 0 sum = 10010 +8580 ns : 5 + 13 + 0 = 18 => carry = 0 sum = 10010 +8620 ns : 6 + 13 + 1 = 20 => carry = 0 sum = 10100 +8660 ns : 7 + 13 + 0 = 20 => carry = 0 sum = 10100 +8700 ns : 8 + 13 + 1 = 22 => carry = 0 sum = 10110 +8740 ns : 9 + 13 + 0 = 22 => carry = 0 sum = 10110 +8780 ns : 10 + 13 + 1 = 24 => carry = 0 sum = 11000 +8820 ns : 11 + 13 + 0 = 24 => carry = 0 sum = 11000 +8860 ns : 12 + 13 + 1 = 26 => carry = 0 sum = 11010 +8900 ns : 13 + 13 + 0 = 26 => carry = 0 sum = 11010 +8940 ns : 14 + 13 + 1 = 28 => carry = 0 sum = 11100 +8980 ns : 15 + 13 + 0 = 28 => carry = 0 sum = 11100 +9020 ns : 0 + 14 + 1 = 15 => carry = 0 sum = 01111 +9060 ns : 1 + 14 + 0 = 15 => carry = 0 sum = 01111 +9100 ns : 2 + 14 + 1 = 17 => carry = 0 sum = 10001 +9140 ns : 3 + 14 + 0 = 17 => carry = 0 sum = 10001 +9180 ns : 4 + 14 + 1 = 19 => carry = 0 sum = 10011 +9220 ns : 5 + 14 + 0 = 19 => carry = 0 sum = 10011 +9260 ns : 6 + 14 + 1 = 21 => carry = 0 sum = 10101 +9300 ns : 7 + 14 + 0 = 21 => carry = 0 sum = 10101 +9340 ns : 8 + 14 + 1 = 23 => carry = 0 sum = 10111 +9380 ns : 9 + 14 + 0 = 23 => carry = 0 sum = 10111 +9420 ns : 10 + 14 + 1 = 25 => carry = 0 sum = 11001 +9460 ns : 11 + 14 + 0 = 25 => carry = 0 sum = 11001 +9500 ns : 12 + 14 + 1 = 27 => carry = 0 sum = 11011 +9540 ns : 13 + 14 + 0 = 27 => carry = 0 sum = 11011 +9580 ns : 14 + 14 + 1 = 29 => carry = 0 sum = 11101 +9620 ns : 15 + 14 + 0 = 29 => carry = 0 sum = 11101 +9660 ns : 0 + 15 + 1 = 16 => carry = 0 sum = 10000 +9700 ns : 1 + 15 + 0 = 16 => carry = 0 sum = 10000 +9740 ns : 2 + 15 + 1 = 18 => carry = 0 sum = 10010 +9780 ns : 3 + 15 + 0 = 18 => carry = 0 sum = 10010 +9820 ns : 4 + 15 + 1 = 20 => carry = 0 sum = 10100 +9860 ns : 5 + 15 + 0 = 20 => carry = 0 sum = 10100 +9900 ns : 6 + 15 + 1 = 22 => carry = 0 sum = 10110 +9940 ns : 7 + 15 + 0 = 22 => carry = 0 sum = 10110 +9980 ns : 8 + 15 + 1 = 24 => carry = 0 sum = 11000 +10020 ns : 9 + 15 + 0 = 24 => carry = 0 sum = 11000 +10060 ns : 10 + 15 + 1 = 26 => carry = 0 sum = 11010 +10100 ns : 11 + 15 + 0 = 26 => carry = 0 sum = 11010 +10140 ns : 12 + 15 + 1 = 28 => carry = 0 sum = 11100 +10180 ns : 13 + 15 + 0 = 28 => carry = 0 sum = 11100 +10220 ns : 14 + 15 + 1 = 30 => carry = 0 sum = 11110 +10260 ns : 15 + 15 + 0 = 30 => carry = 0 sum = 11110 + +Info: /OSCI/SystemC: Simulation stopped by user. diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/main.cpp b/src/systemc/tests/systemc/misc/user_guide/param_model/main.cpp new file mode 100644 index 000000000..6e74edc79 --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/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: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + /***************************************/ + /* Main Filename: main.cc */ + /***************************************/ + +#include "param.h" +#include "stim.h" + +int sc_main(int ac, char *av[]) +{ + +// Parameter Settings + + int data_width = 5; + +// Signal Instantiation + + sc_signal<bool> reset; + signal_bool_vector a; + signal_bool_vector b; + sc_signal<bool> cin; + sc_signal<bool> ready; + signal_bool_vector sum; + sc_signal<bool> co; + sc_signal<bool> done; + +// Clock Instantiation + + sc_clock clk ("Clock", 10, SC_NS, 0.5, 0, SC_NS); + +// Process Instantiation + + param D1 ("D1", clk, reset, a, b, cin, ready, sum, + co, done, data_width); + + stim T1 ("T1", clk, done, reset, a, b, cin, + ready, data_width); + +// Simulation Run Control + + sc_start(); + return 0; +} diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/param.cpp b/src/systemc/tests/systemc/misc/user_guide/param_model/param.cpp new file mode 100644 index 000000000..14bfc64cb --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/param.cpp @@ -0,0 +1,91 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + param.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + /***************************************/ + /* Implementation Filename: param.cc */ + /***************************************/ + +#include "param.h" + +void param::entry() +{ + sc_unsigned sum1 (data_width + 1); + sc_unsigned a1 (data_width); + sc_unsigned b1 (data_width); + bool c1; + +// RESET INIT + sum.write(0); + co.write(0); + wait(); + + while(true) { // MAIN LOOP + + // HANDSHAKE + done.write(0); + do { wait(); } while (ready != 1); + + // COMPUTATION + a1 = a.read(); + b1 = b.read(); + c1 = cin.read(); + + sum1 = a1 + b1 + c1; + + // sum.write( sum1.range(data_width-1,0) ); + sc_unsigned tmp( data_width ); + tmp = sum1.range( data_width - 1, 0 ); + sum.write( tmp ); + co.write( sum1[data_width] ); + // wait(); + wait( 2 ); + + cout << sc_time_stamp() << "\t : " + << a1 << " + " + << b1 << " + " + << cin << " = " << sum1 + << "\t => carry = " << co + << " sum = " << sum + << endl; + + // HANDSHAKE + done.write(1); + wait(); + + } + +} diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/param.h b/src/systemc/tests/systemc/misc/user_guide/param_model/param.h new file mode 100644 index 000000000..979da821e --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/param.h @@ -0,0 +1,93 @@ +/***************************************************************************** + + 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. + + *****************************************************************************/ + +/***************************************************************************** + + param.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + /***************************************/ + /* Interface Filename: param.h */ + /***************************************/ + +#include "common.h" + +SC_MODULE( param ) +{ + SC_HAS_PROCESS( param ); + + sc_in_clk clk; + + // Inputs + const sc_signal<bool>& reset; + const signal_bool_vector& a; + const signal_bool_vector& b; + const sc_signal<bool>& cin; + const sc_signal<bool>& ready; + // Outputs + signal_bool_vector& sum; + sc_signal<bool>& co; + sc_signal<bool>& done; + // Parameters + const int data_width; + + // Constructor + param (sc_module_name NAME, + sc_clock& TICK, + const sc_signal<bool>& RESET, + const signal_bool_vector& A, + const signal_bool_vector& B, + const sc_signal<bool>& CIN, + const sc_signal<bool>& READY, + signal_bool_vector& SUM, + sc_signal<bool>& CO, + sc_signal<bool>& DONE, + const int DATA_WIDTH = 4) + + : reset (RESET), + a (A), + b (B), + cin (CIN), + ready (READY), + sum (SUM), + co (CO), + done (DONE), + data_width (DATA_WIDTH) + + { + clk(TICK); + SC_CTHREAD( entry, clk.pos() ); + reset_signal_is(reset,false); + } + + void entry(); +}; diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/param_model.f b/src/systemc/tests/systemc/misc/user_guide/param_model/param_model.f new file mode 100644 index 000000000..01e637776 --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/param_model.f @@ -0,0 +1,3 @@ +param_model/param.cpp +param_model/stim.cpp +param_model/main.cpp diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/stim.cpp b/src/systemc/tests/systemc/misc/user_guide/param_model/stim.cpp new file mode 100644 index 000000000..5e1df5558 --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/stim.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. + + *****************************************************************************/ + +/***************************************************************************** + + stim.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + /*************************************/ + /* Implementation Filename: stim.cc */ + /*************************************/ + +#include "stim.h" + +void stim::entry() +{ + +// VARIABLE INITIALIZATION + sc_unsigned a_tmp(data_width); + sc_unsigned b_tmp(data_width); + bool c_tmp; + int i, j; + +// RESET CYCLE + reset.write(0); + wait(2); + + reset.write(1); + wait(); + cout << sc_time_stamp() << "\t : " + << "RESET off \t...by stim" << endl; + +// STIMULUS GENERATION + c_tmp = 0; + + for (i=0; i<16; i++) { + for (j=0; j<16; j++) { + a_tmp = j; + b_tmp = i; + c_tmp = !c_tmp; + + a.write(a_tmp); + b.write(b_tmp); + cin.write(c_tmp); + + ready.write(1); + // wait(); + do { wait(); } while ( done != 1 ); + + ready.write(0); + // do { wait(); } while (done == 1); + wait(); + } + } + + sc_stop(); + +} diff --git a/src/systemc/tests/systemc/misc/user_guide/param_model/stim.h b/src/systemc/tests/systemc/misc/user_guide/param_model/stim.h new file mode 100644 index 000000000..829a83434 --- /dev/null +++ b/src/systemc/tests/systemc/misc/user_guide/param_model/stim.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. + + *****************************************************************************/ + +/***************************************************************************** + + stim.h -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + + /***************************************/ + /* Interface Filename: stim.h */ + /***************************************/ + +#include "common.h" + +SC_MODULE( stim ) +{ + SC_HAS_PROCESS( stim ); + + sc_in_clk clk; + + // Inputs + const sc_signal<bool>& done; + // Outputs + sc_signal<bool>& reset; + signal_bool_vector& a; + signal_bool_vector& b; + sc_signal<bool>& cin; + sc_signal<bool>& ready; + // Parameters + const int data_width; + + // Constructor + stim (sc_module_name NAME, + sc_clock& TICK, + const sc_signal<bool>& DONE, + sc_signal<bool>& RESET, + signal_bool_vector& A, + signal_bool_vector& B, + sc_signal<bool>& CIN, + sc_signal<bool>& READY, + const int DATA_WIDTH = 4) + + : done (DONE), + reset (RESET), + a (A), + b (B), + cin (CIN), + ready (READY), + data_width (DATA_WIDTH) + + { + clk(TICK); + SC_CTHREAD( entry, clk.neg() ); + } + + void entry(); +}; |