Skip to content

Commit

Permalink
TMC-IC: Fix register bound check after move the Register's width
Browse files Browse the repository at this point in the history
  • Loading branch information
trinamic-bp committed Jan 31, 2025
1 parent 9e980df commit ce333e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytrinamic/ic/tmc_ic.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ def __init__(self, name, parent, access, address, signed=False) -> None:

def is_in_bounds(self, value: int) -> bool:
if self.signed:
return -2**(self.width - 1) <= value <= 2**(self.width - 1) - 1
return -2**(self.parent.width - 1) <= value <= 2**(self.parent.width - 1) - 1
else:
return 0 <= value <= 2**self.width - 1
return 0 <= value <= 2**self.parent.width - 1

def fields(self) -> list:
"""
Expand Down

0 comments on commit ce333e3

Please sign in to comment.