quic/qbox
Loading...
Searching...
No Matches
shmem_extension.h
1/*
2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _GREENSOCS_SHMEMID_EXTENSION_H
8#define _GREENSOCS_SHMEMID_EXTENSION_H
9
10#include <systemc>
11#include <tlm>
12
13namespace gs {
14
23class ShmemIDExtension : public tlm::tlm_extension<ShmemIDExtension>
24{
25public:
26 std::string m_memid;
27 uint64_t m_mapped_addr;
28 uint64_t m_size;
29 int m_fd;
30
31 ShmemIDExtension(): m_mapped_addr(0), m_size(0){};
32 ShmemIDExtension(const ShmemIDExtension&) = default;
33 ShmemIDExtension(std::string& s, uint64_t addr, uint64_t size, int fd = -1)
34 : m_memid(s), m_mapped_addr(addr), m_size(size), m_fd(fd)
35 {
36 SCP_DEBUG("ShmemIDExtension") << "ShmemIDExtension constructor";
37 }
39 {
40 m_memid.assign(o.m_memid);
41 m_mapped_addr = o.m_mapped_addr;
42 m_size = o.m_size;
43 m_fd = o.m_fd;
44 return *this;
45 }
46
47 virtual tlm_extension_base* clone() const override { return const_cast<ShmemIDExtension*>(this); }
48
49 virtual void copy_from(const tlm_extension_base& ext) override
50 {
51 const ShmemIDExtension& other = static_cast<const ShmemIDExtension&>(ext);
52 *this = other;
53 }
54
55 virtual void free() override { return; } // we will not free this extension
56
57 bool empty() { return m_size == 0; }
58};
59} // namespace gs
60#endif
Definition target.h:160
Definition shmem_extension.h:24
Tool which reads a Lua configuration file and sets parameters.
Definition biflow.cc:10