Skip to content

Commit

Permalink
soc/cores/interconnect: Rely on WaitTimer's new automatic cast to int.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Jul 31, 2023
1 parent bf79c90 commit e257ff9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions litex/soc/cores/esc.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ def __init__(self, pad, sys_clk_freq, protocol="D150"):
timings.compute()

# Timers.
t0h_timer = WaitTimer(int(timings.t0h*sys_clk_freq))
t0l_timer = WaitTimer(int(timings.t0l*sys_clk_freq) - 1) # Compensate Xfer FSM latency.
t0h_timer = WaitTimer(timings.t0h*sys_clk_freq)
t0l_timer = WaitTimer(timings.t0l*sys_clk_freq - 1) # Compensate Xfer FSM latency.
self.submodules += t0h_timer, t0l_timer

t1h_timer = WaitTimer(int(timings.t1h*sys_clk_freq))
t1l_timer = WaitTimer(int(timings.t1l*sys_clk_freq) - 1) # Compensate Xfer FSM latency.
t1h_timer = WaitTimer(timings.t1h*sys_clk_freq)
t1l_timer = WaitTimer(timings.t1l*sys_clk_freq - 1) # Compensate Xfer FSM latency.
self.submodules += t1h_timer, t1l_timer

tgap_timer = WaitTimer(int(timings.tgap*sys_clk_freq))
tgap_timer = WaitTimer(timings.tgap*sys_clk_freq)
self.submodules += tgap_timer

# XFER FSM.
Expand Down
2 changes: 1 addition & 1 deletion litex/soc/cores/hyperbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, pads, latency=6, sys_clk_freq=None):

# Burst Timer ------------------------------------------------------------------------------
sys_clk_freq = 10e6 if sys_clk_freq is None else sys_clk_freq
burst_timer = WaitTimer(int(sys_clk_freq*self.tCSM))
burst_timer = WaitTimer(sys_clk_freq*self.tCSM)
self.burst_timer = burst_timer

# Clock Generation (sys_clk/4) -------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions litex/soc/cores/led.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, pads, sys_clk_freq, period=1e0, polarity=0):

chaser = Signal(self.n)
mode = Signal(reset=_CHASER_MODE)
timer = WaitTimer(int(period*sys_clk_freq/(2*self.n)))
timer = WaitTimer(period*sys_clk_freq/(2*self.n))
leds = Signal(self.n)
self.submodules += timer
self.comb += timer.wait.eq(~timer.done)
Expand Down Expand Up @@ -165,15 +165,15 @@ def __init__(self, pad, nleds, sys_clk_freq, bus_mastering=False, bus_base=None,
self.t1l = t1l = 0.45e-6

# Timers.
trst_timer = WaitTimer(int(trst*sys_clk_freq))
trst_timer = WaitTimer(trst*sys_clk_freq)
self.submodules += trst_timer

t0h_timer = WaitTimer(int(t0h*sys_clk_freq))
t0l_timer = WaitTimer(int(t0l*sys_clk_freq) - 1) # Compensate Xfer FSM latency.
t0h_timer = WaitTimer(t0h*sys_clk_freq)
t0l_timer = WaitTimer(t0l*sys_clk_freq - 1) # Compensate Xfer FSM latency.
self.submodules += t0h_timer, t0l_timer

t1h_timer = WaitTimer(int(t1h*sys_clk_freq))
t1l_timer = WaitTimer(int(t1l*sys_clk_freq) - 1) # Compensate Xfer FSM latency.
t1h_timer = WaitTimer(t1h*sys_clk_freq)
t1l_timer = WaitTimer(t1l*sys_clk_freq - 1) # Compensate Xfer FSM latency.
self.submodules += t1h_timer, t1l_timer

# Main FSM.
Expand Down
4 changes: 2 additions & 2 deletions litex/soc/cores/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def add_auto_tx_flush(self, sys_clk_freq, timeout=1e-2, interval=2):

# Flush TX FIFO when Source.ready is inactive for timeout (with interval cycles between
# each ready).
self.timer = timer = WaitTimer(int(timeout*sys_clk_freq))
self.timer = timer = WaitTimer(timeout*sys_clk_freq)
self.comb += timer.wait.eq(~self.source.ready)
self.sync += flush_count.eq(flush_count + 1)
self.comb += If(timer.done, flush_ep.ready.eq(flush_count == 0))
Expand Down Expand Up @@ -330,7 +330,7 @@ def __init__(self, phy=None, clk_freq=None, data_width=32, address_width=32):
words_count_done = (words_count == (length - 1))

self.fsm = fsm = ResetInserter()(FSM(reset_state="RECEIVE-CMD"))
self.timer = timer = WaitTimer(int(100e-3*clk_freq))
self.timer = timer = WaitTimer(100e-3*clk_freq)
self.comb += timer.wait.eq(~fsm.ongoing("RECEIVE-CMD"))
self.comb += fsm.reset.eq(timer.done)
fsm.act("RECEIVE-CMD",
Expand Down
4 changes: 2 additions & 2 deletions litex/soc/interconnect/axi/axi_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def __init__(self, master, cycles):

self.comb += self.error.eq(wr_error | rd_error)

wr_timer = WaitTimer(int(cycles))
rd_timer = WaitTimer(int(cycles))
wr_timer = WaitTimer(cycles)
rd_timer = WaitTimer(cycles)
self.submodules += wr_timer, rd_timer

def channel_fsm(timer, wait_cond, error, response):
Expand Down
4 changes: 2 additions & 2 deletions litex/soc/interconnect/axi/axi_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,8 @@ def __init__(self, master, cycles):

self.comb += self.error.eq(wr_error | rd_error)

wr_timer = WaitTimer(int(cycles))
rd_timer = WaitTimer(int(cycles))
wr_timer = WaitTimer(cycles)
rd_timer = WaitTimer(cycles)
self.submodules += wr_timer, rd_timer

def channel_fsm(timer, wait_cond, error, response):
Expand Down
2 changes: 1 addition & 1 deletion litex/soc/interconnect/wishbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, master, cycles):

# # #

timer = WaitTimer(int(cycles))
timer = WaitTimer(cycles)
self.submodules += timer
self.comb += [
timer.wait.eq(master.stb & master.cyc & ~master.ack),
Expand Down

0 comments on commit e257ff9

Please sign in to comment.