BURTON Mark
Builds for 1 pipeline passed in 6 minutes 24 seconds

use cond variable instead of counting semaphore

also change some names and pass the module name to the syncsource (for debug)
... ... @@ -51,7 +51,7 @@ public:
gs::gt::syncSource syncSource;
SC_CTOR(asynctestnode): target_socket("input"), init_socket("output"), syncSource(10000)
SC_CTOR(asynctestnode): target_socket("input"), init_socket("output"), syncSource(name(),10000)
{
scThread=pthread_self();
... ...
... ... @@ -86,7 +86,7 @@ namespace gs {
l_delay=&delay;
COUT << "Unlock SystemC\n";
processTxnEvent.notify();
centralSyncPolicy::share.releaseLock();
centralSyncPolicy::share.unlock();
COUT << "Qemu waiting for SystemC\n";
txnDone.wait(); // we really hold this thread now.
txnMutex.unlock();
... ... @@ -108,7 +108,7 @@ namespace gs {
l_dmi_data=&dmi_data;
COUT << "Unlock SystemC\n";
processDmiEvent.notify();
centralSyncPolicy::share.releaseLock();
centralSyncPolicy::share.unlock();
COUT << "Qemu waiting for SystemC\n";
txnDone.wait(); // we really hold this thread now.
bool r=(bool)l_result; // pick this up before releasing the mutex!
... ... @@ -131,7 +131,7 @@ namespace gs {
l_trans=&trans;
COUT << "Unlock SystemC\n";
processDbgEvent.notify();
centralSyncPolicy::share.releaseLock();
centralSyncPolicy::share.unlock();
COUT << "Qemu waiting for SystemC\n";
txnDone.wait(); // we really hold this thread now.
unsigned int r=l_result; // pick this up before releasing the mutex!
... ... @@ -160,7 +160,7 @@ namespace gs {
COUT << "Doing txn\n";
internalRouter->b_tr(l_port, *l_trans,*l_delay);
txnDone.post(); // release the other thread.
centralSyncPolicy::share.takeLock();
centralSyncPolicy::share.lock();
COUT << "Finished txn\n";
}
}
... ... @@ -171,7 +171,7 @@ namespace gs {
COUT << "Doing dmi\n";
l_result=internalRouter->get_dmi(l_port, *l_trans, *l_dmi_data);
txnDone.post(); // release the other thread.
centralSyncPolicy::share.takeLock();
centralSyncPolicy::share.lock();
COUT << "Finished dmi\n";
}
... ... @@ -181,7 +181,7 @@ namespace gs {
COUT << "Doing dbg\n";
l_result=internalRouter->tr_dbg(l_port, *l_trans);
txnDone.post(); // release the other thread.
centralSyncPolicy::share.takeLock();
centralSyncPolicy::share.lock();
COUT << "Finished dbg\n";
}
... ...
This diff is collapsed. Click to expand it.
... ... @@ -73,34 +73,6 @@ public:
};
/** Convenience timed cond implementation */
class timed_cond {
pthread_cond_t cnd;
pthread_mutex_t mutex;
int state;
public:
timed_cond() {
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cnd, NULL);
}
bool wait() {
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += 5; // Wait 1 second
pthread_mutex_lock(&mutex);
int p = pthread_cond_timedwait(&cnd, &mutex, &ts);
pthread_mutex_unlock(&mutex);
return p != 0;
}
void release() {
pthread_mutex_lock(&mutex);
pthread_cond_broadcast(&cnd);
pthread_mutex_unlock(&mutex);
}
};
/** Convenience timed cond implementation */
class fifo_mutex {
pthread_cond_t cnd;
pthread_mutex_t mutex;
... ...