summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/synth/combo
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-05-24 01:37:55 -0700
committerGabe Black <gabeblack@google.com>2018-08-08 10:09:54 +0000
commit16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch)
tree7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/misc/synth/combo
parent7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff)
downloadgem5-16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f.tar.xz
systemc: Import tests from the Accellera systemc distribution.
Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6 Reviewed-on: https://gem5-review.googlesource.com/10845 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests/systemc/misc/synth/combo')
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/share/golden/share.log1
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/share/share.cpp50
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch3/golden/switch3.log1
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch3/switch3.cpp65
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch4/golden/switch4.log1
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch4/switch4.cpp68
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch5/golden/switch5.log1
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp68
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch6/golden/switch6.log1
-rw-r--r--src/systemc/tests/systemc/misc/synth/combo/switch6/switch6.cpp81
10 files changed, 337 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/synth/combo/share/golden/share.log b/src/systemc/tests/systemc/misc/synth/combo/share/golden/share.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/share/golden/share.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/misc/synth/combo/share/share.cpp b/src/systemc/tests/systemc/misc/synth/combo/share/share.cpp
new file mode 100644
index 000000000..44cd9fb59
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/share/share.cpp
@@ -0,0 +1,50 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ share.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+sc_signed
+share( const sc_unsigned& u,
+ const sc_unsigned& v )
+{
+ return (u - v) * (v + u);
+}
+
+int
+sc_main( int, char** argv )
+{
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch3/golden/switch3.log b/src/systemc/tests/systemc/misc/synth/combo/switch3/golden/switch3.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch3/golden/switch3.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch3/switch3.cpp b/src/systemc/tests/systemc/misc/synth/combo/switch3/switch3.cpp
new file mode 100644
index 000000000..f464142ae
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch3/switch3.cpp
@@ -0,0 +1,65 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ switch3.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+short
+select( int a, int b, int c )
+{
+ sc_signed x(7);
+
+ switch ((c >> 2) & 3) {
+ default:
+ case 0:
+ x = a + b;
+ return x.to_int();
+ case 1:
+ x = a - b;
+ return x.to_int();
+ case 2:
+ x = (a >> 16) + (b << 16);
+ return x.to_int();
+ case 3:
+ x = (a << 16) - (b >> 16);
+ return x.to_int();
+ }
+}
+
+int
+sc_main( int, char** argv )
+{
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch4/golden/switch4.log b/src/systemc/tests/systemc/misc/synth/combo/switch4/golden/switch4.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch4/golden/switch4.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch4/switch4.cpp b/src/systemc/tests/systemc/misc/synth/combo/switch4/switch4.cpp
new file mode 100644
index 000000000..f467aebc0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch4/switch4.cpp
@@ -0,0 +1,68 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ switch4.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+short
+select( int a, int b, int c )
+{
+ sc_signed x(7);
+ sc_signed y(9);
+
+ switch ((c >> 2) & 3) {
+ case 0:
+ x = a + b;
+ return x.to_int();
+ case 1:
+ x = a - b;
+ break;
+ case 2:
+ x = (a >> 16) + (b << 16);
+ return x.to_int();
+ case 3:
+ x = (a << 16) - (b >> 16);
+ break;
+ }
+
+ y = 2 * x;
+ return y.to_int();
+}
+
+int
+sc_main( int, char** argv )
+{
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch5/golden/switch5.log b/src/systemc/tests/systemc/misc/synth/combo/switch5/golden/switch5.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch5/golden/switch5.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp b/src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp
new file mode 100644
index 000000000..36685e487
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp
@@ -0,0 +1,68 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ switch5.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+unsigned short
+select( unsigned a, unsigned b, unsigned c )
+{
+ sc_unsigned x(7);
+ sc_unsigned y(9);
+
+ switch ((c >> 2) & 3) {
+ case 0:
+ x = a + b;
+ return x.to_uint();
+ case 1:
+ x = a - b;
+ break;
+ case 2:
+ x = (a >> 16) + (b << 16);
+ return x.to_uint();
+ case 3:
+ x = (a << 16) - (b >> 16);
+ break;
+ }
+
+ y = 2 * x;
+ return y.to_uint();
+}
+
+int
+sc_main( int, char** argv )
+{
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch6/golden/switch6.log b/src/systemc/tests/systemc/misc/synth/combo/switch6/golden/switch6.log
new file mode 100644
index 000000000..6d243dcc5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch6/golden/switch6.log
@@ -0,0 +1 @@
+SystemC Simulation
diff --git a/src/systemc/tests/systemc/misc/synth/combo/switch6/switch6.cpp b/src/systemc/tests/systemc/misc/synth/combo/switch6/switch6.cpp
new file mode 100644
index 000000000..84e489e76
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/synth/combo/switch6/switch6.cpp
@@ -0,0 +1,81 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ switch6.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:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+unsigned short
+select( unsigned a, unsigned b, unsigned c )
+{
+ sc_unsigned x(7);
+ sc_unsigned y(9);
+
+ switch ((c >> 2) & 3) {
+ case 0:
+ x = a + b;
+ if (a > 23349212) {
+ x = x + 1;
+ break;
+ } else {
+ x = x - 1;
+ }
+ return x.to_uint();
+ case 1:
+ x = a - b;
+ break;
+ case 2:
+ x = (a >> 16) + (b << 16);
+ return x.to_uint();
+ case 3:
+ x = (a << 16) - (b >> 16);
+ if (b < 234328112) {
+ x = x - 1;
+ break;
+ } else {
+ x = x + 1;
+ return x.to_uint();
+ }
+ break;
+ }
+
+ y = 2 * x;
+ return y.to_uint();
+}
+
+int
+sc_main( int, char** argv )
+{
+ return 0;
+}