|
1 | 1 | import os |
| 2 | +import shutil |
2 | 3 | from typing import TYPE_CHECKING, Union, Any, Type, Optional, Set, List |
3 | 4 | from collections import OrderedDict |
4 | 5 |
|
@@ -126,6 +127,8 @@ def export(self, node: Union[RootNode, AddrmapNode], output_dir:str, **kwargs: A |
126 | 127 | If overriden to True: If an illegal access is performed to a read-only or write-only |
127 | 128 | register, the CPUIF response signal shows an error. For example: APB.PSLVERR = 1'b1, |
128 | 129 | AXI4LITE.*RESP = 2'b10. |
| 130 | + copy_utils_pkg: bool |
| 131 | + If overridden to True, copy the reg_utils.vhd package into the output directory. |
129 | 132 | """ |
130 | 133 | # If it is the root node, skip to top addrmap |
131 | 134 | if isinstance(node, RootNode): |
@@ -201,6 +204,12 @@ def export(self, node: Union[RootNode, AddrmapNode], output_dir:str, **kwargs: A |
201 | 204 | stream = template.stream(context) |
202 | 205 | stream.dump(module_file_path) |
203 | 206 |
|
| 207 | + if self.ds.copy_utils_pkg: |
| 208 | + shutil.copyfile( |
| 209 | + os.path.join(os.path.dirname(__file__), "..", "..", "hdl-src", "reg_utils.vhd"), |
| 210 | + os.path.join(output_dir, "reg_utils.vhd") |
| 211 | + ) |
| 212 | + |
204 | 213 | if hwif_report_file: |
205 | 214 | hwif_report_file.close() |
206 | 215 |
|
@@ -280,6 +289,9 @@ def __init__(self, top_node: AddrmapNode, kwargs: Any) -> None: |
280 | 289 | self.err_if_bad_addr = kwargs.pop("err_if_bad_addr", False) # type: bool |
281 | 290 | self.err_if_bad_rw = kwargs.pop("err_if_bad_rw", False) # type: bool |
282 | 291 |
|
| 292 | + # General exporter options |
| 293 | + self.copy_utils_pkg = kwargs.pop("copy_utils_pkg", False) # type: bool |
| 294 | + |
283 | 295 | #------------------------ |
284 | 296 | # Info about the design |
285 | 297 | #------------------------ |
|
0 commit comments