sc_semaphore.hh revision 12841
1892SN/A/* 21762SN/A * Copyright 2018 Google, Inc. 3892SN/A * 4892SN/A * Redistribution and use in source and binary forms, with or without 5892SN/A * modification, are permitted provided that the following conditions are 6892SN/A * met: redistributions of source code must retain the above copyright 7892SN/A * notice, this list of conditions and the following disclaimer; 8892SN/A * redistributions in binary form must reproduce the above copyright 9892SN/A * notice, this list of conditions and the following disclaimer in the 10892SN/A * documentation and/or other materials provided with the distribution; 11892SN/A * neither the name of the copyright holders nor the names of its 12892SN/A * contributors may be used to endorse or promote products derived from 13892SN/A * this software without specific prior written permission. 14892SN/A * 15892SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16892SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17892SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18892SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19892SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20892SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21892SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22892SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23892SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24892SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25892SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26892SN/A * 272665Ssaidi@eecs.umich.edu * Authors: Gabe Black 282665Ssaidi@eecs.umich.edu */ 29892SN/A 30802SN/A#ifndef __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__ 311722SN/A#define __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__ 32802SN/A 33802SN/A#include "../core/sc_object.hh" 34802SN/A#include "sc_semaphore_if.hh" 35802SN/A 36802SN/Anamespace sc_core 37802SN/A{ 38802SN/A 39802SN/Aclass sc_semaphore : public sc_semaphore_if, public sc_object 406658Snate@binkert.org{ 41802SN/A public: 421310SN/A explicit sc_semaphore(int); 432542SN/A sc_semaphore(const char *name, int); 444762Snate@binkert.org 45802SN/A virtual int wait(); 46802SN/A virtual int trywait(); 47802SN/A virtual int post(); 482107SN/A virtual int get_value() const; 49802SN/A 502539SN/A virtual const char *kind() const; 514762Snate@binkert.org 52802SN/A private: 533846Shsul@eecs.umich.edu // Disabled 54802SN/A sc_semaphore(const sc_semaphore &) : 55802SN/A sc_interface(), sc_semaphore_if(), sc_object() 56909SN/A {} 573349Sbinkertn@umich.edu 58909SN/A sc_semaphore &operator = (const sc_semaphore &) { return *this; } 592539SN/A}; 603918Ssaidi@eecs.umich.edu 612539SN/A} // namespace sc_core 622539SN/A 632539SN/A#endif //__SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__ 643349Sbinkertn@umich.edu