host/drivers: add possibility to pass cond dict to ease trigger pattern generation

This commit is contained in:
Florent Kermarrec 2014-12-23 20:53:05 +01:00
parent 8c5c32751e
commit 834e9b99be
1 changed files with 5 additions and 1 deletions

View File

@ -67,7 +67,11 @@ class MiLaDriver():
print(s, end="|") print(s, end="|")
sys.stdout.flush() sys.stdout.flush()
def prog_term(self, port, trigger, mask): def prog_term(self, port, trigger=0, mask=0, cond=None):
if cond is not None:
for k, v in cond.items():
trigger |= getattr(self, k+"_o")*v
mask |= getattr(self, k+"_m")*v
t = getattr(self, "mila_trigger_port{d}_trig".format(d=int(port))) t = getattr(self, "mila_trigger_port{d}_trig".format(d=int(port)))
m = getattr(self, "mila_trigger_port{d}_mask".format(d=int(port))) m = getattr(self, "mila_trigger_port{d}_mask".format(d=int(port)))
t.write(trigger) t.write(trigger)