From ffe7a952bc0ad9e7e1267203a576d5d1733f28d7 Mon Sep 17 00:00:00 2001 From: Aki Van Ness Date: Wed, 18 Oct 2023 07:33:46 -0700 Subject: [PATCH] updated torii min version and replaced deprecated call to `Repl` with `replicate` on the Value --- setup.py | 4 ++-- sol_usb/gateware/stream/generator.py | 8 ++++---- sol_usb/gateware/usb/usb3/physical/coding.py | 4 ++-- sol_usb/gateware/usb/usb3/physical/ctc.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 09d45a3e0..497e1f1ee 100644 --- a/setup.py +++ b/setup.py @@ -64,10 +64,10 @@ def doc_version(): install_requires = [ 'pyserial~=3.5', 'pyvcd>=0.2.2,<0.4', - 'rich>=12.6.0', + 'rich', 'usb-construct<1.0', - 'torii<1.0', + 'torii~=0.5', ], extras_require = { diff --git a/sol_usb/gateware/stream/generator.py b/sol_usb/gateware/stream/generator.py index a335896e9..bb7e0645a 100644 --- a/sol_usb/gateware/stream/generator.py +++ b/sol_usb/gateware/stream/generator.py @@ -273,7 +273,7 @@ def elaborate(self, platform): # If we're not enforcing a max length, always use our leftover bits-per-word. if not self._max_length_width: - m.d.comb += self.stream.valid.eq(Repl(Const(1), valid_bits_last_word)) + m.d.comb += self.stream.valid.eq(Const(1).replicate(valid_bits_last_word)) # Otherwise, do our complex case. else: @@ -283,7 +283,7 @@ def elaborate(self, platform): ending_due_to_max_length = (bytes_sent + bytes_per_word >= max_length) # ... and figure out the valid bits based us running out of data... - valid_due_to_data_length = Repl(Const(1), valid_bits_last_word) + valid_due_to_data_length = Const(1).replicate(valid_bits_last_word) # ... and due to our maximum length. Finding this arithmetically creates # difficult-to-optimize code, and bytes_per_word is going to be small, so @@ -298,7 +298,7 @@ def elaborate(self, platform): # ... with the appropriate amount of valid bits. with m.Case(i): - m.d.comb += valid_due_to_max_length.eq(Repl(Const(1), i)) + m.d.comb += valid_due_to_max_length.eq(Const(1).replicate(i)) # Our most complex logic is when both of our end conditions are met; we'll need @@ -320,7 +320,7 @@ def elaborate(self, platform): # If we're not on our last word, every valid bit should be set. with m.Else(): valid_bits = len(self.stream.valid) - m.d.comb += self.stream.valid.eq(Repl(Const(1), valid_bits)) + m.d.comb += self.stream.valid.eq(Const(1).replicate(valid_bits)) # If the current data byte is accepted, move past it. diff --git a/sol_usb/gateware/usb/usb3/physical/coding.py b/sol_usb/gateware/usb/usb3/physical/coding.py index 7b57fa13a..c18cca04f 100644 --- a/sol_usb/gateware/usb/usb3/physical/coding.py +++ b/sol_usb/gateware/usb/usb3/physical/coding.py @@ -40,13 +40,13 @@ def __init__(self, name, value, description = '', is_data = False): def value_const(self, *, repeat = 1): ''' Returns this symbol's data value as an Torii const. ''' value = Const(self.value, 8) - return Repl(value, repeat) + return value.replicate(repeat) def ctrl_const(self, *, repeat = 1): ''' Returns this symbol's ctrl value as an Torii const. ''' ctrl = Const(self.ctrl, 1) - return Repl(ctrl, repeat) + return ctrl.replicate(repeat) SKP = NamedSymbol('SKP', K(28, 1), 'Skip') # 3c diff --git a/sol_usb/gateware/usb/usb3/physical/ctc.py b/sol_usb/gateware/usb/usb3/physical/ctc.py index f3460a364..ae966bce8 100644 --- a/sol_usb/gateware/usb/usb3/physical/ctc.py +++ b/sol_usb/gateware/usb/usb3/physical/ctc.py @@ -317,8 +317,8 @@ def elaborate(self, platform): m.d.comb += self.sending_skip.eq(1) m.d.ss += [ source.valid.eq(1), - source.data.eq(Repl(SKP.value_const(), len(source.ctrl))), - source.ctrl.eq(Repl(SKP.ctrl_const(), len(source.ctrl))), + source.data.eq(SKP.value_const().replicate(len(source.ctrl))), + source.ctrl.eq(SKP.ctrl_const().replicate(len(source.ctrl))), ] with m.Else():