Skip to content

Commit

Permalink
Add support for CPUIFs to have parameters #80
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Mar 30, 2024
1 parent f25ba60 commit 4dfd9b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/peakrdl_regblock/cpuif/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, List
import inspect
import os

Expand Down Expand Up @@ -34,6 +34,13 @@ def data_width_bytes(self) -> int:
def port_declaration(self) -> str:
raise NotImplementedError()

@property
def parameters(self) -> List[str]:
"""
Optional list of additional parameters this CPU interface provides to
the module's definition
"""
return []

def _get_template_path_class_dir(self) -> str:
"""
Expand Down
5 changes: 4 additions & 1 deletion src/peakrdl_regblock/module_tmpl.sv
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Generated by PeakRDL-regblock - A free and open-source SystemVerilog generator
// https://github.com/SystemRDL/PeakRDL-regblock

module {{ds.module_name}} (
module {{ds.module_name}}
{%- if cpuif.parameters %} #(
{{",\n ".join(cpuif.parameters)}}
) {%- endif %} (
input wire clk,
input wire {{default_resetsignal_name}},

Expand Down

0 comments on commit 4dfd9b1

Please sign in to comment.