mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
litescope: more pep8 (when convenient), should be almost OK
This commit is contained in:
parent
4cdb0ddf3a
commit
40abd66d69
6 changed files with 26 additions and 17 deletions
|
@ -23,7 +23,7 @@ class UARTMux(Module):
|
||||||
self.bridge_pads = UARTPads()
|
self.bridge_pads = UARTPads()
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
# Route rx pad:
|
# Route rx pad:
|
||||||
# when sel==0, route it to shared rx and bridge rx
|
# when sel==0, route it to shared rx and bridge rx
|
||||||
# when sel==1, route it only to bridge rx
|
# when sel==1, route it only to bridge rx
|
||||||
|
@ -51,13 +51,14 @@ class LiteScopeUART2WB(Module, AutoCSR):
|
||||||
"write": 0x01,
|
"write": 0x01,
|
||||||
"read": 0x02
|
"read": 0x02
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, pads, clk_freq, baudrate=115200, share_uart=False):
|
def __init__(self, pads, clk_freq, baudrate=115200, share_uart=False):
|
||||||
self.wishbone = wishbone.Interface()
|
self.wishbone = wishbone.Interface()
|
||||||
if share_uart:
|
if share_uart:
|
||||||
self._sel = CSRStorage()
|
self._sel = CSRStorage()
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
if share_uart:
|
if share_uart:
|
||||||
mux = UARTMux(pads)
|
mux = UARTMux(pads)
|
||||||
uart = UARTPHYSerial(mux.bridge_pads, clk_freq, baudrate)
|
uart = UARTPHYSerial(mux.bridge_pads, clk_freq, baudrate)
|
||||||
|
|
|
@ -136,19 +136,25 @@ class LiteScopeRecorderUnit(Module):
|
||||||
data_sink.ack.eq(fifo.sink.ack),
|
data_sink.ack.eq(fifo.sink.ack),
|
||||||
|
|
||||||
fifo.source.ack.eq(fifo.fifo.level >= self.offset),
|
fifo.source.ack.eq(fifo.fifo.level >= self.offset),
|
||||||
If(trigger_sink.stb & trigger_sink.hit, NextState("POST_HIT_RECORDING"))
|
If(trigger_sink.stb & trigger_sink.hit,
|
||||||
|
NextState("POST_HIT_RECORDING")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
fsm.act("POST_HIT_RECORDING",
|
fsm.act("POST_HIT_RECORDING",
|
||||||
self.post_hit.eq(1),
|
self.post_hit.eq(1),
|
||||||
If(self.qualifier,
|
If(self.qualifier,
|
||||||
fifo.sink.stb.eq(trigger_sink.stb & trigger_sink.hit & data_sink.stb)
|
fifo.sink.stb.eq(trigger_sink.stb &
|
||||||
|
trigger_sink.hit &
|
||||||
|
data_sink.stb)
|
||||||
).Else(
|
).Else(
|
||||||
fifo.sink.stb.eq(data_sink.stb)
|
fifo.sink.stb.eq(data_sink.stb)
|
||||||
),
|
),
|
||||||
fifo.sink.data.eq(data_sink.data),
|
fifo.sink.data.eq(data_sink.data),
|
||||||
data_sink.ack.eq(fifo.sink.ack),
|
data_sink.ack.eq(fifo.sink.ack),
|
||||||
|
|
||||||
If(~fifo.sink.ack | (fifo.fifo.level >= self.length), NextState("IDLE"))
|
If(~fifo.sink.ack | (fifo.fifo.level >= self.length),
|
||||||
|
NextState("IDLE")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ class LiteScopeSoC(SoC, AutoCSR):
|
||||||
"la": 17
|
"la": 17
|
||||||
}
|
}
|
||||||
csr_map.update(SoC.csr_map)
|
csr_map.update(SoC.csr_map)
|
||||||
|
|
||||||
def __init__(self, platform):
|
def __init__(self, platform):
|
||||||
clk_freq = int((1/(platform.default_clk_period))*1000000000)
|
clk_freq = int((1/(platform.default_clk_period))*1000000000)
|
||||||
SoC.__init__(self, platform, clk_freq,
|
SoC.__init__(self, platform, clk_freq,
|
||||||
|
|
|
@ -17,13 +17,13 @@ def led_anim1(io):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
io.write(led_data)
|
io.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)
|
io.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):
|
||||||
|
|
|
@ -48,7 +48,8 @@ class LiteScopeLA(Module, AutoCSR):
|
||||||
# XXX : sys_clk must be faster than capture_clk, add Converter on data to remove this limitation
|
# XXX : sys_clk must be faster than capture_clk, add Converter on data to remove this limitation
|
||||||
if self.clk_domain is not "sys":
|
if self.clk_domain is not "sys":
|
||||||
self.submodules.fifo = AsyncFIFO(self.sink.description, 32)
|
self.submodules.fifo = AsyncFIFO(self.sink.description, 32)
|
||||||
self.submodules += RenameClockDomains(self.fifo, {"write": self.clk_domain, "read": "sys"})
|
self.submodules += RenameClockDomains(self.fifo,
|
||||||
|
{"write": self.clk_domain, "read": "sys"})
|
||||||
self.comb += Record.connect(sink, self.fifo.sink)
|
self.comb += Record.connect(sink, self.fifo.sink)
|
||||||
sink = self.fifo.source
|
sink = self.fifo.source
|
||||||
|
|
||||||
|
|
|
@ -33,25 +33,25 @@ class VCDDump(Dump):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_version(self):
|
def generate_version(self):
|
||||||
r = "$version\n"
|
r = "$version\n"
|
||||||
r += "\tmiscope VCD dump\n"
|
r += "\tmiscope VCD dump\n"
|
||||||
r += "$end\n"
|
r += "$end\n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_comment(self):
|
def generate_comment(self):
|
||||||
r = "$comment\n"
|
r = "$comment\n"
|
||||||
r += self.comment
|
r += self.comment
|
||||||
r += "\n$end\n"
|
r += "\n$end\n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_timescale(self):
|
def generate_timescale(self):
|
||||||
r = "$timescale "
|
r = "$timescale "
|
||||||
r += self.timescale
|
r += self.timescale
|
||||||
r += " $end\n"
|
r += " $end\n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_scope(self):
|
def generate_scope(self):
|
||||||
r = "$scope "
|
r = "$scope "
|
||||||
r += self.timescale
|
r += self.timescale
|
||||||
r += " $end\n"
|
r += " $end\n"
|
||||||
return r
|
return r
|
||||||
|
@ -71,17 +71,17 @@ class VCDDump(Dump):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_unscope(self):
|
def generate_unscope(self):
|
||||||
r = "$unscope "
|
r = "$unscope "
|
||||||
r += " $end\n"
|
r += " $end\n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_enddefinitions(self):
|
def generate_enddefinitions(self):
|
||||||
r = "$enddefinitions "
|
r = "$enddefinitions "
|
||||||
r += " $end\n"
|
r += " $end\n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def generate_dumpvars(self):
|
def generate_dumpvars(self):
|
||||||
r = "$dumpvars\n"
|
r = "$dumpvars\n"
|
||||||
for var in self.vars:
|
for var in self.vars:
|
||||||
r += "b"
|
r += "b"
|
||||||
r += dec2bin(var.val, var.width)
|
r += dec2bin(var.val, var.width)
|
||||||
|
|
Loading…
Reference in a new issue