Skip to content

Commit

Permalink
Add SystemRDL file type
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels authored Jul 30, 2023
2 parents cffba84 + d963d2a commit 6bf6d06
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
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)

Check warning on line 506 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L506

Added line #L506 was not covered by tests

@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

Check warning on line 512 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L512

Added line #L512 was not covered by tests
elif self._fileSet is not None:
return self._fileSet.SRDLVersion

Check warning on line 514 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L514

Added line #L514 was not covered by tests
else:
raise Exception("SRDLVersion was neither set locally nor globally.")

Check warning on line 516 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L516

Added line #L516 was not covered by tests

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

Check warning on line 520 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L520

Added line #L520 was not covered by tests


@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 @@ -937,6 +971,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

Check warning on line 977 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L977

Added line #L977 was not covered by tests
elif self._project is not None:
return self._project.SRDLVersion

Check warning on line 979 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L979

Added line #L979 was not covered by tests
else:
raise Exception("SRDLVersion was neither set locally nor globally.")

Check warning on line 981 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L981

Added line #L981 was not covered by tests

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

Check warning on line 985 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L985

Added line #L985 was not covered by tests

def __str__(self):
"""Returns the fileset's name."""
return self._name
Expand Down Expand Up @@ -1105,6 +1152,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 @@ -1119,6 +1167,7 @@ class Design(metaclass=ExtendedType, slots=True):
_vhdlVersion: VHDLVersion
_verilogVersion: VerilogVersion
_svVersion: SystemVerilogVersion
_srdlVersion: SystemRDLVersion
_externalVHDLLibraries: List

_vhdlLibraryDependencyGraph: Graph
Expand All @@ -1132,7 +1181,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 @@ -1147,6 +1197,7 @@ def __init__(
self._vhdlVersion = vhdlVersion
self._verilogVersion = verilogVersion
self._svVersion = svVersion
self._srdlVersion = srdlVersion
self._externalVHDLLibraries = []

self._vhdlLibraryDependencyGraph = Graph()
Expand Down Expand Up @@ -1341,6 +1392,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

Check warning on line 1398 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L1398

Added line #L1398 was not covered by tests
elif self._project is not None:
return self._project.SRDLVersion

Check warning on line 1400 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L1400

Added line #L1400 was not covered by tests
else:
raise Exception("SRDLVersion was neither set locally nor globally.")

Check warning on line 1402 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L1402

Added line #L1402 was not covered by tests

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

Check warning on line 1406 in pyEDAA/ProjectModel/__init__.py

View check run for this annotation

Codecov / codecov/patch

pyEDAA/ProjectModel/__init__.py#L1406

Added line #L1406 was not covered by tests

@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

0 comments on commit 6bf6d06

Please sign in to comment.