sc_buffer.hh revision 12867
16145Snate@binkert.org/* 26145Snate@binkert.org * Copyright 2018 Google, Inc. 36145Snate@binkert.org * 46145Snate@binkert.org * Redistribution and use in source and binary forms, with or without 56145Snate@binkert.org * modification, are permitted provided that the following conditions are 66145Snate@binkert.org * met: redistributions of source code must retain the above copyright 76145Snate@binkert.org * notice, this list of conditions and the following disclaimer; 86145Snate@binkert.org * redistributions in binary form must reproduce the above copyright 96145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 106145Snate@binkert.org * documentation and/or other materials provided with the distribution; 116145Snate@binkert.org * neither the name of the copyright holders nor the names of its 126145Snate@binkert.org * contributors may be used to endorse or promote products derived from 136145Snate@binkert.org * this software without specific prior written permission. 146145Snate@binkert.org * 156145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 166145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 176145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 186145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 196145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 206145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 216145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 226145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 236145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 246145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 256145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 266145Snate@binkert.org * 276145Snate@binkert.org * Authors: Gabe Black 286145Snate@binkert.org */ 296145Snate@binkert.org 306145Snate@binkert.org#ifndef __SYSTEMC_EXT_CHANNEL_SC_BUFFER_HH__ 316145Snate@binkert.org#define __SYSTEMC_EXT_CHANNEL_SC_BUFFER_HH__ 326145Snate@binkert.org 336145Snate@binkert.org#include "../core/sc_module.hh" // for sc_gen_unique_name 346145Snate@binkert.org#include "sc_signal.hh" 356145Snate@binkert.org#include "warn_unimpl.hh" // for warn_unimpl 366145Snate@binkert.org 376145Snate@binkert.orgnamespace sc_core 386145Snate@binkert.org{ 396145Snate@binkert.org 406145Snate@binkert.org// Having a default value for the WRITER_POLICY parameter is non-standard, but 416145Snate@binkert.org// matches the Accellera implementation to enable the regression tests. 427002Snate@binkert.orgtemplate <class T, sc_writer_policy WRITER_POLICY=SC_ONE_WRITER> 437002Snate@binkert.orgclass sc_buffer : public sc_signal<T, WRITER_POLICY> 446154Snate@binkert.org{ 456154Snate@binkert.org public: 466145Snate@binkert.org sc_buffer() : sc_signal<T, WRITER_POLICY>(sc_gen_unique_name("buffer")) {} 476145Snate@binkert.org explicit sc_buffer(const char *name) : 486145Snate@binkert.org sc_signal<T, WRITER_POLICY>(sc_gen_unique_name(name)) 496145Snate@binkert.org {} 506145Snate@binkert.org 516145Snate@binkert.org virtual void 526891SBrad.Beckmann@amd.com write(const T&) 536145Snate@binkert.org { 546145Snate@binkert.org sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 556145Snate@binkert.org } 566145Snate@binkert.org 576145Snate@binkert.org sc_buffer<T, WRITER_POLICY> & 586285Snate@binkert.org operator = (const T &) 596285Snate@binkert.org { 606145Snate@binkert.org sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 617002Snate@binkert.org return *this; 626145Snate@binkert.org } 636145Snate@binkert.org sc_buffer<T, WRITER_POLICY> & 646145Snate@binkert.org operator = (const sc_signal<T, WRITER_POLICY> &) 656145Snate@binkert.org { 666145Snate@binkert.org sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 676145Snate@binkert.org return *this; 686145Snate@binkert.org } 696145Snate@binkert.org sc_buffer<T, WRITER_POLICY> & 706145Snate@binkert.org operator = (const sc_buffer<T, WRITER_POLICY> &) 716145Snate@binkert.org { 726145Snate@binkert.org sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 736145Snate@binkert.org return *this; 746145Snate@binkert.org } 757002Snate@binkert.org 766145Snate@binkert.org virtual const char *kind() const { return "sc_buffer"; } 776145Snate@binkert.org 786145Snate@binkert.org protected: 796145Snate@binkert.org virtual void 806145Snate@binkert.org update() 817002Snate@binkert.org { 826145Snate@binkert.org sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 836145Snate@binkert.org } 847002Snate@binkert.org 856145Snate@binkert.org private: 866145Snate@binkert.org // Disabled 876145Snate@binkert.org sc_buffer(const sc_buffer<T, WRITER_POLICY> &) {} 886145Snate@binkert.org}; 89 90} // namespace sc_core 91 92#endif //__SYSTEMC_EXT_CHANNEL_SC_BUFFER_HH__ 93