change names of frontend modules: io --> inout, la--> logic_analyzer
This commit is contained in:
parent
c436e160b6
commit
7623739f5a
7
README
7
README
|
@ -94,12 +94,11 @@ devel [AT] lists.m-labs.hk.
|
||||||
|
|
||||||
6. Test design:
|
6. Test design:
|
||||||
go to test and run:
|
go to test and run:
|
||||||
./make.py --port your_serial_port test_io (will blink leds)
|
./make.py --port your_serial_port test_inout (will blink leds)
|
||||||
./make.py --port your_serial_port test_la (will capture counter)
|
./make.py --port your_serial_port test_logic_analyzer (will capture counter)
|
||||||
|
|
||||||
tests can also be executed over Etherbone (provided with LiteEth):
|
tests can also be executed over Etherbone (provided with LiteEth):
|
||||||
./make.py --ip_address fpga_ip_address test_io
|
./make.py --ip_address fpga_ip_address your_test
|
||||||
./make.py --ip_address fpga_ip_address test_la
|
|
||||||
|
|
||||||
[> Simulations:
|
[> Simulations:
|
||||||
XXX convert simulations
|
XXX convert simulations
|
||||||
|
|
|
@ -116,15 +116,15 @@ if __name__ == "__main__":
|
||||||
logic analyzer core powered by Migen
|
logic analyzer core powered by Migen
|
||||||
|
|
||||||
====== Building parameters: ======""")
|
====== Building parameters: ======""")
|
||||||
if hasattr(soc, "io"):
|
if hasattr(soc, "inout"):
|
||||||
print("""
|
print("""
|
||||||
LiscopeIO
|
LiscopeIO
|
||||||
---------
|
---------
|
||||||
Width: {}
|
Width: {}
|
||||||
""".format(soc.io.dw)
|
""".format(soc.inout.dw)
|
||||||
)
|
)
|
||||||
|
|
||||||
if hasattr(soc, "la"):
|
if hasattr(soc, "logic_analyzer"):
|
||||||
print("""
|
print("""
|
||||||
LiscopeLA
|
LiscopeLA
|
||||||
---------
|
---------
|
||||||
|
@ -133,10 +133,10 @@ Depth: {}
|
||||||
Subsampler: {}
|
Subsampler: {}
|
||||||
RLE: {}
|
RLE: {}
|
||||||
===============================""".format(
|
===============================""".format(
|
||||||
soc.la.dw,
|
soc.logic_analyzer.dw,
|
||||||
soc.la.depth,
|
soc.logic_analyzer.depth,
|
||||||
str(soc.la.with_subsampler),
|
str(soc.logic_analyzer.with_subsampler),
|
||||||
str(soc.la.with_rle)
|
str(soc.logic_analyzer.with_rle)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from migen.fhdl.std import *
|
||||||
from migen.genlib.io import CRG
|
from migen.genlib.io import CRG
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
|
||||||
|
@ -7,10 +8,10 @@ from mibuild.xilinx.platform import XilinxPlatform
|
||||||
from targets import *
|
from targets import *
|
||||||
|
|
||||||
from misoclib.soc import SoC
|
from misoclib.soc import SoC
|
||||||
from litescope.common import *
|
|
||||||
from litescope.core.port import LiteScopeTerm
|
from litescope.core.port import LiteScopeTerm
|
||||||
from litescope.frontend.io import LiteScopeIO
|
from litescope.frontend.inout import LiteScopeInOut
|
||||||
from litescope.frontend.la import LiteScopeLA
|
from litescope.frontend.logic_analyzer import LiteScopeLogicAnalyzer
|
||||||
|
|
||||||
|
|
||||||
_io = [
|
_io = [
|
||||||
|
@ -38,7 +39,7 @@ class CorePlatform(XilinxPlatform):
|
||||||
class Core(SoC):
|
class Core(SoC):
|
||||||
platform = CorePlatform()
|
platform = CorePlatform()
|
||||||
csr_map = {
|
csr_map = {
|
||||||
"la": 16
|
"logic_analyzer": 16
|
||||||
}
|
}
|
||||||
csr_map.update(SoC.csr_map)
|
csr_map.update(SoC.csr_map)
|
||||||
|
|
||||||
|
@ -56,8 +57,8 @@ class Core(SoC):
|
||||||
self.add_wb_master(self.cpu_or_bridge.wishbone)
|
self.add_wb_master(self.cpu_or_bridge.wishbone)
|
||||||
|
|
||||||
self.bus = platform.request("bus")
|
self.bus = platform.request("bus")
|
||||||
self.submodules.la = LiteScopeLA((self.bus), 512, with_rle=True, with_subsampler=True)
|
self.submodules.logic_analyzer = LiteScopeLogicAnalyzer((self.bus), 512, with_rle=True, with_subsampler=True)
|
||||||
self.la.trigger.add_port(LiteScopeTerm(self.la.dw))
|
self.logic_analyzer.trigger.add_port(LiteScopeTerm(self.logic_analyzer.dw))
|
||||||
|
|
||||||
def get_ios(self):
|
def get_ios(self):
|
||||||
ios = set()
|
ios = set()
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
from migen.genlib.io import CRG
|
from migen.genlib.io import CRG
|
||||||
|
|
||||||
from misoclib.soc import SoC
|
from misoclib.soc import SoC
|
||||||
|
|
||||||
from litescope.common import *
|
from litescope.common import *
|
||||||
from litescope.core.port import LiteScopeTerm
|
from litescope.core.port import LiteScopeTerm
|
||||||
from litescope.frontend.io import LiteScopeIO
|
from litescope.frontend.inout import LiteScopeInOut
|
||||||
from litescope.frontend.la import LiteScopeLA
|
from litescope.frontend.logic_analyzer import LiteScopeLogicAnalyzer
|
||||||
|
|
||||||
from misoclib.com.uart.bridge import UARTWishboneBridge
|
from misoclib.com.uart.bridge import UARTWishboneBridge
|
||||||
|
|
||||||
class LiteScopeSoC(SoC):
|
class LiteScopeSoC(SoC):
|
||||||
csr_map = {
|
csr_map = {
|
||||||
"io": 16,
|
"inout" : 16,
|
||||||
"la": 17
|
"logic_analyzer" : 17
|
||||||
}
|
}
|
||||||
csr_map.update(SoC.csr_map)
|
csr_map.update(SoC.csr_map)
|
||||||
|
|
||||||
|
@ -28,10 +29,10 @@ class LiteScopeSoC(SoC):
|
||||||
self.add_wb_master(self.cpu_or_bridge.wishbone)
|
self.add_wb_master(self.cpu_or_bridge.wishbone)
|
||||||
self.submodules.crg = CRG(platform.request(platform.default_clk_name))
|
self.submodules.crg = CRG(platform.request(platform.default_clk_name))
|
||||||
|
|
||||||
self.submodules.io = LiteScopeIO(8)
|
self.submodules.inout = LiteScopeInOut(8)
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
try:
|
try:
|
||||||
self.comb += platform.request("user_led", i).eq(self.io.o[i])
|
self.comb += platform.request("user_led", i).eq(self.inout.o[i])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -48,10 +49,10 @@ class LiteScopeSoC(SoC):
|
||||||
self.debug = (
|
self.debug = (
|
||||||
counter1.value
|
counter1.value
|
||||||
)
|
)
|
||||||
self.submodules.la = LiteScopeLA(self.debug, 512, with_rle=True, with_subsampler=True)
|
self.submodules.logic_analyzer = LiteScopeLogicAnalyzer(self.debug, 512, with_rle=True, with_subsampler=True)
|
||||||
self.la.trigger.add_port(LiteScopeTerm(self.la.dw))
|
self.logic_analyzer.trigger.add_port(LiteScopeTerm(self.logic_analyzer.dw))
|
||||||
|
|
||||||
def do_exit(self, vns):
|
def do_exit(self, vns):
|
||||||
self.la.export(vns, "test/la.csv")
|
self.logic_analyzer.export(vns, "test/logic_analyzer.csv")
|
||||||
|
|
||||||
default_subtarget = LiteScopeSoC
|
default_subtarget = LiteScopeSoC
|
||||||
|
|
|
@ -4,10 +4,13 @@ SERIAL ?= 2
|
||||||
|
|
||||||
CMD = PYTHONPATH=$(COREDIR) $(PYTHON) make.py --port $(SERIAL)
|
CMD = PYTHONPATH=$(COREDIR) $(PYTHON) make.py --port $(SERIAL)
|
||||||
|
|
||||||
test_io:
|
test_regs:
|
||||||
$(CMD) test_io
|
$(CMD) test_regs
|
||||||
|
|
||||||
test_la:
|
test_inout:
|
||||||
$(CMD) test_la
|
$(CMD) test_inout
|
||||||
|
|
||||||
all: test_io test_la
|
test_logic_analyzer:
|
||||||
|
$(CMD) test_logic_analyzer
|
||||||
|
|
||||||
|
all: test_regs test_inout test_logic_analyzer
|
|
@ -1,37 +1,37 @@
|
||||||
import time
|
import time
|
||||||
from litescope.software.driver.io import LiteScopeIODriver
|
from litescope.software.driver.inout import LiteScopeInOutDriver
|
||||||
|
|
||||||
|
|
||||||
def led_anim0(io):
|
def led_anim0(inout):
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
io.write(0xA5)
|
inout.write(0xA5)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
io.write(0x5A)
|
inout.write(0x5A)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
|
||||||
def led_anim1(io):
|
def led_anim1(inout):
|
||||||
for j in range(4):
|
for j in range(4):
|
||||||
# Led <<
|
# Led <<
|
||||||
led_data = 1
|
led_data = 1
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
io.write(led_data)
|
inout.write(led_data)
|
||||||
time.sleep(i*i*0.0020)
|
time.sleep(i*i*0.0020)
|
||||||
led_data = (led_data << 1)
|
led_data = (led_data << 1)
|
||||||
# Led >>
|
# Led >>
|
||||||
ledData = 128
|
ledData = 128
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
io.write(led_data)
|
inout.write(led_data)
|
||||||
time.sleep(i*i*0.0020)
|
time.sleep(i*i*0.0020)
|
||||||
led_data = (led_data >> 1)
|
led_data = (led_data >> 1)
|
||||||
|
|
||||||
|
|
||||||
def main(wb):
|
def main(wb):
|
||||||
io = LiteScopeIODriver(wb.regs, "io")
|
inout = LiteScopeInOutDriver(wb.regs, "inout")
|
||||||
wb.open()
|
wb.open()
|
||||||
# # #
|
# # #
|
||||||
led_anim0(io)
|
led_anim0(inout)
|
||||||
led_anim1(io)
|
led_anim1(inout)
|
||||||
print("{:02X}".format(io.read()))
|
print("{:02X}".format(inout.read()))
|
||||||
# # #
|
# # #
|
||||||
wb.close()
|
wb.close()
|
|
@ -1,13 +1,12 @@
|
||||||
from litescope.software.driver.la import LiteScopeLADriver
|
from litescope.software.driver.logic_analyzer import LiteScopeLogicAnalyzerDriver
|
||||||
|
|
||||||
|
|
||||||
def main(wb):
|
def main(wb):
|
||||||
wb.open()
|
wb.open()
|
||||||
# # #
|
# # #
|
||||||
la = LiteScopeLADriver(wb.regs, "la", debug=True)
|
la = LiteScopeLogicAnalyzerDriver(wb.regs, "logic_analyzer", debug=True)
|
||||||
|
|
||||||
# cond = {"cnt0" : 128} # trigger on cnt0 = 128
|
cond = {} # immediate trigger
|
||||||
cond = {} # trigger on cnt0 = 128
|
|
||||||
la.configure_term(port=0, cond=cond)
|
la.configure_term(port=0, cond=cond)
|
||||||
la.configure_sum("term")
|
la.configure_sum("term")
|
||||||
la.configure_subsampler(1)
|
la.configure_subsampler(1)
|
|
@ -1,7 +1,7 @@
|
||||||
from litescope.common import *
|
from litescope.common import *
|
||||||
|
|
||||||
|
|
||||||
class LiteScopeIO(Module, AutoCSR):
|
class LiteScopeInOut(Module, AutoCSR):
|
||||||
def __init__(self, dw):
|
def __init__(self, dw):
|
||||||
self.dw = dw
|
self.dw = dw
|
||||||
self._input = CSRStatus(dw)
|
self._input = CSRStatus(dw)
|
|
@ -5,7 +5,7 @@ from litescope.core.storage import LiteScopeSubSampler, LiteScopeRecorder, LiteS
|
||||||
from mibuild.tools import write_to_file
|
from mibuild.tools import write_to_file
|
||||||
|
|
||||||
|
|
||||||
class LiteScopeLA(Module, AutoCSR):
|
class LiteScopeLogicAnalyzer(Module, AutoCSR):
|
||||||
def __init__(self, layout, depth, clk_domain="sys",
|
def __init__(self, layout, depth, clk_domain="sys",
|
||||||
with_input_buffer=False,
|
with_input_buffer=False,
|
||||||
with_rle=False, rle_length=256,
|
with_rle=False, rle_length=256,
|
|
@ -1,4 +1,4 @@
|
||||||
class LiteScopeIODriver():
|
class LiteScopeInOutDriver():
|
||||||
def __init__(self, regs, name):
|
def __init__(self, regs, name):
|
||||||
self.regs = regs
|
self.regs = regs
|
||||||
self.name = name
|
self.name = name
|
|
@ -5,7 +5,7 @@ from litescope.software.driver.truthtable import *
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
class LiteScopeLADriver():
|
class LiteScopeLogicAnalyzerDriver():
|
||||||
def __init__(self, regs, name, config_csv=None, clk_freq=None, debug=False):
|
def __init__(self, regs, name, config_csv=None, clk_freq=None, debug=False):
|
||||||
self.regs = regs
|
self.regs = regs
|
||||||
self.name = name
|
self.name = name
|
Loading…
Reference in New Issue