mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
simplify LiteScopeLA export (use vns from platform on atexit)
This commit is contained in:
parent
261469814f
commit
9a3e9f86cf
3 changed files with 14 additions and 27 deletions
2
README
2
README
|
@ -49,6 +49,8 @@ external Rx/Tx pins to be ready to debug or control all your Wishbone peripheral
|
|||
[> Possibles improvements
|
||||
-------------------------
|
||||
- add standardized interfaces (AXI, Avalon-ST)
|
||||
- add protocols analyzers
|
||||
- add signals injection/generation
|
||||
- add storage in DRAM
|
||||
- add storage in HDD with LiteSATA core (to be released soon!)
|
||||
- add Ethernet Wishbone bridge
|
||||
|
|
|
@ -22,6 +22,8 @@ def _getattr_all(l, attr):
|
|||
class LiteScopeLA(Module, AutoCSR):
|
||||
def __init__(self, depth, dat, with_rle=False, clk_domain="sys", pipe=False):
|
||||
self.depth = depth
|
||||
if isinstance(dat, tuple):
|
||||
dat = Cat(*dat)
|
||||
self.with_rle = with_rle
|
||||
self.clk_domain = clk_domain
|
||||
self.pipe = pipe
|
||||
|
@ -85,26 +87,7 @@ class LiteScopeLA(Module, AutoCSR):
|
|||
else:
|
||||
self.comb += sink.connect(recorder.dat_sink)
|
||||
|
||||
def export(self, design, layout, filename):
|
||||
# XXX FIXME
|
||||
class SimAsyncResetSynchronizer(Special):
|
||||
def __init__(self, cd, async_reset):
|
||||
Special.__init__(self)
|
||||
self.cd = cd
|
||||
self.async_reset = async_reset
|
||||
|
||||
def iter_expressions(self):
|
||||
yield self.cd, "clk", SPECIAL_INPUT
|
||||
yield self.cd, "rst", SPECIAL_OUTPUT
|
||||
yield self, "async_reset", SPECIAL_INPUT
|
||||
|
||||
@staticmethod
|
||||
def lower(dr):
|
||||
return Module()
|
||||
so = {
|
||||
AsyncResetSynchronizer: SimAsyncResetSynchronizer
|
||||
}
|
||||
ret, ns = verilog.convert(design, return_ns=True, special_overrides=so)
|
||||
def export(self, layout, vns, filename):
|
||||
r = ""
|
||||
def format_line(*args):
|
||||
return ",".join(args) + "\n"
|
||||
|
@ -114,5 +97,5 @@ class LiteScopeLA(Module, AutoCSR):
|
|||
r += format_line("config", "with_rle", str(int(self.with_rle)))
|
||||
|
||||
for e in layout:
|
||||
r += format_line("layout", ns.get_name(e), str(flen(e)))
|
||||
r += format_line("layout", vns.get_name(e), str(flen(e)))
|
||||
write_to_file(filename, r)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import os
|
||||
import os, atexit
|
||||
|
||||
from migen.bank import csrgen
|
||||
from migen.bus import wishbone, csr
|
||||
|
@ -78,7 +78,7 @@ class LiteScopeSoC(GenSoC, AutoCSR):
|
|||
"la": 11
|
||||
}
|
||||
csr_map.update(GenSoC.csr_map)
|
||||
def __init__(self, platform, export_conf=False):
|
||||
def __init__(self, platform):
|
||||
clk_freq = 50*1000000
|
||||
GenSoC.__init__(self, platform, clk_freq)
|
||||
self.submodules.crg = _CRG(platform.request("clk50"))
|
||||
|
@ -93,14 +93,16 @@ class LiteScopeSoC(GenSoC, AutoCSR):
|
|||
cnt0.eq(cnt0+1),
|
||||
cnt1.eq(cnt1+2)
|
||||
]
|
||||
debug = (
|
||||
self.debug = (
|
||||
cnt0,
|
||||
cnt1
|
||||
)
|
||||
self.submodules.la = LiteScopeLA(depth=512, dat=Cat(*debug))
|
||||
self.submodules.la = LiteScopeLA(512, self.debug)
|
||||
self.la.add_port(LiteScopeTerm)
|
||||
if export_conf:
|
||||
self.la.export(self, debug, "./test/la.csv")
|
||||
atexit.register(self.exit, platform)
|
||||
|
||||
def exit(self, platform):
|
||||
if platform.vns is not None:
|
||||
self.la.export(self.debug, platform.vns, "./test/la.csv")
|
||||
|
||||
default_subtarget = LiteScopeSoC
|
||||
|
|
Loading…
Reference in a new issue