channel.cc revision 13059:4be5f408e128
16691Stjones1@inf.ed.ac.uk/*
26691Stjones1@inf.ed.ac.uk * Copyright 2018 Google, Inc.
36691Stjones1@inf.ed.ac.uk *
46691Stjones1@inf.ed.ac.uk * Redistribution and use in source and binary forms, with or without
56691Stjones1@inf.ed.ac.uk * modification, are permitted provided that the following conditions are
66691Stjones1@inf.ed.ac.uk * met: redistributions of source code must retain the above copyright
76691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer;
86691Stjones1@inf.ed.ac.uk * redistributions in binary form must reproduce the above copyright
96691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer in the
106691Stjones1@inf.ed.ac.uk * documentation and/or other materials provided with the distribution;
116691Stjones1@inf.ed.ac.uk * neither the name of the copyright holders nor the names of its
126691Stjones1@inf.ed.ac.uk * contributors may be used to endorse or promote products derived from
136691Stjones1@inf.ed.ac.uk * this software without specific prior written permission.
146691Stjones1@inf.ed.ac.uk *
156691Stjones1@inf.ed.ac.uk * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
166691Stjones1@inf.ed.ac.uk * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
176691Stjones1@inf.ed.ac.uk * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
186691Stjones1@inf.ed.ac.uk * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
196691Stjones1@inf.ed.ac.uk * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
206691Stjones1@inf.ed.ac.uk * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
216691Stjones1@inf.ed.ac.uk * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
226691Stjones1@inf.ed.ac.uk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
236691Stjones1@inf.ed.ac.uk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
246691Stjones1@inf.ed.ac.uk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
256691Stjones1@inf.ed.ac.uk * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
266691Stjones1@inf.ed.ac.uk *
276691Stjones1@inf.ed.ac.uk * Authors: Gabe Black
286691Stjones1@inf.ed.ac.uk */
296691Stjones1@inf.ed.ac.uk
306691Stjones1@inf.ed.ac.uk#include "systemc/core/channel.hh"
316691Stjones1@inf.ed.ac.uk
326691Stjones1@inf.ed.ac.uk#include "systemc/core/scheduler.hh"
336691Stjones1@inf.ed.ac.uk
346691Stjones1@inf.ed.ac.uknamespace sc_gem5
356691Stjones1@inf.ed.ac.uk{
366691Stjones1@inf.ed.ac.uk
376691Stjones1@inf.ed.ac.ukChannel::Channel(sc_core::sc_prim_channel *_sc_chan) : _sc_chan(_sc_chan)
386691Stjones1@inf.ed.ac.uk{
397720Sgblack@eecs.umich.edu    allChannels.insert(this);
406691Stjones1@inf.ed.ac.uk}
416691Stjones1@inf.ed.ac.uk
426691Stjones1@inf.ed.ac.ukChannel::~Channel()
436691Stjones1@inf.ed.ac.uk{
447720Sgblack@eecs.umich.edu    allChannels.erase(this);
457720Sgblack@eecs.umich.edu}
467720Sgblack@eecs.umich.edu
477720Sgblack@eecs.umich.eduvoid
487720Sgblack@eecs.umich.eduChannel::requestUpdate()
497720Sgblack@eecs.umich.edu{
507720Sgblack@eecs.umich.edu    scheduler.requestUpdate(this);
517720Sgblack@eecs.umich.edu}
526691Stjones1@inf.ed.ac.uk
536691Stjones1@inf.ed.ac.ukvoid
546691Stjones1@inf.ed.ac.ukChannel::asyncRequestUpdate()
556691Stjones1@inf.ed.ac.uk{
566691Stjones1@inf.ed.ac.uk    //TODO This should probably not request an update directly.
576691Stjones1@inf.ed.ac.uk    scheduler.requestUpdate(this);
586691Stjones1@inf.ed.ac.uk}
596691Stjones1@inf.ed.ac.uk
606691Stjones1@inf.ed.ac.ukstd::set<Channel *> allChannels;
616691Stjones1@inf.ed.ac.uk
626691Stjones1@inf.ed.ac.uk} // namespace sc_gem5
636691Stjones1@inf.ed.ac.uk