simplify litescope export with do_exit call
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 12 Feb 2015 19:39:29 +0000 (20:39 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 12 Feb 2015 20:00:45 +0000 (21:00 +0100)
make.py
targets/etherbone.py
targets/udp.py

diff --git a/make.py b/make.py
index 08d6e3b9fe1de2b0636efc1cdc135fccad768868..e95d14e283cc88c4c263ca97dfb54b533d8dcd45 100644 (file)
--- 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()
index 9b305bb5257247410713d30339d8789d0155f08a..90873665b4a30560693ec212a65f7677f0f69a65 100644 (file)
@@ -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
index 32d8ee9c38011266f5ea3ce17d0331efb9024955..0a51e5e835b29b438ad5231bc4e73bc9da24b0fd 100644 (file)
@@ -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