Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for doc_only attribute in confs and swregs #969

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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