sc_prim.cc revision 13189:057566bc8fd6
112841Sgabeblack@google.com/*
212841Sgabeblack@google.com * Copyright 2018 Google, Inc.
312841Sgabeblack@google.com *
412841Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
512841Sgabeblack@google.com * modification, are permitted provided that the following conditions are
612841Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
712841Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
812841Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
912841Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1012841Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1112841Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1212841Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1312841Sgabeblack@google.com * this software without specific prior written permission.
1412841Sgabeblack@google.com *
1512841Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612841Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712841Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812841Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912841Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012841Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112841Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212841Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312841Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412841Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512841Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612841Sgabeblack@google.com *
2712841Sgabeblack@google.com * Authors: Gabe Black
2812841Sgabeblack@google.com */
2912841Sgabeblack@google.com
3012841Sgabeblack@google.com#include "base/logging.hh"
3112841Sgabeblack@google.com#include "systemc/core/channel.hh"
3212841Sgabeblack@google.com#include "systemc/core/scheduler.hh"
3313123Sgabeblack@google.com#include "systemc/ext/core/sc_prim.hh"
3413123Sgabeblack@google.com
3512841Sgabeblack@google.comnamespace sc_gem5
3612841Sgabeblack@google.com{
3712841Sgabeblack@google.com
3812841Sgabeblack@google.comuint64_t getChangeStamp() { return scheduler.changeStamp(); }
3912841Sgabeblack@google.com
4012841Sgabeblack@google.com} // namespace sc_gem5
4112841Sgabeblack@google.com
4212841Sgabeblack@google.comnamespace sc_core
4312841Sgabeblack@google.com{
4412841Sgabeblack@google.com
4512841Sgabeblack@google.comsc_prim_channel::sc_prim_channel() :
4612841Sgabeblack@google.com    _gem5_channel(new sc_gem5::Channel(this))
4712841Sgabeblack@google.com{}
4812841Sgabeblack@google.com
4912841Sgabeblack@google.comsc_prim_channel::sc_prim_channel(const char *_name) :
5012841Sgabeblack@google.com    sc_object(_name), _gem5_channel(new sc_gem5::Channel(this))
5112841Sgabeblack@google.com{}
5212841Sgabeblack@google.com
5312841Sgabeblack@google.comsc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }
5412841Sgabeblack@google.com
5513123Sgabeblack@google.comvoid
5613123Sgabeblack@google.comsc_prim_channel::request_update()
5712841Sgabeblack@google.com{
5812841Sgabeblack@google.com    _gem5_channel->requestUpdate();
5912841Sgabeblack@google.com}
6013123Sgabeblack@google.com
6112841Sgabeblack@google.comvoid
6212841Sgabeblack@google.comsc_prim_channel::async_request_update()
6312841Sgabeblack@google.com{
6412841Sgabeblack@google.com    _gem5_channel->asyncRequestUpdate();
6512841Sgabeblack@google.com}
6612841Sgabeblack@google.com
6712841Sgabeblack@google.comvoid
6812841Sgabeblack@google.comsc_prim_channel::next_trigger()
6912841Sgabeblack@google.com{
7012841Sgabeblack@google.com    ::sc_core::next_trigger();
7113123Sgabeblack@google.com}
7212841Sgabeblack@google.com
7313123Sgabeblack@google.comvoid
7413123Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_event &e)
7513123Sgabeblack@google.com{
7613123Sgabeblack@google.com    ::sc_core::next_trigger(e);
7713123Sgabeblack@google.com}
7813123Sgabeblack@google.com
7912841Sgabeblack@google.comvoid
8012841Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_event_or_list &eol)
8112841Sgabeblack@google.com{
8212841Sgabeblack@google.com    ::sc_core::next_trigger(eol);
8313123Sgabeblack@google.com}
8413123Sgabeblack@google.com
8513123Sgabeblack@google.comvoid
8612841Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_event_and_list &eal)
8712841Sgabeblack@google.com{
8813123Sgabeblack@google.com    ::sc_core::next_trigger(eal);
8912841Sgabeblack@google.com}
9013123Sgabeblack@google.com
9113123Sgabeblack@google.comvoid
9213123Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_time &t)
9313123Sgabeblack@google.com{
9413123Sgabeblack@google.com    ::sc_core::next_trigger(t);
9513123Sgabeblack@google.com}
9612841Sgabeblack@google.com
9713123Sgabeblack@google.comvoid
9812841Sgabeblack@google.comsc_prim_channel::next_trigger(double d, sc_time_unit u)
9912841Sgabeblack@google.com{
10013123Sgabeblack@google.com    ::sc_core::next_trigger(d, u);
10112841Sgabeblack@google.com}
10213123Sgabeblack@google.com
10313123Sgabeblack@google.comvoid
10413123Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_time &t, const sc_event &e)
10513123Sgabeblack@google.com{
10612841Sgabeblack@google.com    ::sc_core::next_trigger(t, e);
10712841Sgabeblack@google.com}
10813123Sgabeblack@google.com
10912841Sgabeblack@google.comvoid
11013123Sgabeblack@google.comsc_prim_channel::next_trigger(double d, sc_time_unit u, const sc_event &e)
11113123Sgabeblack@google.com{
11213123Sgabeblack@google.com    ::sc_core::next_trigger(d, u, e);
11313123Sgabeblack@google.com}
11413123Sgabeblack@google.com
11513123Sgabeblack@google.comvoid
11612841Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_time &t, const sc_event_or_list &eol)
11712841Sgabeblack@google.com{
11813123Sgabeblack@google.com    ::sc_core::next_trigger(t, eol);
11912841Sgabeblack@google.com}
12013123Sgabeblack@google.com
12112841Sgabeblack@google.comvoid
12212841Sgabeblack@google.comsc_prim_channel::next_trigger(
12312841Sgabeblack@google.com        double d, sc_time_unit u, const sc_event_or_list &eol)
12412841Sgabeblack@google.com{
12512853Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eol);
12612841Sgabeblack@google.com}
12713123Sgabeblack@google.com
12812841Sgabeblack@google.comvoid
12912841Sgabeblack@google.comsc_prim_channel::next_trigger(const sc_time &t, const sc_event_and_list &eal)
13012841Sgabeblack@google.com{
13112841Sgabeblack@google.com    ::sc_core::next_trigger(t, eal);
13213123Sgabeblack@google.com}
13312841Sgabeblack@google.com
13412841Sgabeblack@google.comvoid
13513123Sgabeblack@google.comsc_prim_channel::next_trigger(
13612841Sgabeblack@google.com        double d, sc_time_unit u, const sc_event_and_list &eal)
13712841Sgabeblack@google.com{
13812841Sgabeblack@google.com    ::sc_core::next_trigger(d, u, eal);
13913123Sgabeblack@google.com}
14012841Sgabeblack@google.com
14112841Sgabeblack@google.combool
14212841Sgabeblack@google.comsc_prim_channel::timed_out()
14313123Sgabeblack@google.com{
14412841Sgabeblack@google.com    return ::sc_core::timed_out();
14513143Sgabeblack@google.com}
14613143Sgabeblack@google.com
14713143Sgabeblack@google.comvoid
14813143Sgabeblack@google.comsc_prim_channel::wait()
14913123Sgabeblack@google.com{
15013123Sgabeblack@google.com    ::sc_core::wait();
15113123Sgabeblack@google.com}
15213123Sgabeblack@google.com
15312841Sgabeblack@google.comvoid
15412841Sgabeblack@google.comsc_prim_channel::wait(int i)
15513143Sgabeblack@google.com{
15612841Sgabeblack@google.com    ::sc_core::wait(i);
15713143Sgabeblack@google.com}
15813143Sgabeblack@google.com
15913143Sgabeblack@google.comvoid
16013143Sgabeblack@google.comsc_prim_channel::wait(const sc_event &e)
16113143Sgabeblack@google.com{
16213143Sgabeblack@google.com    ::sc_core::wait(e);
16313143Sgabeblack@google.com}
16413143Sgabeblack@google.com
16513143Sgabeblack@google.comvoid
16613143Sgabeblack@google.comsc_prim_channel::wait(const sc_event_or_list &eol)
16712841Sgabeblack@google.com{
16812841Sgabeblack@google.com    ::sc_core::wait(eol);
16912841Sgabeblack@google.com}
17012841Sgabeblack@google.com
17112841Sgabeblack@google.comvoid
17212841Sgabeblack@google.comsc_prim_channel::wait(const sc_event_and_list &eal)
17312841Sgabeblack@google.com{
17413123Sgabeblack@google.com    ::sc_core::wait(eal);
17513123Sgabeblack@google.com}
17613123Sgabeblack@google.com
17713123Sgabeblack@google.comvoid
17813123Sgabeblack@google.comsc_prim_channel::wait(const sc_time &t)
17913123Sgabeblack@google.com{
18013123Sgabeblack@google.com    ::sc_core::wait(t);
18113123Sgabeblack@google.com}
18213123Sgabeblack@google.com
18312841Sgabeblack@google.comvoid
18412841Sgabeblack@google.comsc_prim_channel::wait(double d, sc_time_unit u)
18512841Sgabeblack@google.com{
18612841Sgabeblack@google.com    ::sc_core::wait(d, u);
18712841Sgabeblack@google.com}
18812841Sgabeblack@google.com
18912841Sgabeblack@google.comvoid
19012841Sgabeblack@google.comsc_prim_channel::wait(const sc_time &t, const sc_event &e)
19113123Sgabeblack@google.com{
19213123Sgabeblack@google.com    ::sc_core::wait(t, e);
19313123Sgabeblack@google.com}
19413123Sgabeblack@google.com
19513123Sgabeblack@google.comvoid
19613123Sgabeblack@google.comsc_prim_channel::wait(double d, sc_time_unit u, const sc_event &e)
19713123Sgabeblack@google.com{
19813123Sgabeblack@google.com    ::sc_core::wait(d, u, e);
19912841Sgabeblack@google.com}
20012841Sgabeblack@google.com
20112841Sgabeblack@google.comvoid
20212841Sgabeblack@google.comsc_prim_channel::wait(const sc_time &t, const sc_event_or_list &eol)
20313143Sgabeblack@google.com{
20412841Sgabeblack@google.com    ::sc_core::wait(t, eol);
20513143Sgabeblack@google.com}
20612841Sgabeblack@google.com
20712841Sgabeblack@google.comvoid
20812841Sgabeblack@google.comsc_prim_channel::wait(double d, sc_time_unit u, const sc_event_or_list &eol)
20912841Sgabeblack@google.com{
21012841Sgabeblack@google.com    ::sc_core::wait(d, u, eol);
21112841Sgabeblack@google.com}
212
213void
214sc_prim_channel::wait(const sc_time &t, const sc_event_and_list &eal)
215{
216    ::sc_core::wait(t, eal);
217}
218
219void
220sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_and_list &eal)
221{
222    ::sc_core::wait(d, u, eal);
223}
224
225} // namespace sc_core
226