19 #include "sysc/communication/sc_semaphore_if.h"
20 #include "sysc/kernel/sc_event.h"
21 #include "sysc/kernel/sc_object.h"
22 #include "traceable.h"
25 #include <sysc/kernel/sc_process_handle.h>
63 ordered_semaphore(
const char* name,
unsigned init_value = 1,
bool value_traceable =
false);
81 int wait(
unsigned priority);
88 int trywait()
override;
108 void set_capacity(
unsigned capacity);
122 const char*
kind()
const override {
return "sc_semaphore_ordered"; }
129 void trace(sc_core::sc_trace_file* tf)
const override;
185 if(queue[1].size()) {
186 if(queue[1].front() == sc_core::sc_get_current_process_handle()) {
187 queue[1].pop_front();
191 if(queue[0].front() == sc_core::sc_get_current_process_handle()) {
192 queue[0].pop_front();
201 void report_error(
const char*
id,
const char* add_msg = 0)
const;
204 sc_core::sc_event free_evt;
207 bool value_traceable =
false;
208 std::array<std::deque<sc_core::sc_process_handle>, 2> queue;
The ordered_semaphore primitive channel class.
int get_value() const override
get the value of the semaphore
unsigned get_capacity()
retrieve the initial capacity of the semaphore
int post() override
unlock (give) the semaphore
const char * kind() const override
kind of this SastemC object
bool is_trace_enabled() const override
returns of this component shall be traced
int wait() override
lock (take) the semaphore, block if not available
ordered_semaphore(unsigned init_value=1)
constructor of an un-named semaphore
interface defining a traceable component
~lock()
destructor, unlock the semaphore if still locked
void release()
unlock the semaphore
lock(scc::ordered_semaphore &sem)
lock the given semahore, wait if not free