Add setup.py to repository to install srdl2sv

This commit is contained in:
Dennis Potter 2021-10-24 12:14:03 -07:00
parent ec02290bbe
commit 49d1b598f0
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF
10 changed files with 75 additions and 25 deletions

3
MANIFEST.in Normal file
View File

@ -0,0 +1,3 @@
include srdl2sv/components/templates/*.yaml
include srdl2sv/components/widgets/*.yaml
include srdl2sv/components/widgets/*.sv

45
setup.py Normal file
View File

@ -0,0 +1,45 @@
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname), encoding="UTF-8").read()
setup(
name = "srdl2sv",
version = "0.0.1",
author = "Dennis Potter",
author_email = "dennis@dennispotter.eu",
maintainer = "Dennis Potter",
maintainer_email = "dennis@dennispotter.eu",
description = ("A SystemRDL 2.0 to (synthesizable) SystemVerilog compiler."),
license = "GPLv3",
keywords = "systemverilog verilog systemrdl rdl hdl rtl",
url = "https://git.dennispotter.eu/Dennis/srdl2sv",
packages=['srdl2sv',
'srdl2sv.components',
'srdl2sv.components.templates',
'srdl2sv.components.widgets',
'srdl2sv.cli',
'srdl2sv.log'],
include_package_data=True,
entry_points = {
'console_scripts': ['srdl2sv=srdl2sv.srdl2sv:main', ]
},
long_description=read('README.md'),
# Note that install_requires differs from requirements.txt
# since it does not include any of the files that are used
# to perform tests (i.e., cocotb)
install_requires=[
'PyYAML==6',
'systemrdl-compiler>=1.18.0, <2'
],
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Compilers",
"Topic :: Software Development :: Code Generators",
],
)

View File

@ -9,12 +9,12 @@ import yaml
from systemrdl import node from systemrdl import node
# Local packages # Local packages
from components.component import Component from srdl2sv.components.component import Component
from components.regfile import RegFile from srdl2sv.components.regfile import RegFile
from components.register import Register from srdl2sv.components.register import Register
from components.memory import Memory from srdl2sv.components.memory import Memory
from . import templates from srdl2sv.components import templates
from . import widgets from srdl2sv.components import widgets
class AddrMap(Component): class AddrMap(Component):

View File

@ -7,7 +7,7 @@ from dataclasses import dataclass
from systemrdl import node from systemrdl import node
# Local modules # Local modules
from log.log import create_logger from srdl2sv.log.log import create_logger
# Define NamedTuple # Define NamedTuple
class TypeDef(NamedTuple): class TypeDef(NamedTuple):

View File

@ -10,8 +10,8 @@ from systemrdl.component import Reg, Regfile
from systemrdl.rdltypes import PrecedenceType, AccessType, OnReadType, OnWriteType, InterruptType from systemrdl.rdltypes import PrecedenceType, AccessType, OnReadType, OnWriteType, InterruptType
# Local modules # Local modules
from components.component import Component, TypeDef from srdl2sv.components.component import Component, TypeDef
from . import templates from srdl2sv.components import templates
class Field(Component): class Field(Component):
# Save YAML template as class variable # Save YAML template as class variable

View File

@ -7,9 +7,8 @@ from systemrdl import node
from systemrdl.rdltypes import AccessType from systemrdl.rdltypes import AccessType
# Local packages # Local packages
from components.component import Component, SWMuxEntry, SWMuxEntryDimensioned from srdl2sv.components.component import Component, SWMuxEntry, SWMuxEntryDimensioned
from . import templates from srdl2sv.components import templates
class Memory(Component): class Memory(Component):
# Save YAML template as class variable # Save YAML template as class variable

View File

@ -9,9 +9,9 @@ from systemrdl import node
from systemrdl.node import FieldNode from systemrdl.node import FieldNode
# Local packages # Local packages
from components.component import Component from srdl2sv.components.component import Component
from components.register import Register from srdl2sv.components.register import Register
from . import templates from srdl2sv.components import templates
class RegFile(Component): class RegFile(Component):

View File

@ -6,9 +6,9 @@ import yaml
from systemrdl import node from systemrdl import node
# Local modules # Local modules
from components.component import Component, SWMuxEntry, SWMuxEntryDimensioned from srdl2sv.components.component import Component, SWMuxEntry, SWMuxEntryDimensioned
from components.field import Field from srdl2sv.components.field import Field
from . import templates from srdl2sv.components import templates
class Register(Component): class Register(Component):
# Save YAML template as class variable # Save YAML template as class variable

View File

@ -9,12 +9,12 @@ import importlib.resources as pkg_resources
from systemrdl import RDLCompiler, RDLCompileError from systemrdl import RDLCompiler, RDLCompileError
# Local modules # Local modules
from components.addrmap import AddrMap from srdl2sv.components.addrmap import AddrMap
from cli.cli import CliArguments from srdl2sv.components import widgets
from log.log import create_logger from srdl2sv.cli.cli import CliArguments
from components import widgets from srdl2sv.log.log import create_logger
if __name__ == "__main__": def main():
# Take start timestamp # Take start timestamp
start = time.time() start = time.time()
@ -59,7 +59,7 @@ if __name__ == "__main__":
file=file file=file
) )
logger.info("Succesfully created '{out_addrmap_file}'") logger.info(f"Succesfully created '{out_addrmap_file}'")
# Start grabbing packages. This returns a dictionary for the main addrmap # Start grabbing packages. This returns a dictionary for the main addrmap
# and all it's child regfiles/addrmaps # and all it's child regfiles/addrmaps
@ -98,3 +98,6 @@ if __name__ == "__main__":
# Print elapsed time # Print elapsed time
logger.info("Elapsed time: %f seconds", time.time() - start) logger.info("Elapsed time: %f seconds", time.time() - start)
if __name__ == "__main__":
main()

View File

@ -35,7 +35,7 @@ default: $(ALL_COCOTB_TESTS)
@echo "##############################################################################" @echo "##############################################################################"
build_dirs/%/compile.f: systemrdl/%.rdl build_dirs/%/compile.f: systemrdl/%.rdl
../srdl2sv/main.py $? --out_dir $(shell dirname $@) --file_log_level DEBUG --stream_log_level DEBUG srdl2sv $? --out_dir $(shell dirname $@) --file_log_level DEBUG --stream_log_level DEBUG
ls $(PWD)/$(@D)/*_pkg.sv > $@ ls $(PWD)/$(@D)/*_pkg.sv > $@
ls $(PWD)/$(@D)/*amba*.sv >> $@ ls $(PWD)/$(@D)/*amba*.sv >> $@