summaryrefslogtreecommitdiff
path: root/src/systemc/tests/tlm/p2p/HierarchicalSocket
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/tests/tlm/p2p/HierarchicalSocket')
-rw-r--r--src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleInitiatorWrapper.h55
-rw-r--r--src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleTargetWrapper.h55
-rw-r--r--src/systemc/tests/tlm/p2p/HierarchicalSocket/golden/hierarchical_socket.log33
-rw-r--r--src/systemc/tests/tlm/p2p/HierarchicalSocket/hierarchical_socket.cpp40
4 files changed, 183 insertions, 0 deletions
diff --git a/src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleInitiatorWrapper.h b/src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleInitiatorWrapper.h
new file mode 100644
index 000000000..41b982ecd
--- /dev/null
+++ b/src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleInitiatorWrapper.h
@@ -0,0 +1,55 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+#ifndef __SIMPLE_INITIATOR_WRAPPER_H__
+#define __SIMPLE_INITIATOR_WRAPPER_H__
+
+#include "tlm.h"
+#include "SimpleLTInitiator1.h"
+
+class SimpleInitiatorWrapper : public sc_core::sc_module
+{
+public:
+ typedef tlm::tlm_generic_payload transaction_type;
+ typedef tlm::tlm_phase phase_type;
+ typedef tlm::tlm_sync_enum sync_enum_type;
+ typedef tlm::tlm_fw_transport_if<> fw_interface_type;
+ typedef tlm::tlm_bw_transport_if<> bw_interface_type;
+ typedef tlm::tlm_initiator_socket<> initiator_socket_type;
+
+public:
+ initiator_socket_type socket;
+
+public:
+ SimpleInitiatorWrapper(sc_core::sc_module_name name) :
+ sc_core::sc_module(name),
+ socket("socket"),
+ child("child")
+ {
+ child.socket(socket);
+ }
+
+protected:
+ SimpleLTInitiator1 child;
+
+};
+
+#endif
+
+
diff --git a/src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleTargetWrapper.h b/src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleTargetWrapper.h
new file mode 100644
index 000000000..16212515c
--- /dev/null
+++ b/src/systemc/tests/tlm/p2p/HierarchicalSocket/SimpleTargetWrapper.h
@@ -0,0 +1,55 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+#ifndef __SIMPLE_TARGET_WRAPPER_H__
+#define __SIMPLE_TARGET_WRAPPER_H__
+
+#include "tlm.h"
+#include "SimpleLTTarget1.h"
+
+class SimpleTargetWrapper : public sc_core::sc_module
+{
+public:
+ typedef tlm::tlm_generic_payload transaction_type;
+ typedef tlm::tlm_phase phase_type;
+ typedef tlm::tlm_sync_enum sync_enum_type;
+ typedef tlm::tlm_fw_transport_if<> fw_interface_type;
+ typedef tlm::tlm_bw_transport_if<> bw_interface_type;
+ typedef tlm::tlm_target_socket<> target_socket_type;
+
+public:
+ target_socket_type socket;
+
+public:
+ SimpleTargetWrapper(sc_core::sc_module_name name) :
+ sc_core::sc_module(name),
+ socket("socket"),
+ child("child")
+ {
+ socket(child.socket);
+ }
+
+protected:
+ SimpleLTTarget1 child;
+
+};
+
+#endif
+
+
diff --git a/src/systemc/tests/tlm/p2p/HierarchicalSocket/golden/hierarchical_socket.log b/src/systemc/tests/tlm/p2p/HierarchicalSocket/golden/hierarchical_socket.log
new file mode 100644
index 000000000..137330634
--- /dev/null
+++ b/src/systemc/tests/tlm/p2p/HierarchicalSocket/golden/hierarchical_socket.log
@@ -0,0 +1,33 @@
+SystemC Simulation
+initiatorWrapper.child: Send write request: A = 0x0, D = 0x0 @ 0 s
+targetWrapper.child: Received write request: A = 0x0, D = 0x0 @ 0 s
+initiatorWrapper.child: Received ok response @ 10 ns
+initiatorWrapper.child: Send write request: A = 0x4, D = 0x1 @ 10 ns
+targetWrapper.child: Received write request: A = 0x4, D = 0x1 @ 10 ns
+initiatorWrapper.child: Received ok response @ 20 ns
+initiatorWrapper.child: Send write request: A = 0x8, D = 0x2 @ 20 ns
+targetWrapper.child: Received write request: A = 0x8, D = 0x2 @ 20 ns
+initiatorWrapper.child: Received ok response @ 30 ns
+initiatorWrapper.child: Send write request: A = 0xc, D = 0x3 @ 30 ns
+targetWrapper.child: Received write request: A = 0xc, D = 0x3 @ 30 ns
+initiatorWrapper.child: Received ok response @ 40 ns
+initiatorWrapper.child: Send write request: A = 0x10, D = 0x4 @ 40 ns
+targetWrapper.child: Received write request: A = 0x10, D = 0x4 @ 40 ns
+initiatorWrapper.child: Received ok response @ 50 ns
+initiatorWrapper.child: Send read request: A = 0x0 @ 50 ns
+targetWrapper.child: Received read request: A = 0x0 @ 50 ns
+initiatorWrapper.child: Received ok response: D = 0x0 @ 150 ns
+initiatorWrapper.child: Send read request: A = 0x4 @ 150 ns
+targetWrapper.child: Received read request: A = 0x4 @ 150 ns
+initiatorWrapper.child: Received ok response: D = 0x1 @ 250 ns
+initiatorWrapper.child: Send read request: A = 0x8 @ 250 ns
+targetWrapper.child: Received read request: A = 0x8 @ 250 ns
+initiatorWrapper.child: Received ok response: D = 0x2 @ 350 ns
+initiatorWrapper.child: Send read request: A = 0xc @ 350 ns
+targetWrapper.child: Received read request: A = 0xc @ 350 ns
+initiatorWrapper.child: Received ok response: D = 0x3 @ 450 ns
+initiatorWrapper.child: Send read request: A = 0x10 @ 450 ns
+targetWrapper.child: Received read request: A = 0x10 @ 450 ns
+initiatorWrapper.child: Received ok response: D = 0x4 @ 550 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/tlm/p2p/HierarchicalSocket/hierarchical_socket.cpp b/src/systemc/tests/tlm/p2p/HierarchicalSocket/hierarchical_socket.cpp
new file mode 100644
index 000000000..be2ec433c
--- /dev/null
+++ b/src/systemc/tests/tlm/p2p/HierarchicalSocket/hierarchical_socket.cpp
@@ -0,0 +1,40 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+//#include <iostream>
+
+//#include <systemc>
+
+#include "tlm.h"
+
+#include "SimpleInitiatorWrapper.h"
+#include "SimpleTargetWrapper.h"
+
+int sc_main(int argc, char* argv[])
+{
+ SimpleInitiatorWrapper initiator("initiatorWrapper");
+ SimpleTargetWrapper target("targetWrapper");
+
+ initiator.socket(target.socket);
+
+ sc_core::sc_start();
+ sc_core::sc_stop();
+
+ return 0;
+}