Skip to content

Commit

Permalink
const-reset hell
Browse files Browse the repository at this point in the history
  • Loading branch information
bieganski committed Sep 16, 2023
1 parent 493c702 commit 6d53184
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mtkcpu/units/csr/csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def __init__(self,
self.rd_val = Signal(32)
self.vld = Signal()
self.illegal_insn = Signal()

self.csr_regs = [x(my_reg_latch=Signal(32)) for x in __class__.enabled_csr_regs(with_virtual_memory=with_virtual_memory)]
# raise ValueError((hex(MISA.const().value)))
self.csr_regs = [x(my_reg_latch=Signal(32, reset=x.const().value)) for x in __class__.enabled_csr_regs(with_virtual_memory=with_virtual_memory)]

def elaborate(self, platform):
m = self.m = Module()
Expand Down
2 changes: 1 addition & 1 deletion mtkcpu/units/csr/csr_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def latch_whole_value_with_no_side_effect(self):

@classmethod
def const(cls) -> int:
return cls.layout.const(init=None)
return cls.layout.const(cls.reset())

@staticmethod
def reset() -> dict[str, int]:
Expand Down

0 comments on commit 6d53184

Please sign in to comment.