From 79d09c90765b810424a735a60829abbb4b7a2ce2 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 23 Dec 2021 16:56:21 +0000 Subject: [PATCH] add ability to set the reset values of RegFileArray --- src/soc/regfile/regfile.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/soc/regfile/regfile.py b/src/soc/regfile/regfile.py index c3f33393..e1274b4b 100644 --- a/src/soc/regfile/regfile.py +++ b/src/soc/regfile/regfile.py @@ -107,13 +107,17 @@ class RegFileArray(Elaboratable): and read-en signals (per port). """ - def __init__(self, width, depth, synced=True, fwd_bus_mode=True): + def __init__(self, width, depth, synced=True, fwd_bus_mode=True, + resets=None): + if resets is None: + resets = [0] * depth self.synced = synced self.width = width self.depth = depth self.regs = Array(Register(width, synced=synced, - writethru=fwd_bus_mode) \ - for _ in range(self.depth)) + writethru=fwd_bus_mode, + resetval=rst) \ + for rst in resets) self._rdports = [] self._wrports = [] -- 2.30.2