Skip to content

Commit

Permalink
Merge pull request #969 from arturum1/main
Browse files Browse the repository at this point in the history
Add support for doc_only attribute in confs and swregs
  • Loading branch information
jjts authored Nov 6, 2024
2 parents d59934b + 9d3ce53 commit 66ca69b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
3 changes: 3 additions & 0 deletions scripts/iob_soc_create_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def create_systemv(build_dir, top, peripherals_list, internal_wires=None):
periphs_inst_str += " #(\n"
# Insert parameters
for param in params_list[instance.__class__.name]:
# If param has 'doc_only' attribute set to True, skip it
if "doc_only" in param.keys() and param["doc_only"]:
continue
periphs_inst_str += " .{}({}){}\n".format(
param["name"], instance.name + "_" + param["name"], ","
)
Expand Down
12 changes: 12 additions & 0 deletions submodules/LIB/scripts/config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def params_vh(params, top_module, out_dir):
file2create = open(f"{out_dir}/{top_module}_params.vs", "w")
core_prefix = f"{top_module}_".upper()
for parameter in params:
# If parameter has 'doc_only' attribute set to True, skip it
if "doc_only" in parameter.keys() and parameter["doc_only"]:
continue
if parameter["type"] in ["P", "F"]:
p_name = parameter["name"].upper()
file2create.write(f"\n parameter {p_name} = `{core_prefix}{p_name},")
Expand All @@ -28,6 +31,9 @@ def params_vh(params, top_module, out_dir):

file2create = open(f"{out_dir}/{top_module}_inst_params.vs", "w")
for parameter in params:
# If parameter has 'doc_only' attribute set to True, skip it
if "doc_only" in parameter.keys() and parameter["doc_only"]:
continue
if parameter["type"] in ["P", "F"]:
p_name = parameter["name"].upper()
file2create.write(f"\n .{p_name}({p_name}),")
Expand All @@ -50,6 +56,9 @@ def conf_vh(macros, top_module, out_dir):
# file2create.write(f"`ifndef VH_{fname}_VH\n")
# file2create.write(f"`define VH_{fname}_VH\n\n")
for macro in macros:
# If macro has 'doc_only' attribute set to True, skip it
if "doc_only" in macro.keys() and macro["doc_only"]:
continue
if "if_defined" in macro.keys():
file2create.write(f"`ifdef {macro['if_defined']}\n")
# Only insert macro if its is not a bool define, and if so only insert it if it is true
Expand All @@ -75,6 +84,9 @@ def conf_h(macros, top_module, out_dir):
file2create.write(f"#ifndef H_{fname}_H\n")
file2create.write(f"#define H_{fname}_H\n\n")
for macro in macros:
# If macro has 'doc_only' attribute set to True, skip it
if "doc_only" in macro.keys() and macro["doc_only"]:
continue
# Only insert macro if its is not a bool define, and if so only insert it if it is true
if type(macro["val"]) != bool:
m_name = macro["name"].upper()
Expand Down
14 changes: 9 additions & 5 deletions submodules/LIB/scripts/csr_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def get_reg_table(self, regs, rw_overlap, autoaddr):
# Create reg table
reg_table = []
for i_regs in regs:
# If i_regs has 'doc_only' attribute set to True, skip it
if "doc_only" in i_regs.keys() and i_regs["doc_only"]:
continue
reg_table += i_regs["regs"]

return self.compute_addr(reg_table, rw_overlap, autoaddr)
Expand Down Expand Up @@ -1191,12 +1194,13 @@ def generate_regs_tex(cls, regs, regs_with_addr, out_dir):
for table in regs:
tex_table = []
for reg in table["regs"]:
addr = "None"
# Find address of matching register in regs_with_addr list
addr = next(
register["addr"]
for register in regs_with_addr
if register["name"] == reg["name"]
)
for reg_with_addr in regs_with_addr:
if reg_with_addr["name"] == reg["name"]:
addr = reg_with_addr["addr"]
break

tex_table.append(
[
reg["name"],
Expand Down
4 changes: 3 additions & 1 deletion submodules/LIB/scripts/ipxact_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def __init__(
while True:
for param in parameters_list:
# only replace complete words
max_size = re.sub(r"\b" + param.name + r"\b", param.max_value , max_size)
max_size = re.sub(
r"\b" + param.name + r"\b", param.max_value, max_size
)

# if the string only contains numbers or operators, evaluate it and break the loop
if re.match(r"^[0-9\+\-\*\/\(\)]+$", max_size):
Expand Down

0 comments on commit 66ca69b

Please sign in to comment.