summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/unit/control/demo1
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/systemc/misc/unit/control/demo1')
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/demo1.f3
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/golden/demo1.log11
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/main.cpp56
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/proc1.cpp60
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/proc1.h64
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/proc2.cpp60
-rw-r--r--src/systemc/tests/systemc/misc/unit/control/demo1/proc2.h64
7 files changed, 318 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/demo1.f b/src/systemc/tests/systemc/misc/unit/control/demo1/demo1.f
new file mode 100644
index 000000000..a9e7a24d8
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/demo1.f
@@ -0,0 +1,3 @@
+demo1/main.cpp
+demo1/proc1.cpp
+demo1/proc2.cpp
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/golden/demo1.log b/src/systemc/tests/systemc/misc/unit/control/demo1/golden/demo1.log
new file mode 100644
index 000000000..bbcbfa1b2
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/golden/demo1.log
@@ -0,0 +1,11 @@
+SystemC Simulation
+Ready = False
+Ack = False
+Ready = True
+Ack = True
+Ready = False
+Ack = False
+Ready = True
+Ack = True
+Ready = False
+Ack = False
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/main.cpp b/src/systemc/tests/systemc/misc/unit/control/demo1/main.cpp
new file mode 100644
index 000000000..386c9dec7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/main.cpp
@@ -0,0 +1,56 @@
+/*****************************************************************************
+
+ 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 file for handshaking simulation */
+
+#include "systemc.h"
+#include "proc1.h"
+#include "proc2.h"
+
+int sc_main(int ac, char *av[])
+{
+ sc_signal<bool> data_ready("Ready");
+ sc_signal<bool> data_ack("Ack");
+
+ sc_clock clock("CLOCK", 10, SC_NS, 0.5, 0.0, SC_NS);
+
+ proc1 Master("MasterProcess", clock, data_ack, data_ready);
+ proc2 Slave("SlaveProcess", clock, data_ready, data_ack);
+
+ sc_start(100, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/proc1.cpp b/src/systemc/tests/systemc/misc/unit/control/demo1/proc1.cpp
new file mode 100644
index 000000000..6c0fb35fb
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/proc1.cpp
@@ -0,0 +1,60 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ proc1.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:
+
+ *****************************************************************************/
+
+/* Filename proc1.cc */
+/* This is the implementation file for synchronous process `proc1' */
+
+#include "systemc.h"
+#include "proc1.h"
+
+void proc1::entry()
+{
+ data_ready.write(false);
+ wait();
+ cout << "Ready \t = False" << endl;
+
+ while(true) {
+ data_ready.write(true);
+ do { wait(); } while (data_ack != true);
+ cout << "Ack \t = True" << endl;
+
+ data_ready.write(false);
+ do { wait(); } while (data_ack != false);
+ cout << "Ack \t = False" << endl;
+ }
+} // end of entry function
+
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/proc1.h b/src/systemc/tests/systemc/misc/unit/control/demo1/proc1.h
new file mode 100644
index 000000000..873170e65
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/proc1.h
@@ -0,0 +1,64 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ proc1.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:
+
+ *****************************************************************************/
+
+/* Filename proc1.h */
+/* This is the interface file for synchronous process `proc1' */
+
+SC_MODULE( proc1 )
+{
+ SC_HAS_PROCESS( proc1 );
+
+ sc_in_clk clk;
+
+ const sc_signal<bool>& data_ack; //input
+ sc_signal<bool>& data_ready; //output
+
+ //Constructor
+ proc1(sc_module_name NAME,
+ sc_clock& CLK,
+ const sc_signal<bool>& DATA_ACK,
+ sc_signal<bool>& DATA_READY)
+ : data_ack(DATA_ACK), data_ready(DATA_READY)
+ {
+ clk(CLK);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
+
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/proc2.cpp b/src/systemc/tests/systemc/misc/unit/control/demo1/proc2.cpp
new file mode 100644
index 000000000..ef0c0e004
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/proc2.cpp
@@ -0,0 +1,60 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ proc2.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:
+
+ *****************************************************************************/
+
+/* Filename proc2.cc */
+/* This is the implementation file for synchronous process `proc2' */
+
+#include "systemc.h"
+#include "proc2.h"
+
+void proc2::entry()
+{
+ data_ack.write(false);
+ wait();
+ cout << "Ack \t = False" << endl;
+
+ while (true) {
+ do { wait(); } while (data_ready != true);
+ data_ack.write(true);
+ cout << "Ready \t = True" << endl;
+
+ do { wait(); } while (data_ready != false);
+ data_ack.write(false);
+ cout << "Ready \t = False" << endl;
+ }
+} // end of entry function
+
diff --git a/src/systemc/tests/systemc/misc/unit/control/demo1/proc2.h b/src/systemc/tests/systemc/misc/unit/control/demo1/proc2.h
new file mode 100644
index 000000000..1c6ad7c77
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/unit/control/demo1/proc2.h
@@ -0,0 +1,64 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ proc2.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:
+
+ *****************************************************************************/
+
+/* Filename proc2.h */
+/* This is the interface file for synchronous process `proc2' */
+
+SC_MODULE( proc2 )
+{
+ SC_HAS_PROCESS( proc2 );
+
+ sc_in_clk clk;
+
+ const sc_signal<bool>& data_ready; //input
+ sc_signal<bool>& data_ack; //output
+
+ //Constructor
+ proc2(sc_module_name NAME,
+ sc_clock& CLK,
+ const sc_signal<bool>& DATA_READY,
+ sc_signal<bool>& DATA_ACK)
+ : data_ready(DATA_READY), data_ack(DATA_ACK)
+ {
+ clk(CLK);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
+