Skip to content

Commit 7060934

Browse files
committed
dataflow scheduler has a result memo.
1 parent 30afca2 commit 7060934

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

veriloggen/dataflow/allocator.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
from __future__ import absolute_import
22
from __future__ import print_function
33

4-
from . import dtypes
5-
from .visitor import _Visitor
6-
7-
class Allocator(_Visitor):
4+
class Allocator(object):
85
def __init__(self, **custom_methods):
96
self.custom_methods = custom_methods
107

veriloggen/dataflow/scheduler.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@ def schedule(self, nodes):
1919
#-------------------------------------------------------------------------------
2020
class ASAPScheduler(_Scheduler):
2121
""" Determine the scheduled cycle and insert delay variables to fill the gap """
22-
22+
23+
def __init__(self):
24+
self.visited_node = {}
25+
26+
def visit(self, node):
27+
if node in self.visited_node:
28+
return self.visited_node[node]
29+
30+
ret = _Scheduler.visit(self, node)
31+
self.visited_node[node] = ret
32+
return ret
33+
2334
def schedule(self, nodes):
2435
for node in sorted(nodes, key=lambda x:x.object_id):
2536
self.visit(node)

0 commit comments

Comments
 (0)