summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/unit/structs/test3
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/unit/structs/test3
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/unit/structs/test3')
-rw-r--r--src/systemc/tests/systemc/misc/unit/structs/test3/COMPILE0
-rw-r--r--src/systemc/tests/systemc/misc/unit/structs/test3/arr_struct.h81
-rw-r--r--src/systemc/tests/systemc/misc/unit/structs/test3/arraytypes.h57
-rw-r--r--src/systemc/tests/systemc/misc/unit/structs/test3/display.h51
-rw-r--r--src/systemc/tests/systemc/misc/unit/structs/test3/stimulus.h50
-rw-r--r--src/systemc/tests/systemc/misc/unit/structs/test3/test3.cpp78
6 files changed, 317 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/unit/structs/test3/COMPILE b/src/systemc/tests/systemc/misc/unit/structs/test3/COMPILE
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/structs/test3/COMPILE
diff --git a/src/systemc/tests/systemc/misc/unit/structs/test3/arr_struct.h b/src/systemc/tests/systemc/misc/unit/structs/test3/arr_struct.h
new file mode 100644
index 000000000..a7a2fea55
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/structs/test3/arr_struct.h
@@ -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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ arr_struct.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:
+
+ *****************************************************************************/
+
+
+struct arr_struct1 {
+ char a[4][4];
+
+
+};
+
+inline
+bool
+operator == ( const arr_struct1&, const arr_struct1& )
+{
+ // NOT IMPLEMENTED
+ return false;
+}
+
+inline
+void
+sc_trace( sc_trace_file*, const arr_struct1&, const std::string& )
+{
+ // NOT IMPLEMENTED
+}
+
+
+struct arr_struct2 {
+
+ sc_uint<8> b[4][4];
+
+
+};
+
+inline
+bool
+operator == ( const arr_struct2&, const arr_struct2& )
+{
+ // NOT IMPLEMENTED
+ return false;
+}
+
+inline
+void
+sc_trace( sc_trace_file*, const arr_struct2&, const std::string& )
+{
+ // NOT IMPLEMENTED
+}
diff --git a/src/systemc/tests/systemc/misc/unit/structs/test3/arraytypes.h b/src/systemc/tests/systemc/misc/unit/structs/test3/arraytypes.h
new file mode 100644
index 000000000..f2e2e8e97
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/structs/test3/arraytypes.h
@@ -0,0 +1,57 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ arraytypes.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:
+
+ *****************************************************************************/
+
+#include "arr_struct.h"
+
+SC_MODULE( arraytypes ) {
+ sc_in_clk clk;
+ sc_in<bool> reset;
+ sc_in<arr_struct1> in_value1;
+ sc_in<sc_lv<1> > in_valid;
+ sc_out<arr_struct2> out_value1;
+ sc_out<sc_bit> out_valid;
+
+ SC_CTOR(arraytypes)
+ {
+ SC_CTHREAD (entry, clk.pos());
+ reset_signal_is( reset, true );
+ };
+
+ void entry ();
+
+};
+
diff --git a/src/systemc/tests/systemc/misc/unit/structs/test3/display.h b/src/systemc/tests/systemc/misc/unit/structs/test3/display.h
new file mode 100644
index 000000000..785004870
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/structs/test3/display.h
@@ -0,0 +1,51 @@
+/*****************************************************************************
+
+ 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: 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_MODULE ( display ) {
+ sc_in_clk CLK;
+ sc_in<sc_lv<8> > in_data1[4];
+ sc_in<unsigned int> in_data2[4];
+ sc_in<sc_bit> in_valid;
+
+ SC_CTOR ( display )
+ { SC_CTHREAD(entry, CLK.pos()); }
+ void entry();
+};
+
+// EOF
diff --git a/src/systemc/tests/systemc/misc/unit/structs/test3/stimulus.h b/src/systemc/tests/systemc/misc/unit/structs/test3/stimulus.h
new file mode 100644
index 000000000..0a24bee00
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/structs/test3/stimulus.h
@@ -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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ stimulus.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:
+
+ *****************************************************************************/
+
+SC_MODULE ( stimulus ) {
+ sc_in_clk CLK;
+ sc_out<bool> reset;
+ sc_out<char > out_stimulus1[4];
+ sc_out<sc_int<8> > out_stimulus2[4];
+ sc_out<sc_lv<1> > out_valid;
+ SC_CTOR ( stimulus)
+ {SC_CTHREAD(entry, CLK.pos());}
+
+ void entry();
+};
+
+// EOF
diff --git a/src/systemc/tests/systemc/misc/unit/structs/test3/test3.cpp b/src/systemc/tests/systemc/misc/unit/structs/test3/test3.cpp
new file mode 100644
index 000000000..aee5727c4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/structs/test3/test3.cpp
@@ -0,0 +1,78 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ test3.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>
+#include "arraytypes.h"
+
+void arraytypes::entry(){
+
+ char tmp1_uns_lv[4][4];
+ arr_struct1 a;
+ arr_struct2 tmp2_uns_lv;
+
+ // reset_loop
+ out_valid.write(sc_bit(0));
+
+ wait();
+ while (true) {
+ while(in_valid.read() == "0") wait();
+ wait();
+ a = in_value1.read();
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ tmp1_uns_lv[i][j] = a.a[i][j];
+ }
+ }
+
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ tmp2_uns_lv.b[i][j] = tmp1_uns_lv[j][i];
+ out_value1.write (tmp2_uns_lv);
+
+ wait();
+
+ out_valid.write( sc_bit(1));
+ wait();
+
+
+ out_valid.write( sc_bit(0));
+ wait();
+
+}
+}
+// EOF
+