Skip to content

Commit

Permalink
updated torii min version and replaced deprecated call to Repl with…
Browse files Browse the repository at this point in the history
… `replicate` on the Value
  • Loading branch information
lethalbit committed Oct 18, 2023
1 parent 52b2f0a commit ffe7a95
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
8 changes: 4 additions & 4 deletions sol_usb/gateware/stream/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions sol_usb/gateware/usb/usb3/physical/coding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sol_usb/gateware/usb/usb3/physical/ctc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit ffe7a95

Please sign in to comment.