Skip to content

Commit

Permalink
Add try and exceprt if fifo_reg_offset or irq_reg_offset doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
M0stafaRady committed Sep 30, 2024
1 parent be397c7 commit 0a64ccb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bus_env/bus_regs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def init_regs(self):
self.irq_exist = False
if "flags" in self.data and len(self.data["flags"]) > 0:
size = len(self.data["flags"])
try:
irq_regs_offset = self.data["info"]["irq_reg_offset"]
except KeyError:
irq_regs_offset = 0xFF00
irq_regs_offset = self.data["info"]["irq_reg_offset"]
reg_im = {
"name": "im",
Expand Down Expand Up @@ -103,7 +107,10 @@ def init_regs(self):
self.data["registers"].append(reg_clk_g)
if "fifos" in self.data and len(self.data["fifos"]) > 0:
fifo_count = 0
fifos_regs_offset = self.data["info"]["fifo_reg_offset"]
try:
fifos_regs_offset = self.data["info"]["fifo_reg_offset"]
except KeyError:
fifos_regs_offset = 0xFE00
for fifo in self.data["fifos"]:
fifo_name = fifo["name"]
reg_size = fifo["address_width"]
Expand Down

0 comments on commit 0a64ccb

Please sign in to comment.