Hi,
I have some questions on systemC syntax.
1. sc_event_queue. I found a lot of examples for sc_event_queue on some systemC coursewares (even threads on this forum), like below,
SC_MODULE(somemod){
sc_event_queue eq;
...
void process1(){
while(true){
...
wait(eq); // here got a message: cannot convert from 'sc_core::sc_event_queue' to 'const sc_core::sc_event' ,
...
}
}
void process2(){
while(true){
...
eq.notify(5,SC_NS);
eq.notify(8,SC_NS);
...
}
}
SC_CTOR(somemod){
...
}
};
If I change "wait(eq)" into "wait(eq.default_event())" or just use "wait()" meanwhile add eq into the sensitive list, it will work. Is it correct?
2. sc_semaphore channel. I see an example from the book systemc from the ground up like this,
SC_MODULE(gas_station) {
sc_semaphore pump(12); // here seems define a function which will return a sc_semaphore instance
void customer1_thread {
for(;; ) {
// wait till tank empty
…
// find an available gas pump
pump.wait();
// fill tank & pay
}
};
But this seems that it cannot work at all. Then if I use a new form like below it will work,
SC_MODULE(gas_station) {
sc_semaphore pump;
void customer1_thread {
for(;; ) {
// wait till tank empty
…
// find an available gas pump
pump.wait();
// fill tank & pay
}
SC_CTOR: pump(12){
...
}
};
So if I want to use the form of sc_semaphore pump(12) to the module, what should I do on the constructor?
Another question for the semaphore channel: does the sc_semaphore value have a upper limit or what is the size of this channel?
Thanks a lot!
Wayne