1/***************************************************************************** 2 3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 4 more contributor license agreements. See the NOTICE file distributed 5 with this work for additional information regarding copyright ownership. 6 Accellera licenses this file to you under the Apache License, Version 2.0 7 (the "License"); you may not use this file except in compliance with the 8 License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 15 implied. See the License for the specific language governing 16 permissions and limitations under the License. 17 18 *****************************************************************************/ 19 20#ifndef __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__ 21#define __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__ 22 23#include "tag.hh" 24 25namespace tlm 26{ 27 28// Bidirectional blocking interfaces. 29template <typename REQ, typename RSP> 30class tlm_transport_if : public virtual sc_core::sc_interface 31{ 32 public: 33 virtual RSP transport(const REQ &) = 0; 34 35 virtual void 36 transport(const REQ &req, RSP &rsp) 37 { 38 rsp = transport(req); 39 } 40}; 41 42// Uni-directional blocking interfaces. 43template <typename T> 44class tlm_blocking_get_if : public virtual sc_core::sc_interface 45{ 46 public: 47 virtual T get(tlm_tag<T> *t=nullptr) = 0; 48 virtual void get(T &t) { t = get(); } 49}; 50 51template <typename T> 52class tlm_blocking_put_if : public virtual sc_core::sc_interface 53{ 54 public: 55 virtual void put(const T &t) = 0; 56}; 57 58// Uni-directional non blocking interfaces. 59 60template <typename T> 61class tlm_nonblocking_get_if : public virtual sc_core::sc_interface 62{ 63 public: 64 virtual bool nb_get(T &t) = 0; 65 virtual bool nb_can_get(tlm_tag<T> *t=nullptr) const = 0; 66 virtual const sc_core::sc_event & 67 ok_to_get(tlm_tag<T> *t=nullptr) const = 0; 68}; 69 70template <typename T> 71class tlm_nonblocking_put_if : public virtual sc_core::sc_interface 72{ 73 public: 74 virtual bool nb_put(const T &t) = 0; 75 virtual bool nb_can_put(tlm_tag<T> *t=nullptr) const = 0; 76 virtual const sc_core::sc_event & 77 ok_to_put(tlm_tag<T> *t=nullptr) const = 0; 78}; 79 80// Combined uni-directional blocking and non blocking. 81template <typename T> 82class tlm_get_if : public virtual tlm_blocking_get_if<T>, 83 public virtual tlm_nonblocking_get_if<T> 84{}; 85 86template <typename T> 87class tlm_put_if : public virtual tlm_blocking_put_if<T>, 88 public virtual tlm_nonblocking_put_if<T> 89{}; 90 91// Peek interfaces. 92template <typename T> 93class tlm_blocking_peek_if : public virtual sc_core::sc_interface 94{ 95 public: 96 virtual T peek(tlm_tag<T> *t=nullptr) const = 0; 97 virtual void peek(T &t) const { t = peek(); } 98}; 99 100template <typename T> 101class tlm_nonblocking_peek_if : public virtual sc_core::sc_interface 102{ 103 public: 104 virtual bool nb_peek(T &t) const = 0; 105 virtual bool nb_can_peek(tlm_tag<T> *t=nullptr) const = 0; 106 virtual const sc_core::sc_event & 107 ok_to_peek(tlm_tag<T> *t=nullptr) const = 0; 108}; 109 110template <typename T> 111class tlm_peek_if : 112 public virtual tlm_blocking_peek_if<T>, 113 public virtual tlm_nonblocking_peek_if<T> 114{}; 115 116// Get_peek interfaces. 117template <typename T> 118class tlm_blocking_get_peek_if : public virtual tlm_blocking_get_if<T>, 119 public virtual tlm_blocking_peek_if<T> 120{}; 121 122template <typename T> 123class tlm_nonblocking_get_peek_if : public virtual tlm_nonblocking_get_if<T>, 124 public virtual tlm_nonblocking_peek_if<T> 125{}; 126 127template <typename T> 128class tlm_get_peek_if : public virtual tlm_get_if<T>, 129 public virtual tlm_peek_if<T>, public virtual tlm_blocking_get_peek_if<T>, 130 public virtual tlm_nonblocking_get_peek_if<T> 131{}; 132 133} // namespace tlm 134 135#endif /* __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__ */ 136