Skip to content

Commit

Permalink
add user_template_dir to config (#25)
Browse files Browse the repository at this point in the history
* add user_template_dir to config

* self review

* fixed lint and user_template_context bug

* ready for review
  • Loading branch information
Dragon-Git authored Sep 1, 2023
1 parent aec9ad4 commit 3473964
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/peakrdl_uvm/__peakrdl__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import TYPE_CHECKING

from peakrdl.plugins.exporter import ExporterSubcommandPlugin #pylint: disable=import-error
from peakrdl.config import schema #pylint: disable=import-error

from .exporter import UVMExporter

Expand All @@ -12,6 +13,12 @@
class Exporter(ExporterSubcommandPlugin):
short_desc = "Generate a UVM register model"

cfg_schema = {
"user_template_dir": schema.DirectoryPath(),
"user_template_context": schema.UserMapping(schema.String()),
}


def add_exporter_arguments(self, arg_group: 'argparse.ArgumentParser') -> None:
arg_group.add_argument(
"--file-type",
Expand Down Expand Up @@ -43,7 +50,10 @@ def add_exporter_arguments(self, arg_group: 'argparse.ArgumentParser') -> None:


def do_export(self, top_node: 'AddrmapNode', options: 'argparse.Namespace') -> None:
x = UVMExporter()
x = UVMExporter(
user_template_dir=self.cfg['user_template_dir'],
user_template_context=self.cfg['user_template_context']
)
x.export(
top_node,
options.output,
Expand Down

0 comments on commit 3473964

Please sign in to comment.