litex/miscope/mila.py

50 lines
1.3 KiB
Python
Raw Normal View History

2013-02-22 08:28:05 -05:00
from migen.fhdl.structure import *
2013-09-21 07:04:07 -04:00
from migen.flow.actor import *
from migen.flow.network import *
2013-02-22 08:28:05 -05:00
from migen.bus import csr
from migen.bank import description, csrgen
from migen.bank.description import *
2013-09-22 12:41:44 -04:00
from miscope.std import *
2013-09-22 07:28:12 -04:00
from miscope.trigger import Trigger
2014-04-18 04:33:05 -04:00
from miscope.storage import Recorder, RunLengthEncoder
2013-09-22 07:28:12 -04:00
2013-09-21 07:04:07 -04:00
class MiLa(Module, AutoCSR):
2013-09-22 12:41:44 -04:00
def __init__(self, width, depth, ports, rle=False):
2013-09-22 07:28:12 -04:00
self.width = width
2013-09-22 12:41:44 -04:00
self.sink = rec_dat(width)
2013-09-22 07:28:12 -04:00
trigger = Trigger(width, ports)
recorder = Recorder(width, depth)
self.submodules.trigger = trigger
self.submodules.recorder = recorder
2013-03-21 07:23:44 -04:00
2013-09-22 12:41:44 -04:00
self.comb += [
trigger.sink.stb.eq(self.sink.stb),
trigger.sink.dat.eq(self.sink.dat),
recorder.trig_sink.stb.eq(trigger.source.stb),
recorder.trig_sink.hit.eq(trigger.source.hit),
trigger.source.ack.eq(recorder.trig_sink.ack),
self.sink.ack.eq(1), #FIXME
2013-02-22 08:28:05 -05:00
]
2013-09-21 07:04:07 -04:00
2013-09-22 12:41:44 -04:00
if rle:
self.submodules.rle = RunLengthEncoder(width, 1024)
self.comb +=[
self.rle.sink.stb.eq(self.sink.stb),
self.rle.sink.dat.eq(self.sink.dat),
recorder.dat_sink.stb.eq(self.rle.source.stb),
recorder.dat_sink.dat.eq(self.rle.source.dat),
]
else:
self.comb +=[
recorder.dat_sink.stb.eq(self.sink.stb),
recorder.dat_sink.dat.eq(self.sink.dat),
]