50c50
< runOnce(false)
---
> runOnce(false), readyList(nullptr)
93c93
< while ((p = readyList.getNext()))
---
> while ((p = readyListMethods.getNext()))
94a95,96
> while ((p = readyListThreads.getNext()))
> p->popListNode();
165c167,168
< _current = readyList.getNext();
---
> // Pull a process from the active list.
> _current = readyList->getNext();
195,199c198,199
< // Clump methods together to minimize context switching.
< static bool cluster_methods = false;
<
< if (cluster_methods && p->procKind() == ::sc_core::SC_METHOD_PROC_)
< readyList.pushFirst(p);
---
> if (p->procKind() == ::sc_core::SC_METHOD_PROC_)
> readyListMethods.pushLast(p);
201c201
< readyList.pushLast(p);
---
> readyListThreads.pushLast(p);
215a216,225
> listContains(ListNode *list, ListNode *target)
> {
> ListNode *n = list->nextListNode;
> while (n != list)
> if (n == target)
> return true;
> return false;
> }
>
> bool
217a228
> bool was_ready;
220c231
< bool was_ready = (p->nextListNode != nullptr);
---
> was_ready = (p->nextListNode != nullptr);
222d232
< return was_ready;
224,232c234,236
< bool was_ready = false;
< // Check the ready list to see if we find this process.
< ListNode *n = readyList.nextListNode;
< while (n != &readyList) {
< if (n == p) {
< was_ready = true;
< break;
< }
< }
---
> // Check the ready lists to see if we find this process.
> was_ready = listContains(&readyListMethods, p) ||
> listContains(&readyListThreads, p);
235d238
< return was_ready;
236a240
> return was_ready;
270c274
< bool empty = readyList.empty();
---
> bool empty = readyListMethods.empty() && readyListThreads.empty();
275,276c279,284
< yield();
< } while (!readyList.empty());
---
> // We run methods and threads in two seperate passes to emulate how
> // Accellera orders things, but without having to scan through a
> // unified list to find the next process of the correct type.
> readyList = &readyListMethods;
> while (!readyListMethods.empty())
> yield();
277a286,292
> readyList = &readyListThreads;
> while (!readyListThreads.empty())
> yield();
>
> // We already know that readyListThreads is empty at this point.
> } while (!readyListMethods.empty());
>