2013-02-22 08:28:05 -05:00
|
|
|
from migen.fhdl.structure import *
|
|
|
|
from migen.bus import csr
|
|
|
|
from migen.bank import description, csrgen
|
|
|
|
from migen.bank.description import *
|
|
|
|
|
|
|
|
from miscope import trigger, recorder
|
2013-06-02 09:15:47 -04:00
|
|
|
from miscope.tools.misc import *
|
2013-02-22 08:28:05 -05:00
|
|
|
|
|
|
|
class MiLa:
|
2013-06-02 09:15:47 -04:00
|
|
|
def __init__(self, address, trigger, recorder, interface=None, trig_is_dat=False):
|
2013-02-22 08:28:05 -05:00
|
|
|
|
|
|
|
self.trigger = trigger
|
|
|
|
self.recorder = recorder
|
|
|
|
self.interface = interface
|
2013-06-02 09:15:47 -04:00
|
|
|
self.trig_is_dat = trig_is_dat
|
2013-02-22 08:28:05 -05:00
|
|
|
|
2013-04-02 15:13:21 -04:00
|
|
|
self.stb = Signal(reset=1)
|
|
|
|
self.trig = Signal(self.trigger.width)
|
|
|
|
self.dat = Signal(self.recorder.width)
|
2013-02-22 08:28:05 -05:00
|
|
|
|
|
|
|
self.set_address(address)
|
|
|
|
self.set_interface(interface)
|
2013-03-21 07:23:44 -04:00
|
|
|
|
|
|
|
def set_address(self, address):
|
|
|
|
self.address = address
|
|
|
|
self.trigger.set_address(self.address)
|
|
|
|
self.recorder.set_address(self.address + 0x01)
|
|
|
|
|
2013-02-27 18:32:42 -05:00
|
|
|
def set_interface(self, interface):
|
|
|
|
self.interface = interface
|
|
|
|
self.trigger.set_interface(interface)
|
|
|
|
self.recorder.set_interface(interface)
|
2013-02-22 08:28:05 -05:00
|
|
|
|
|
|
|
def get_fragment(self):
|
|
|
|
comb =[
|
2013-04-02 15:13:21 -04:00
|
|
|
self.recorder.stb.eq(self.stb),
|
2013-02-22 08:28:05 -05:00
|
|
|
self.trigger.trig.eq(self.trig),
|
|
|
|
|
|
|
|
self.recorder.hit.eq(self.trigger.hit)
|
|
|
|
]
|
2013-06-02 09:15:47 -04:00
|
|
|
if self.trig_is_dat:
|
|
|
|
comb +=[
|
|
|
|
self.recorder.dat.eq(self.trig),
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
self.recorder.dat.eq(self.dat),
|
|
|
|
|
2013-02-22 08:28:05 -05:00
|
|
|
return Fragment(comb)
|