113521Sgabeblack@google.com/*****************************************************************************
213521Sgabeblack@google.com
313521Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
413521Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
513521Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
613521Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
713521Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
813521Sgabeblack@google.com  License.  You may obtain a copy of the License at
913521Sgabeblack@google.com
1013521Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1113521Sgabeblack@google.com
1213521Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1313521Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1413521Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1513521Sgabeblack@google.com  implied.  See the License for the specific language governing
1613521Sgabeblack@google.com  permissions and limitations under the License.
1713521Sgabeblack@google.com
1813521Sgabeblack@google.com *****************************************************************************/
1913521Sgabeblack@google.com
2013521Sgabeblack@google.com#ifndef __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__
2113521Sgabeblack@google.com#define __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__
2213521Sgabeblack@google.com
2313586Sgabeblack@google.com#include "tag.hh"
2413521Sgabeblack@google.com
2513521Sgabeblack@google.comnamespace tlm
2613521Sgabeblack@google.com{
2713521Sgabeblack@google.com
2813521Sgabeblack@google.com// Bidirectional blocking interfaces.
2913521Sgabeblack@google.comtemplate <typename REQ, typename RSP>
3013521Sgabeblack@google.comclass tlm_transport_if : public virtual sc_core::sc_interface
3113521Sgabeblack@google.com{
3213521Sgabeblack@google.com  public:
3313521Sgabeblack@google.com    virtual RSP transport(const REQ &) = 0;
3413521Sgabeblack@google.com
3513521Sgabeblack@google.com    virtual void
3613521Sgabeblack@google.com    transport(const REQ &req, RSP &rsp)
3713521Sgabeblack@google.com    {
3813521Sgabeblack@google.com        rsp = transport(req);
3913521Sgabeblack@google.com    }
4013521Sgabeblack@google.com};
4113521Sgabeblack@google.com
4213521Sgabeblack@google.com// Uni-directional blocking interfaces.
4313521Sgabeblack@google.comtemplate <typename T>
4413521Sgabeblack@google.comclass tlm_blocking_get_if : public virtual sc_core::sc_interface
4513521Sgabeblack@google.com{
4613521Sgabeblack@google.com  public:
4713521Sgabeblack@google.com    virtual T get(tlm_tag<T> *t=nullptr) = 0;
4813521Sgabeblack@google.com    virtual void get(T &t) { t = get(); }
4913521Sgabeblack@google.com};
5013521Sgabeblack@google.com
5113521Sgabeblack@google.comtemplate <typename T>
5213521Sgabeblack@google.comclass tlm_blocking_put_if : public virtual sc_core::sc_interface
5313521Sgabeblack@google.com{
5413521Sgabeblack@google.com  public:
5513521Sgabeblack@google.com    virtual void put(const T &t) = 0;
5613521Sgabeblack@google.com};
5713521Sgabeblack@google.com
5813521Sgabeblack@google.com// Uni-directional non blocking interfaces.
5913521Sgabeblack@google.com
6013521Sgabeblack@google.comtemplate <typename T>
6113521Sgabeblack@google.comclass tlm_nonblocking_get_if : public virtual sc_core::sc_interface
6213521Sgabeblack@google.com{
6313521Sgabeblack@google.com  public:
6413521Sgabeblack@google.com    virtual bool nb_get(T &t) = 0;
6513521Sgabeblack@google.com    virtual bool nb_can_get(tlm_tag<T> *t=nullptr) const = 0;
6613521Sgabeblack@google.com    virtual const sc_core::sc_event &
6713521Sgabeblack@google.com        ok_to_get(tlm_tag<T> *t=nullptr) const = 0;
6813521Sgabeblack@google.com};
6913521Sgabeblack@google.com
7013521Sgabeblack@google.comtemplate <typename T>
7113521Sgabeblack@google.comclass tlm_nonblocking_put_if : public virtual sc_core::sc_interface
7213521Sgabeblack@google.com{
7313521Sgabeblack@google.com  public:
7413521Sgabeblack@google.com    virtual bool nb_put(const T &t) = 0;
7513521Sgabeblack@google.com    virtual bool nb_can_put(tlm_tag<T> *t=nullptr) const = 0;
7613521Sgabeblack@google.com    virtual const sc_core::sc_event &
7713521Sgabeblack@google.com        ok_to_put(tlm_tag<T> *t=nullptr) const = 0;
7813521Sgabeblack@google.com};
7913521Sgabeblack@google.com
8013521Sgabeblack@google.com// Combined uni-directional blocking and non blocking.
8113521Sgabeblack@google.comtemplate <typename T>
8213521Sgabeblack@google.comclass tlm_get_if : public virtual tlm_blocking_get_if<T>,
8313521Sgabeblack@google.com    public virtual tlm_nonblocking_get_if<T>
8413521Sgabeblack@google.com{};
8513521Sgabeblack@google.com
8613521Sgabeblack@google.comtemplate <typename T>
8713521Sgabeblack@google.comclass tlm_put_if : public virtual tlm_blocking_put_if<T>,
8813521Sgabeblack@google.com    public virtual tlm_nonblocking_put_if<T>
8913521Sgabeblack@google.com{};
9013521Sgabeblack@google.com
9113521Sgabeblack@google.com// Peek interfaces.
9213521Sgabeblack@google.comtemplate <typename T>
9313521Sgabeblack@google.comclass tlm_blocking_peek_if : public virtual sc_core::sc_interface
9413521Sgabeblack@google.com{
9513521Sgabeblack@google.com  public:
9613521Sgabeblack@google.com    virtual T peek(tlm_tag<T> *t=nullptr) const = 0;
9713521Sgabeblack@google.com    virtual void peek(T &t) const { t = peek(); }
9813521Sgabeblack@google.com};
9913521Sgabeblack@google.com
10013521Sgabeblack@google.comtemplate <typename T>
10113521Sgabeblack@google.comclass tlm_nonblocking_peek_if : public virtual sc_core::sc_interface
10213521Sgabeblack@google.com{
10313521Sgabeblack@google.com  public:
10413521Sgabeblack@google.com    virtual bool nb_peek(T &t) const = 0;
10513521Sgabeblack@google.com    virtual bool nb_can_peek(tlm_tag<T> *t=nullptr) const = 0;
10613521Sgabeblack@google.com    virtual const sc_core::sc_event &
10713521Sgabeblack@google.com        ok_to_peek(tlm_tag<T> *t=nullptr) const = 0;
10813521Sgabeblack@google.com};
10913521Sgabeblack@google.com
11013521Sgabeblack@google.comtemplate <typename T>
11113521Sgabeblack@google.comclass tlm_peek_if :
11213521Sgabeblack@google.com    public virtual tlm_blocking_peek_if<T>,
11313521Sgabeblack@google.com    public virtual tlm_nonblocking_peek_if<T>
11413521Sgabeblack@google.com{};
11513521Sgabeblack@google.com
11613521Sgabeblack@google.com// Get_peek interfaces.
11713521Sgabeblack@google.comtemplate <typename T>
11813521Sgabeblack@google.comclass tlm_blocking_get_peek_if : public virtual tlm_blocking_get_if<T>,
11913521Sgabeblack@google.com    public virtual tlm_blocking_peek_if<T>
12013521Sgabeblack@google.com{};
12113521Sgabeblack@google.com
12213521Sgabeblack@google.comtemplate <typename T>
12313521Sgabeblack@google.comclass tlm_nonblocking_get_peek_if : public virtual tlm_nonblocking_get_if<T>,
12413521Sgabeblack@google.com    public virtual tlm_nonblocking_peek_if<T>
12513521Sgabeblack@google.com{};
12613521Sgabeblack@google.com
12713521Sgabeblack@google.comtemplate <typename T>
12813521Sgabeblack@google.comclass tlm_get_peek_if : public virtual tlm_get_if<T>,
12913521Sgabeblack@google.com    public virtual tlm_peek_if<T>, public virtual tlm_blocking_get_peek_if<T>,
13013521Sgabeblack@google.com    public virtual tlm_nonblocking_get_peek_if<T>
13113521Sgabeblack@google.com{};
13213521Sgabeblack@google.com
13313521Sgabeblack@google.com} // namespace tlm
13413521Sgabeblack@google.com
13513521Sgabeblack@google.com#endif /* __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_INTERFACES_CORE_IFS_HH__ */
136