@@ -49,13 +49,17 @@ class Signature(wiring.Signature):
4949 w_stb : Signal()
5050 Write strobe. Registers should update their value or perform the write side effect when
5151 this strobe is asserted.
52-
53- Raises
54- ------
55- See :meth:`Element.Signature.check_parameters`.
5652 """
5753 def __init__ (self , width , access ):
58- self .check_parameters (width , access )
54+ if not isinstance (width , int ) or width < 0 :
55+ raise TypeError (f"Width must be a non-negative integer, not { width !r} " )
56+ # TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
57+ # instead of cls.__qualname__.
58+ # Element.Access(access)
59+ try :
60+ Element .Access (access )
61+ except ValueError as e :
62+ raise ValueError (f"{ access !r} is not a valid Element.Access" ) from e
5963
6064 self ._width = width
6165 self ._access = Element .Access (access )
@@ -81,27 +85,6 @@ def width(self):
8185 def access (self ):
8286 return self ._access
8387
84- @classmethod
85- def check_parameters (cls , width , access ):
86- """Validate signature parameters.
87-
88- Raises
89- ------
90- :exc:`TypeError`
91- If ``width`` is not an integer greater than or equal to 0.
92- :exc:`ValueError`
93- If ``access`` is not a member of :class:`Element.Access`.
94- """
95- if not isinstance (width , int ) or width < 0 :
96- raise TypeError (f"Width must be a non-negative integer, not { width !r} " )
97- # TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
98- # instead of cls.__qualname__.
99- # Element.Access(access)
100- try :
101- Element .Access (access )
102- except ValueError as e :
103- raise ValueError (f"{ access !r} is not a valid Element.Access" ) from e
104-
10588 def create (self , * , path = None , src_loc_at = 0 ):
10689 """Create a compatible interface.
10790
@@ -139,10 +122,6 @@ def __repr__(self):
139122 Register access mode.
140123 path : iter(:class:`str`)
141124 Path to this CSR interface. Optional. See :class:`wiring.PureInterface`.
142-
143- Raises
144- ------
145- See :meth:`Element.Signature.check_parameters`
146125 """
147126 def __init__ (self , width , access , * , path = None , src_loc_at = 0 ):
148127 super ().__init__ (Element .Signature (width = width , access = access ), path = path , src_loc_at = 1 + src_loc_at )
@@ -188,13 +167,12 @@ class Signature(wiring.Signature):
188167 to the register and causes write side effects to be performed (if any). If ``addr`` points
189168 to any chunk of a register, latches ``w_data`` to the captured value. Otherwise, does
190169 nothing.
191-
192- Raises
193- ------
194- See :meth:`Signature.check_parameters`.
195170 """
196171 def __init__ (self , * , addr_width , data_width ):
197- self .check_parameters (addr_width = addr_width , data_width = data_width )
172+ if not isinstance (addr_width , int ) or addr_width <= 0 :
173+ raise TypeError (f"Address width must be a positive integer, not { addr_width !r} " )
174+ if not isinstance (data_width , int ) or data_width <= 0 :
175+ raise TypeError (f"Data width must be a positive integer, not { data_width !r} " )
198176
199177 self ._addr_width = addr_width
200178 self ._data_width = data_width
@@ -216,22 +194,6 @@ def addr_width(self):
216194 def data_width (self ):
217195 return self ._data_width
218196
219- @classmethod
220- def check_parameters (cls , * , addr_width , data_width ):
221- """Validate signature parameters.
222-
223- Raises
224- ------
225- :exc:`TypeError`
226- If ``addr_width`` is not an integer greater than 0.
227- :exc:`TypeError`
228- If ``data_width`` is not an integer greater than 0.
229- """
230- if not isinstance (addr_width , int ) or addr_width <= 0 :
231- raise TypeError (f"Address width must be a positive integer, not { addr_width !r} " )
232- if not isinstance (data_width , int ) or data_width <= 0 :
233- raise TypeError (f"Data width must be a positive integer, not { data_width !r} " )
234-
235197 def create (self , * , path = None , src_loc_at = 0 ):
236198 """Create a compatible interface.
237199
@@ -288,14 +250,10 @@ class Interface(wiring.PureInterface):
288250 ----------
289251 memory_map: :class:`MemoryMap`
290252 Memory map of the bus. Optional.
291-
292- Raises
293- ------
294- See :meth:`Signature.check_parameters`.
295253 """
296254 def __init__ (self , * , addr_width , data_width , path = None , src_loc_at = 0 ):
297- sig = Signature (addr_width = addr_width , data_width = data_width )
298- super (). __init__ ( sig , path = path , src_loc_at = 1 + src_loc_at )
255+ super (). __init__ ( Signature (addr_width = addr_width , data_width = data_width ),
256+ path = path , src_loc_at = 1 + src_loc_at )
299257 self ._memory_map = None
300258
301259 @property
0 commit comments