2015-09-08 03:50:45 -04:00
|
|
|
from liteeth.common import *
|
2015-11-24 14:44:00 -05:00
|
|
|
from liteeth.frontend.etherbone import LiteEthEtherbone
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
from targets.base import BaseSoC
|
|
|
|
|
|
|
|
|
|
|
|
class EtherboneSoC(BaseSoC):
|
|
|
|
default_platform = "kc705"
|
|
|
|
def __init__(self, platform):
|
|
|
|
BaseSoC.__init__(self, platform,
|
|
|
|
mac_address=0x10e2d5000000,
|
2016-03-15 10:40:06 -04:00
|
|
|
ip_address="192.168.1.50")
|
2015-09-07 07:28:02 -04:00
|
|
|
self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000)
|
|
|
|
self.add_wb_master(self.etherbone.master.bus)
|
|
|
|
|
|
|
|
|
|
|
|
class EtherboneSoCDevel(EtherboneSoC):
|
|
|
|
csr_map = {
|
2015-09-27 13:14:46 -04:00
|
|
|
"logic_analyzer": 20
|
2015-09-07 07:28:02 -04:00
|
|
|
}
|
|
|
|
csr_map.update(EtherboneSoC.csr_map)
|
|
|
|
def __init__(self, platform):
|
2015-09-27 13:14:46 -04:00
|
|
|
from litescope.frontend.logic_analyzer import LiteScopeLogicAnalyzer
|
2015-09-12 14:53:14 -04:00
|
|
|
from litescope.core.port import LiteScopeTerm
|
2015-09-07 07:28:02 -04:00
|
|
|
EtherboneSoC.__init__(self, platform)
|
|
|
|
debug = (
|
|
|
|
# mmap stream from HOST
|
2016-03-16 16:30:01 -04:00
|
|
|
self.etherbone.master.sink.valid,
|
|
|
|
self.etherbone.master.sink.last,
|
|
|
|
self.etherbone.master.sink.ready,
|
2015-09-07 07:28:02 -04:00
|
|
|
self.etherbone.master.sink.we,
|
|
|
|
self.etherbone.master.sink.count,
|
|
|
|
self.etherbone.master.sink.base_addr,
|
|
|
|
self.etherbone.master.sink.be,
|
|
|
|
self.etherbone.master.sink.addr,
|
|
|
|
self.etherbone.master.sink.data,
|
|
|
|
|
|
|
|
# mmap stream to HOST
|
2016-03-16 16:30:01 -04:00
|
|
|
self.etherbone.master.source.valid,
|
|
|
|
self.etherbone.master.source.last,
|
|
|
|
self.etherbone.master.source.ready,
|
2015-09-07 07:28:02 -04:00
|
|
|
self.etherbone.master.source.we,
|
|
|
|
self.etherbone.master.source.count,
|
|
|
|
self.etherbone.master.source.base_addr,
|
|
|
|
self.etherbone.master.source.be,
|
|
|
|
self.etherbone.master.source.addr,
|
|
|
|
self.etherbone.master.source.data,
|
|
|
|
|
|
|
|
# etherbone wishbone master
|
|
|
|
self.etherbone.master.bus.dat_w,
|
|
|
|
self.etherbone.master.bus.dat_r,
|
|
|
|
self.etherbone.master.bus.adr,
|
|
|
|
self.etherbone.master.bus.sel,
|
|
|
|
self.etherbone.master.bus.cyc,
|
|
|
|
self.etherbone.master.bus.stb,
|
|
|
|
self.etherbone.master.bus.ack,
|
|
|
|
self.etherbone.master.bus.we,
|
|
|
|
self.etherbone.master.bus.cti,
|
|
|
|
self.etherbone.master.bus.bte,
|
|
|
|
self.etherbone.master.bus.err
|
|
|
|
)
|
2015-09-27 13:14:46 -04:00
|
|
|
self.submodules.logic_analyzer = LiteScopeLogicAnalyzer(debug, 4096)
|
|
|
|
self.logic_analyzer.trigger.add_port(LiteScopeTerm(self.logic_analyzer.dw))
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
def do_exit(self, vns):
|
2015-09-27 13:14:46 -04:00
|
|
|
self.logic_analyzer.export(vns, "test/logic_analyzer.csv")
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
default_subtarget = EtherboneSoC
|