Code Monkey home page Code Monkey logo

peakrdl-ipxact's Introduction

Documentation Status build Coverage Status PyPI - Python Version

PeakRDL-ipxact

This package implements IP-XACT import and export for the PeakRDL toolchain.

  • Export: Convert compiled SystemRDL input into IP-XACT XML
  • Import: Read an IP-XACT file and import it into the systemrdl-compiler namespace

For the command line tool, see the PeakRDL project.

Documentation

See the PeakRDL-ipxact Documentation for more details

peakrdl-ipxact's People

Contributors

amykyta3 avatar bearzly avatar hughjackson avatar krcb197 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peakrdl-ipxact's Issues

$GIT_PYTHON_GIT_EXECUTABLE required

I am trying to compile a systemRDL file to the command line using the following versions:

  • peakrdl 0.4.
  • peakrdl-ipxact 3.3.0

I use the following command

peakrdl ip-xact tests\testcases\simple.rdl -o tests\testcases\simple.xmlpeakrdl

This results in the following errors:

Traceback (most recent call last):
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\git\__init__.py", line 87, in <module>
    refresh()
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\git\__init__.py", line 76, in refresh
    if not Git.refresh(path=path):
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\git\cmd.py", line 306, in refresh
    raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\<hidden>\Documents\GitHub\PeakRDL-python\venv\Scripts\peakrdl-script.py", line 33, in <module>
    sys.exit(load_entry_point('peakrdl==0.4.0', 'console_scripts', 'peakrdl')())
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\peakrdl\main.py", line 42, in main
    subcommands += get_exporter_plugins()
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\peakrdl\plugins\exporter.py", line 87, in get_exporter_plugins
    exporter = ExporterSubcommandPluginWrapper(ep.name, ep.load())
  File "C:\Users\<hidden>\AppData\Local\Programs\Python\Python39\lib\importlib\metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "C:\Users\<hidden>\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\peakrdl_html\__init__.py", line 1, in <module>
    from .exporter import HTMLExporter
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\peakrdl_html\exporter.py", line 15, in <module>
    from gitmetheurl import GitMeTheURL
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\gitmetheurl\__init__.py", line 3, in <module>
    from .base import GitMeTheURL, GMTUException
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\gitmetheurl\base.py", line 5, in <module>
    import git
  File "c:\users\<hidden>\documents\github\peakrdl-python\venv\lib\site-packages\git\__init__.py", line 89, in <module>
    raise ImportError('Failed to initialize: {0}'.format(exc)) from exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

Why does the export process need to access Git?

Importer should set the `hw` property based on IP_XACT's `volatile` tag

Currently, hw is never set, which results in it inheriting the RDL default of rw.

When generating UVM from this, it results in the model to set each field as volatile.
Since IP-XACT has the <ipxact:volatile> attribute, update the importer to use that to imply the hardware access of the field.

Handle cases where legal IP-XACT names are not legal SystemRDL names

The IP-XACT spec (1685-2014, Section D.7) has the following description of allowed characters in names:

The Name type defines a series of any characters, excluding embedded whitespace. It needs to begin with a
letter, colon (:), or underscore (). A Name shall contain only letters, numbers, and the colon (:),
underscore (), dash (-), and dot (.) characters. Any leading or trailing spaces are removed.
This seems like a straightforward fix that I may take on if it isn't already planned.

However, SystemRDL's rules about identifiers are more strict:

An identifier assigns a name to a user-defined data type or its instance. There are two types of identifiers:
simple and escaped. Identifiers are case-sensitive. Simple identifiers have a first character that is a letter or
underscore (_) followed by zero or more letters, digits, and underscores. Escaped identifiers begin with
followed by a simple identifier.

Note, escaped identifiers allow one to use a SystemRDL keyword as an identifier, but don't allow the use of dots, dashes, colons, etc.

I'm happy to author a pull request to implement this. Writing a function/method to translate an IP-XACT name to a valid SystemRDL one is straightforward. Where might be the best place to introduce this feature? Users will likely want to control whether the transformation is performed as well as the approach taken. I think either a class method that can be overridden, or a stand alone function that is passed into importer's initializer. Thoughts?

Volatile property interpretation

Hi,

I'd like to know how the parser treats <ipxact:volatile>true</ipxact:volatile> for fields. Is there a property that is being added to fields?

Thanks

IPXACT importer is arraying registers when it is not required.

I have some IPXACT files that are from 3rd party ip with the register/dim value set to 1. Looking at the ipxact documentation this is the default. PeakRDL interprets this as an arrayed register with dimension of 1, which is kind of correct, but when I dump the html documentation the register is shown with the array square brackets[].

It would be nice if the ipxact importer checked the size of the dimension before turning the register into an arrayed register. I did a quick hack of changing:
if 'dim' in d:
to
if 'dim' in d and d['dim'][0] > 1:

That did remove the extra array indicators. However, I am pretty sure that is not the appropriate way to actually fix this.

Extend value parsing to interpret constant expressions

Apparently kactus2 will generate IP-XACT that contains constant expressions:

              <ipxact:reset>
                <ipxact:value>('hABCD) / $pow(2,0) % $pow(2,8)</ipxact:value>
                <ipxact:mask>('hffff) / $pow(2,0) % $pow(2,8)</ipxact:mask>
              </ipxact:reset>

Look into extending the importer to parse and evaluate these.

The above example is due to how Accellera defines IP-XACT conversions. Since this is implemented using an XSL transformation, they do not have a good mechanism to perform bit-slicing for register to field reset value conversion. Instead the XSL template performs this by wrapping it in an expression.
https://github.com/kactus2/k2xml_converter/blob/master/Conversion_Rules/from1685_2009_to_1685_2014.xsl#L977

Aside from this XSL conversion side-effect, not sure how common this situation actually is.
I have yet to encounter much meaningful use of expressions in IP-XACT.

Finish vendor extension hooks

Exporter:

  • Add documentation to exporter functions
  • ability to add vendor namespace & schema

Implement similar mechanism to importer

  • if extensions encountered in xml, call user-extendable function at the end of the parse function.
  • function params: extension xml node, parsed component object
  • function returns component object

Ipxact to SysRDL.

It seems like the native RDL compiler converts Ipxact to RDL first before doing anything else. Is there a switch to dump out the intermediate RDL file ?

export systemRDL

Hello,
Thanks for your systemRDL tool, now I have a ipxact xml file and import it to the space of systemRDL, how can I export it to systemRDL file?For I need change some register in systemRDL format.

IPXACT parse hdl paths

Hi,

What IPXACT xml tag is mapped to the hdl_path of a component? For example, I have an IPXACT file that one of its field supposed to have hdl_path, which is described in "pathSements" field, but the compiler doesn't seem to support it.

Use optional dependencies to avoid breaking older versions of peakrdl

I've had a bit of a dependency nightmare this morning. In our project we've got peakrdl == 0.4.0 pinned in a pip requirements.txt. But we've not (until now) pinned the version of peakrdl-ipxact as we don't use it.
This morning, a fresh install pulled in peakrdl-ipxact 3.4.0. But this breaks with peakrdl 0.4.0. Now, I see why peakrdl isn't in the list of install_requires, as you don't actually require it in all cases. And peakrdl doesn't set a max version of peakrdl-ipxact as it can't tell the future.

This appears to be what "optional dependencies" (or extra_requires) is for:
https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies

So plugins' setup.pys would say e.g.

extra_requires = {
  "PeakRDL" : ["peakrdl >= 0.7.0"],
}

and in PeakRDL's setup.py:

install_requires = [
  "peakrdl-ipxact[PeakRDL] >= 3.4.0",
  ...
]

giving you the two-way dependency checking that's currently missing.

Import IP-XACT with more than 1 memoryMap

Hello,

I have been using your https://github.com/SystemRDL/systemrdl-compiler, and recently found out about this Importer tool to combine with IP-XACT, so thank you for making these tools!

I know this importer only try to import one Memory Map if there are multiple, and the function seek_to_top_addressBlocks explains pretty well how you did it. However, I have an IPXACT input that have 2 memoryMap and I want to include both memoryMaps to the compiled object, how would I modify your code to implement this behavior? The import_file function basically make one Block the Root Node, and in SystemRDL Compiler I don't think we have the concept of multiple memory maps

EDIT: Feels like the case of 2 memory maps kind of similar to the behavior of the "Bridge" property mentioned in this issue: SystemRDL/systemrdl-compiler#72 , in the seek_to_top_addressBlocks I tried to return all the top addrBlock as a list, so in the case of 2 memory maps this function would return 2 top level blocks and I ran into the overlapping error as mentioned in the above "bridge" issue in SystemRDL compiler

alternate registers

Hi,

I have a question about the parsing of the IP-XACT file. I have a field called "alternate registers" - is it supposed to be parsed? how does the parser treats it? currently it looks like it ignores it.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.