From 4e4800e1b2461ea153ec513bd8b505dab12ef1b8 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 12 Feb 2015 20:39:29 +0100 Subject: [PATCH] simplify litescope export with do_exit call --- make.py | 5 ++++- targets/etherbone.py | 9 ++++----- targets/udp.py | 21 ++++----------------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/make.py b/make.py index 08d6e3b9..e95d14e2 100644 --- a/make.py +++ b/make.py @@ -117,7 +117,10 @@ System Clk: {} MHz write_to_file(args.csr_csv, csr_csv) if actions["build-bitstream"]: - platform.build(soc, build_name=build_name) + vns = platform.build(soc, build_name=build_name) + if hasattr(soc, "do_exit") and vns is not None: + if hasattr(soc.do_exit, '__call__'): + soc.do_exit(vns) if actions["load-bitstream"]: prog = platform.create_programmer() diff --git a/targets/etherbone.py b/targets/etherbone.py index 9b305bb5..90873665 100644 --- a/targets/etherbone.py +++ b/targets/etherbone.py @@ -1,4 +1,4 @@ -import os, atexit +import os from migen.bank import csrgen from migen.bus import wishbone, csr @@ -15,6 +15,7 @@ from litescope.frontend.la import LiteScopeLA from litescope.core.port import LiteScopeTerm from liteeth.common import * +from liteeth.generic import * from liteeth.phy.gmii import LiteEthPHYGMII from liteeth.core import LiteEthUDPIPCore from liteeth.core.etherbone import LiteEthEtherbone @@ -179,12 +180,10 @@ class EtherboneSoCDevel(EtherboneSoC, AutoCSR): self.submodules.la = LiteScopeLA(debug, 4096) self.la.trigger.add_port(LiteScopeTerm(self.la.dw)) - atexit.register(self.exit, platform) def do_finalize(self): EtherboneSoC.do_finalize(self) - def exit(self, platform): - if platform.vns is not None: - self.la.export(platform.vns, "../test/la.csv") + def do_exit(self, vns): + self.la.export(vns, "test/la.csv") default_subtarget = EtherboneSoC diff --git a/targets/udp.py b/targets/udp.py index 32d8ee9c..0a51e5e8 100644 --- a/targets/udp.py +++ b/targets/udp.py @@ -1,4 +1,4 @@ -import os, atexit +import os from migen.bank import csrgen from migen.bus import wishbone, csr @@ -15,6 +15,7 @@ from litescope.frontend.la import LiteScopeLA from litescope.core.port import LiteScopeTerm from liteeth.common import * +from liteeth.generic import * from liteeth.phy.gmii import LiteEthPHYGMII from liteeth.core import LiteEthUDPIPCore @@ -177,18 +178,6 @@ class UDPSoCDevel(UDPSoC, AutoCSR): self.core.ip.crossbar.master.sink.ip_address, self.core.ip.crossbar.master.sink.protocol, - self.loopback_buffer.sink.stb, - self.loopback_buffer.sink.sop, - self.loopback_buffer.sink.eop, - self.loopback_buffer.sink.ack, - self.loopback_buffer.sink.data, - - self.loopback_buffer.source.stb, - self.loopback_buffer.source.sop, - self.loopback_buffer.source.eop, - self.loopback_buffer.source.ack, - self.loopback_buffer.source.data, - self.phy.sink.stb, self.phy.sink.sop, self.phy.sink.eop, @@ -214,7 +203,6 @@ class UDPSoCDevel(UDPSoC, AutoCSR): self.submodules.la = LiteScopeLA(debug, 4096) self.la.trigger.add_port(LiteScopeTerm(self.la.dw)) - atexit.register(self.exit, platform) def do_finalize(self): UDPSoC.do_finalize(self) @@ -230,8 +218,7 @@ class UDPSoCDevel(UDPSoC, AutoCSR): self.core_arp_table_fsm_state.eq(self.core.arp.table.fsm.state) ] - def exit(self, platform): - if platform.vns is not None: - self.la.export(platform.vns, "../test/la.csv") + def do_exit(self, vns): + self.la.export(vns, "test/la.csv") default_subtarget = UDPSoC -- 2.30.2