Skip to content

Commit 4dfd9b1

Browse files
committed
Add support for CPUIFs to have parameters #80
1 parent f25ba60 commit 4dfd9b1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/peakrdl_regblock/cpuif/base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING
1+
from typing import TYPE_CHECKING, List
22
import inspect
33
import os
44

@@ -34,6 +34,13 @@ def data_width_bytes(self) -> int:
3434
def port_declaration(self) -> str:
3535
raise NotImplementedError()
3636

37+
@property
38+
def parameters(self) -> List[str]:
39+
"""
40+
Optional list of additional parameters this CPU interface provides to
41+
the module's definition
42+
"""
43+
return []
3744

3845
def _get_template_path_class_dir(self) -> str:
3946
"""

src/peakrdl_regblock/module_tmpl.sv

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// Generated by PeakRDL-regblock - A free and open-source SystemVerilog generator
22
// https://github.com/SystemRDL/PeakRDL-regblock
33

4-
module {{ds.module_name}} (
4+
module {{ds.module_name}}
5+
{%- if cpuif.parameters %} #(
6+
{{",\n ".join(cpuif.parameters)}}
7+
) {%- endif %} (
58
input wire clk,
69
input wire {{default_resetsignal_name}},
710

0 commit comments

Comments
 (0)