Skip to content

Commit adc640b

Browse files
committed
lib.memory: thread src_loc_at in {read,write}_port.
1 parent 5a7c2a4 commit adc640b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

amaranth/lib/memory.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def init(self, init):
159159
def attrs(self):
160160
return self._attrs
161161

162-
def read_port(self, *, domain="sync", transparent_for=()):
162+
def read_port(self, *, domain="sync", transparent_for=(), src_loc_at=0):
163163
"""Request a read port.
164164
165165
If :py:`domain` is :py:`"comb"`, the created read port is asynchronous and always enabled
@@ -185,9 +185,10 @@ def read_port(self, *, domain="sync", transparent_for=()):
185185
:class:`ReadPort`
186186
"""
187187
signature = ReadPort.Signature(shape=self.shape, addr_width=ceil_log2(self.depth))
188-
return ReadPort(signature, memory=self, domain=domain, transparent_for=transparent_for)
188+
return ReadPort(signature, memory=self, domain=domain, transparent_for=transparent_for,
189+
src_loc_at=1 + src_loc_at)
189190

190-
def write_port(self, *, domain="sync", granularity=None):
191+
def write_port(self, *, domain="sync", granularity=None, src_loc_at=0):
191192
"""Request a write port.
192193
193194
The created write port is synchronous, updating the contents of the selected row at each
@@ -208,7 +209,8 @@ def write_port(self, *, domain="sync", granularity=None):
208209
"""
209210
signature = WritePort.Signature(
210211
shape=self.shape, addr_width=ceil_log2(self.depth), granularity=granularity)
211-
return WritePort(signature, memory=self, domain=domain)
212+
return WritePort(signature, memory=self, domain=domain,
213+
src_loc_at=1 + src_loc_at)
212214

213215
# TODO: rename to read_ports
214216
@property

0 commit comments

Comments
 (0)