channel.cc revision 13059
12155SN/A/*
22155SN/A * Copyright 2018 Google, Inc.
32155SN/A *
42155SN/A * Redistribution and use in source and binary forms, with or without
52155SN/A * modification, are permitted provided that the following conditions are
62155SN/A * met: redistributions of source code must retain the above copyright
72155SN/A * notice, this list of conditions and the following disclaimer;
82155SN/A * redistributions in binary form must reproduce the above copyright
92155SN/A * notice, this list of conditions and the following disclaimer in the
102155SN/A * documentation and/or other materials provided with the distribution;
112155SN/A * neither the name of the copyright holders nor the names of its
122155SN/A * contributors may be used to endorse or promote products derived from
132155SN/A * this software without specific prior written permission.
142155SN/A *
152155SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
162155SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
172155SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
182155SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
192155SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
202155SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
212155SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222155SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232155SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242155SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
252155SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262155SN/A *
272155SN/A * Authors: Gabe Black
282665Ssaidi@eecs.umich.edu */
292665Ssaidi@eecs.umich.edu
302155SN/A#include "systemc/core/channel.hh"
314202Sbinkertn@umich.edu
322155SN/A#include "systemc/core/scheduler.hh"
339850Sandreas.hansson@arm.com
349850Sandreas.hansson@arm.comnamespace sc_gem5
359850Sandreas.hansson@arm.com{
367768SAli.Saidi@ARM.com
377768SAli.Saidi@ARM.comChannel::Channel(sc_core::sc_prim_channel *_sc_chan) : _sc_chan(_sc_chan)
382178SN/A{
392178SN/A    allChannels.insert(this);
402178SN/A}
412178SN/A
422178SN/AChannel::~Channel()
432178SN/A{
442178SN/A    allChannels.erase(this);
452178SN/A}
462178SN/A
472178SN/Avoid
482178SN/AChannel::requestUpdate()
492155SN/A{
505865Sksewell@umich.edu    scheduler.requestUpdate(this);
516181Sksewell@umich.edu}
526181Sksewell@umich.edu
535865Sksewell@umich.eduvoid
543918Ssaidi@eecs.umich.eduChannel::asyncRequestUpdate()
555865Sksewell@umich.edu{
562623SN/A    //TODO This should probably not request an update directly.
573918Ssaidi@eecs.umich.edu    scheduler.requestUpdate(this);
582155SN/A}
592155SN/A
602292SN/Astd::set<Channel *> allChannels;
616181Sksewell@umich.edu
626181Sksewell@umich.edu} // namespace sc_gem5
633918Ssaidi@eecs.umich.edu