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

Change boolean decoupled into an enum (mode).

(Also add license header)
... ... @@ -51,7 +51,7 @@ public:
gs::gt::syncSource syncSource;
SC_CTOR(asynctestnode): target_socket("input"), init_socket("output"), syncSource(true)
SC_CTOR(asynctestnode): target_socket("input"), init_socket("output"), syncSource()
{
scThread=pthread_self();
... ...
/*
* async_event.h
*
* Copyright (C) 2014, GreenSocs Ltd.
*
* Developped by Clement Deschamps <clement.deschamps@greensocs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Linking GreenSocs code, statically or dynamically with other modules
* is making a combined work based on GreenSocs code. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders, GreenSocs
* Ltd, give you permission to combine GreenSocs code with free software
* programs or libraries that are released under the GNU LGPL, under the
* OSCI license, under the OCP TLM Kit Research License Agreement or
* under the OVP evaluation license.You may copy and distribute such a
* system following the terms of the GNU GPL and the licenses of the
* other code concerned.
*
* Note that people who make modified versions of GreenSocs code are not
* obligated to grant this special exception for their modified versions;
* it is their choice whether to do so. The GNU General Public License
* gives permission to release a modified version without this exception;
* this exception also makes it possible to release a modified version
* which carries forward this exception.
*
*/
#ifndef GS_GT_ASYNC_EVENT_H_
#define GS_GT_ASYNC_EVENT_H_
... ...
/*
* sync.h
*
* Copyright (C) 2014, GreenSocs Ltd.
*
* Developped by Clement Deschamps <clement.deschamps@greensocs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Linking GreenSocs code, statically or dynamically with other modules
* is making a combined work based on GreenSocs code. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders, GreenSocs
* Ltd, give you permission to combine GreenSocs code with free software
* programs or libraries that are released under the GNU LGPL, under the
* OSCI license, under the OCP TLM Kit Research License Agreement or
* under the OVP evaluation license.You may copy and distribute such a
* system following the terms of the GNU GPL and the licenses of the
* other code concerned.
*
* Note that people who make modified versions of GreenSocs code are not
* obligated to grant this special exception for their modified versions;
* it is their choice whether to do so. The GNU General Public License
* gives permission to release a modified version without this exception;
* this exception also makes it possible to release a modified version
* which carries forward this exception.
*
*/
#ifndef GS_GT_SYNC_H_
#define GS_GT_SYNC_H_
... ... @@ -16,13 +58,13 @@
#include "greenthreads/util.h"
#include "greenthreads/async_event.h"
#define DECOUPLED
#define COUT if (0) cout << pthread_self() << ":"
namespace gs {
namespace gt {
typedef enum {parallel, qemu_decoupled, systemc_behind, determanistic} sync_mode;
class centralSyncPolicy : sc_core::sc_module {
public:
static centralSyncPolicy share;
... ... @@ -99,7 +141,7 @@ public:
mutex.lock();
}
void setWindow(sc_core::sc_time t, sc_core::sc_time *entryRef, bool decoupled)
void setWindow(sc_core::sc_time t, sc_core::sc_time *entryRef, sync_mode mode)
{
*entryRef = t;
... ... @@ -107,7 +149,7 @@ public:
/* wait if we're ahead the backWindow plus a quantum */
sc_core::sc_time quantum = tlm_utils::tlm_quantumkeeper::get_global_quantum();
while (!decoupled && (t > backWindow + quantum)) {
while (mode!=qemu_decoupled && (t > backWindow + quantum)) {
if (ahead.wait()) {
COUT << "Timeout reached\n";
break;
... ... @@ -200,16 +242,16 @@ class syncSource {
sc_core::sc_time *handle;
sc_core::sc_time back_window;
pthread_t owner_thread;
bool decoupled;
sync_mode mode;
public:
syncSource(bool _decoupled = false) : decoupled(_decoupled) {
syncSource(sync_mode _mode = parallel) : mode(_mode) {
owner_thread = pthread_self();
handle = centralSyncPolicy::share.registerLockable();
back_window = SC_ZERO_TIME;
centralSyncPolicy::share.setWindow(back_window, handle, decoupled);
centralSyncPolicy::share.setWindow(back_window, handle, mode);
}
void syncAt(sc_core::sc_time t) {
... ... @@ -219,20 +261,15 @@ public:
if (t > back_window) {
back_window = t;
if (decoupled) {
if (mode==qemu_decoupled) {
back_window = sc_time_stamp();
}
/* setWindow could lock if WE have got ahead (SystemC is behind) */
centralSyncPolicy::share.setWindow(back_window, handle, decoupled);
centralSyncPolicy::share.setWindow(back_window, handle, mode);
}
}
};
class decoupledSource : public syncSource {
public:
decoupledSource() : syncSource(true) {}
};
}
}
... ...
/*
* util.h
*
* Copyright (C) 2014, GreenSocs Ltd.
*
* Developped by Clement Deschamps <clement.deschamps@greensocs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Linking GreenSocs code, statically or dynamically with other modules
* is making a combined work based on GreenSocs code. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders, GreenSocs
* Ltd, give you permission to combine GreenSocs code with free software
* programs or libraries that are released under the GNU LGPL, under the
* OSCI license, under the OCP TLM Kit Research License Agreement or
* under the OVP evaluation license.You may copy and distribute such a
* system following the terms of the GNU GPL and the licenses of the
* other code concerned.
*
* Note that people who make modified versions of GreenSocs code are not
* obligated to grant this special exception for their modified versions;
* it is their choice whether to do so. The GNU General Public License
* gives permission to release a modified version without this exception;
* this exception also makes it possible to release a modified version
* which carries forward this exception.
*
*/
#ifndef GS_GT_UTIL_H_
#define GS_GT_UTIL_H_
... ...