def build(self):
for key, value in self.regs.d.items():
if self.name == key[:len(self.name)]:
- key = key.replace(self.name + "_")
+ key = key.replace(self.name + "_", "")
setattr(self, key, value)
value = 1
for name, length in self.layout:
from migen.bank import csrgen
from migen.bus import wishbone, csr
from migen.bus import wishbone2csr
-from migen.genlib.cdc import *
-from migen.genlib.resetsync import AsyncResetSynchronizer
from migen.bank.description import *
from misoclib import identifier
from litescope.common import *
from litescope.bridge.uart2wb import LiteScopeUART2WB
from litescope.frontend.io import LiteScopeIO
-
+from litescope.frontend.la import LiteScopeLA
+from litescope.core.trigger import LiteScopeTerm
class _CRG(Module):
def __init__(self, clk_in):
class LiteScopeSoC(GenSoC, AutoCSR):
default_platform = "de0nano"
csr_map = {
- "io": 10
+ "io": 10,
+ "la": 11
}
csr_map.update(GenSoC.csr_map)
-
- def __init__(self, platform, export_mila=False):
+ def __init__(self, platform, export_conf=False):
clk_freq = 50*1000000
GenSoC.__init__(self, platform, clk_freq)
self.submodules.crg = _CRG(platform.request("clk50"))
self.leds = Cat(*[platform.request("user_led", i) for i in range(8)])
self.comb += self.leds.eq(self.io.o)
+ cnt0 = Signal(8)
+ cnt1 = Signal(8)
+ self.sync += [
+ cnt0.eq(cnt0+1),
+ cnt1.eq(cnt1+2)
+ ]
+ debug = (
+ cnt0,
+ cnt1
+ )
+ self.submodules.la = LiteScopeLA(depth=512, dat=Cat(*debug))
+ self.la.add_port(LiteScopeTerm)
+ if export_conf:
+ self.la.export(self, debug, "./test/la.csv")
+
+
default_subtarget = LiteScopeSoC
--- /dev/null
+from config import *
+from litescope.host.driver import LiteScopeLADriver
+
+wb.open()
+###
+la = LiteScopeLADriver(wb.regs, "la")
+
+cond = {"cnt0" : 128} # trigger on cnt0 = 128
+la.prog_term(port=0, cond=cond)
+la.prog_sum("term")
+la.trigger(offset=128, length=256)
+
+la.wait_done()
+la.read()
+
+la.export("dump.vcd")
+la.export("dump.csv")
+la.export("dump.py")
+###
+wb.close()