Skip to content

Commit 4218b2c

Browse files
committed
Dataflow.acc_custom() supports to append a label for graph drawing.
1 parent 728005d commit 4218b2c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

tests/lib_dataflow_/acc_custom/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ check:
2626

2727
.PHONY: clean
2828
clean:
29-
rm -rf *.pyc __pycache__ parsetab.py *.out tmp.v uut.vcd
29+
rm -rf *.pyc __pycache__ parsetab.py *.out *.png *.dot tmp.v uut.vcd

tests/lib_dataflow_/acc_custom/lib_dataflow_acc_custom.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ def mkLed():
2828
def op_max(left, right):
2929
return Cond(left > right, left, right)
3030

31-
psum = df.acc_custom(px, op_max, initval=0, resetcond=prst)
31+
psum = df.acc_custom(px, op_max, initval=0, resetcond=prst, label='custom')
3232
psum.output(y, valid=vy, ready=ry)
3333

3434
df.make_always()
35+
36+
try:
37+
df.draw_graph()
38+
except:
39+
print('Dataflow graph could not be generated.', file=sys.stderr)
3540

3641
return m
3742

veriloggen/lib/dataflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ def op(left, right):
9090
return vtypes.Cond(left < right, left, right)
9191
return self._accumulate([op], data, width, initval, resetcond, 'min')
9292

93-
def acc_custom(self, data, ops, initval=0, resetcond=None, width=None):
93+
def acc_custom(self, data, ops, initval=0, resetcond=None, width=None, label=None):
9494
if not isinstance(ops, (tuple, list)):
9595
ops = [ ops ]
96-
return self._accumulate(ops, data, width, initval, resetcond)
96+
return self._accumulate(ops, data, width, initval, resetcond, label)
9797

9898
#---------------------------------------------------------------------------
9999
def make_always(self, reset=(), body=()):

0 commit comments

Comments
 (0)