Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SystemRDL file type #48

Merged
merged 10 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 66 additions & 2 deletions pyEDAA/ProjectModel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from pyTooling.Graph import Graph, Vertex
from pySVModel import VerilogVersion, SystemVerilogVersion
from pyVHDLModel import VHDLVersion
from pySystemRDLModel import SystemRDLVersion


@export
Expand Down Expand Up @@ -335,6 +336,11 @@ class HDLSourceFile(SourceFile):
"""Base-class of all HDL source files."""


@export
class RDLSourceFile(SourceFile):
"""Base-class of all RDL source files."""


@export
class NetlistFile(SourceFile):
"""Base-class of all netlist source files."""
Expand Down Expand Up @@ -490,6 +496,30 @@ def SVVersion(self, value: SystemVerilogVersion) -> None:
self._svVersion = value


@export
class SystemRDLSourceFile(RDLSourceFile, HumanReadableContent):
"""A SystemRDL source file (of any language version)."""

_srdlVersion: SystemRDLVersion

def __init__(self, path: pathlib_Path, srdlVersion: SystemRDLVersion = None, project: 'Project' = None, design: 'Design' = None, fileSet: 'FileSet' = None):
super().__init__(path, project, design, fileSet)

@property
def SystemRDLVersion(self) -> SystemRDLVersion:
"""Property setting or returning the SystemRDL version this SystemRDL source file is used in."""
if self._srdlVersion is not None:
return self._srdlVersion
elif self._fileSet is not None:
return self._fileSet.SRDLVersion
Paebbels marked this conversation as resolved.
Show resolved Hide resolved
else:
raise Exception("SRDLVersion was neither set locally nor globally.")

@SystemRDLVersion.setter
def SystemRDLVersion(self, value: SystemRDLVersion) -> None:
self._srdlVersion= value


@export
class PythonSourceFile(SourceFile, PythonContent):
"""A Python source file."""
Expand Down Expand Up @@ -581,6 +611,7 @@ class FileSet(metaclass=ExtendedType, slots=True):
:arg vhdlVersion: Default VHDL version for files in this fileset, if not specified for the file itself.
:arg verilogVersion: Default Verilog version for files in this fileset, if not specified for the file itself.
:arg svVersion: Default SystemVerilog version for files in this fileset, if not specified for the file itself.
:arg srdlVersion: Default SystemRDL version for files in this fileset, if not specified for the file itself.
"""

_name: str
Expand All @@ -597,6 +628,7 @@ class FileSet(metaclass=ExtendedType, slots=True):
_vhdlVersion: VHDLVersion
_verilogVersion: VerilogVersion
_svVersion: SystemVerilogVersion
_srdlVersion: SystemRDLVersion

def __init__(
self,
Expand All @@ -609,7 +641,8 @@ def __init__(
vhdlLibrary: Union[str, 'VHDLLibrary'] = None,
vhdlVersion: VHDLVersion = None,
verilogVersion: VerilogVersion = None,
svVersion: SystemVerilogVersion = None
svVersion: SystemVerilogVersion = None,
srdlVersion: SystemRDLVersion = None
):
self._name = name
self._topLevel = topLevel
Expand Down Expand Up @@ -639,6 +672,7 @@ def __init__(
self._vhdlVersion = vhdlVersion
self._verilogVersion = verilogVersion
self._svVersion = svVersion
self._srdlVersion = srdlVersion

@property
def Name(self) -> str:
Expand Down Expand Up @@ -910,6 +944,19 @@ def SVVersion(self) -> SystemVerilogVersion:
def SVVersion(self, value: SystemVerilogVersion) -> None:
self._svVersion = value

@property
def SRDLVersion(self) -> SystemRDLVersion:
if self._srdlVersion is not None:
return self._srdlVersion
elif self._project is not None:
return self._project.SRDLVersion
else:
raise Exception("SRDLVersion was neither set locally nor globally.")

@SRDLVersion.setter
def SRDLVersion(self, value: SystemRDLVersion) -> None:
self._srdlVersion = value

def __str__(self):
"""Returns the fileset's name."""
return self._name
Expand Down Expand Up @@ -1078,6 +1125,7 @@ class Design(metaclass=ExtendedType, slots=True):
:arg vhdlVersion: Default VHDL version for files in this design, if not specified for the file itself.
:arg verilogVersion: Default Verilog version for files in this design, if not specified for the file itself.
:arg svVersion: Default SystemVerilog version for files in this design, if not specified for the file itself.
:arg srdlVersion: Default SystemRDL version for files in this fileset, if not specified for the file itself.
"""

_name: str
Expand All @@ -1092,6 +1140,7 @@ class Design(metaclass=ExtendedType, slots=True):
_vhdlVersion: VHDLVersion
_verilogVersion: VerilogVersion
_svVersion: SystemVerilogVersion
_srdlVersion: SystemRDLVersion
_externalVHDLLibraries: List

_vhdlLibraryDependencyGraph: Graph
Expand All @@ -1105,7 +1154,8 @@ def __init__(
project: 'Project' = None,
vhdlVersion: VHDLVersion = None,
verilogVersion: VerilogVersion = None,
svVersion: SystemVerilogVersion = None
svVersion: SystemVerilogVersion = None,
srdlVersion: SystemRDLVersion = None
):
self._name = name
self._topLevel = topLevel
Expand All @@ -1120,6 +1170,7 @@ def __init__(
self._vhdlVersion = vhdlVersion
self._verilogVersion = verilogVersion
self._svVersion = svVersion
self._srdlVersion = srdlVersion
self._externalVHDLLibraries = []

self._vhdlLibraryDependencyGraph = Graph()
Expand Down Expand Up @@ -1314,6 +1365,19 @@ def SVVersion(self) -> SystemVerilogVersion:
def SVVersion(self, value: SystemVerilogVersion) -> None:
self._svVersion = value

@property
def SRDLVersion(self) -> SystemRDLVersion:
if self._srdlVersion is not None:
return self._srdlVersion
elif self._project is not None:
return self._project.SRDLVersion
else:
raise Exception("SRDLVersion was neither set locally nor globally.")

@SRDLVersion.setter
def SRDLVersion(self, value: SystemRDLVersion) -> None:
self._srdlVersion = value

@property
def ExternalVHDLLibraries(self) -> List:
return self._externalVHDLLibraries
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pyTooling >= 5.0.0
pyVHDLModel >= 0.27.1
pySVModel>=0.3.5
pySystemRDLModel >= 0.1.0