@@ -172,20 +172,6 @@ def __init__(self, *, addr_width, data_width, alignment=0, name=None):
172
172
def addr_width (self ):
173
173
return self ._addr_width
174
174
175
- @addr_width .setter
176
- def addr_width (self , addr_width ):
177
- if self ._frozen :
178
- raise ValueError ("Memory map has been frozen. Address width cannot be extended "
179
- "further" )
180
- if not isinstance (addr_width , int ) or addr_width <= 0 :
181
- raise ValueError ("Address width must be a positive integer, not {!r}"
182
- .format (addr_width ))
183
- if addr_width < self ._addr_width :
184
- raise ValueError ("Address width {!r} must not be less than its previous value {!r}, "
185
- "because resources that were previously added may not fit anymore"
186
- .format (addr_width , self ._addr_width ))
187
- self ._addr_width = addr_width
188
-
189
175
@property
190
176
def data_width (self ):
191
177
return self ._data_width
@@ -202,7 +188,7 @@ def freeze(self):
202
188
"""Freeze the memory map.
203
189
204
190
Once the memory map is frozen, its visible state becomes immutable. Resources and windows
205
- cannot be added anymore, and its address width cannot be extended further .
191
+ cannot be added anymore.
206
192
"""
207
193
self ._frozen = True
208
194
@@ -231,7 +217,7 @@ def align_to(self, alignment):
231
217
self ._next_addr = self ._align_up (self ._next_addr , max (alignment , self .alignment ))
232
218
return self ._next_addr
233
219
234
- def _compute_addr_range (self , addr , size , step = 1 , * , alignment , extend ):
220
+ def _compute_addr_range (self , addr , size , step = 1 , * , alignment ):
235
221
if addr is not None :
236
222
if not isinstance (addr , int ) or addr < 0 :
237
223
raise ValueError ("Address must be a non-negative integer, not {!r}"
@@ -249,12 +235,9 @@ def _compute_addr_range(self, addr, size, step=1, *, alignment, extend):
249
235
size = self ._align_up (max (size , 1 ), alignment )
250
236
251
237
if addr > (1 << self .addr_width ) or addr + size > (1 << self .addr_width ):
252
- if extend :
253
- self .addr_width = bits_for (addr + size )
254
- else :
255
- raise ValueError ("Address range {:#x}..{:#x} out of bounds for memory map spanning "
256
- "range {:#x}..{:#x} ({} address bits)"
257
- .format (addr , addr + size , 0 , 1 << self .addr_width , self .addr_width ))
238
+ raise ValueError ("Address range {:#x}..{:#x} out of bounds for memory map spanning "
239
+ "range {:#x}..{:#x} ({} address bits)"
240
+ .format (addr , addr + size , 0 , 1 << self .addr_width , self .addr_width ))
258
241
259
242
addr_range = range (addr , addr + size , step )
260
243
overlaps = self ._ranges .overlaps (addr_range )
@@ -274,7 +257,7 @@ def _compute_addr_range(self, addr, size, step=1, *, alignment, extend):
274
257
275
258
return addr_range
276
259
277
- def add_resource (self , resource , * , name , size , addr = None , alignment = None , extend = False ):
260
+ def add_resource (self , resource , * , name , size , addr = None , alignment = None ):
278
261
"""Add a resource.
279
262
280
263
A resource is any device on the bus that is a destination for bus transactions, e.g.
@@ -296,9 +279,6 @@ def add_resource(self, resource, *, name, size, addr=None, alignment=None, exten
296
279
``2 ** max(alignment, self.alignment)``.
297
280
alignment : int, power-of-2 exponent
298
281
Alignment of the resource. Optional. If ``None``, the memory map alignment is used.
299
- extend: bool
300
- Allow memory map extension. If ``True``, the upper bound of the address space is
301
- raised as needed, in order to fit a resource that would otherwise be out of bounds.
302
282
303
283
Return value
304
284
------------
@@ -336,7 +316,7 @@ def add_resource(self, resource, *, name, size, addr=None, alignment=None, exten
336
316
else :
337
317
alignment = self .alignment
338
318
339
- addr_range = self ._compute_addr_range (addr , size , alignment = alignment , extend = extend )
319
+ addr_range = self ._compute_addr_range (addr , size , alignment = alignment )
340
320
self ._ranges .insert (addr_range , resource )
341
321
self ._resources [id (resource )] = resource , name , addr_range
342
322
self ._namespace [name ] = resource
@@ -356,7 +336,7 @@ def resources(self):
356
336
for resource , resource_name , resource_range in self ._resources .values ():
357
337
yield resource , resource_name , (resource_range .start , resource_range .stop )
358
338
359
- def add_window (self , window , * , addr = None , sparse = None , extend = False ):
339
+ def add_window (self , window , * , addr = None , sparse = None ):
360
340
"""Add a window.
361
341
362
342
A window is a device on a bus that provides access to a different bus, i.e. a bus bridge.
@@ -386,9 +366,6 @@ def add_window(self, window, *, addr=None, sparse=None, extend=False):
386
366
sparse : bool
387
367
Address translation type. Optional. Ignored if the datapath widths of both memory maps
388
368
are equal; must be specified otherwise.
389
- extend : bool
390
- Allow memory map extension. If ``True``, the upper bound of the address space is
391
- raised as needed, in order to fit a window that would otherwise be out of bounds.
392
369
393
370
Return value
394
371
------------
@@ -464,8 +441,7 @@ def add_window(self, window, *, addr=None, sparse=None, extend=False):
464
441
# a window can still be aligned using align_to().
465
442
alignment = max (self .alignment , window .addr_width // ratio )
466
443
467
- addr_range = self ._compute_addr_range (addr , size , ratio , alignment = alignment ,
468
- extend = extend )
444
+ addr_range = self ._compute_addr_range (addr , size , ratio , alignment = alignment )
469
445
window .freeze ()
470
446
self ._ranges .insert (addr_range , window )
471
447
self ._windows [id (window )] = window , addr_range
0 commit comments