Add header with license and generation information to addrmap

This commit is contained in:
Dennis Potter 2021-06-26 11:37:56 +02:00
parent 6deb772196
commit 95fef548cf
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF
3 changed files with 91 additions and 0 deletions

View File

@ -104,14 +104,18 @@ class CliArguments():
# Create dictionary to save config in
config = dict()
config['list_args'] = list()
# Save input file and output directory to dump everything in
config['input_file'] = args.IN_RDL
config['output_dir'] = args.out_dir
config['list_args'].append('Ouput Directory : {}'.format(config['output_dir']))
# Map logging level string to integers
config['stream_log_level'] = logging_map[args.stream_log_level]
config['file_log_level'] = logging_map[args.file_log_level]
config['list_args'].append('Stream Log Level : {}'.format(args.stream_log_level))
config['list_args'].append('File Log Level : {}'.format(args.file_log_level))
# Determine paths to be passed to systemrdl-compiler to search
# for include files.
@ -131,13 +135,22 @@ class CliArguments():
config['real_tabs'] = args.real_tabs
config['tab_width'] = args.tab_width
config['list_args'].append('Use Real Tabs : {}'.format(config['real_tabs']))
config['list_args'].append('Tab Width : {}'.format(config['tab_width']))
# Sanity check related
config['disable_sanity'] = args.disable_sanity
config['list_args'].append('Sanity Disabled : {}'.format(config['disable_sanity']))
# Set enums
config['enums'] = not args.disable_enums
config['list_args'].append('Enums Enabled : {}'.format(config['enums']))
# Set bus
config['bus'] = args.bus
config['list_args'].append('Register Bus Type: {}'.format(config['bus']))
# Set version
config['version'] = '0.01'
return config

View File

@ -145,6 +145,24 @@ class AddrMap(Component):
import_package_list.pop()
except IndexError:
pass
import getpass
import socket
import time
import os
self.rtl_header.append(
AddrMap.templ_dict['header'].format(
user = getpass.getuser(),
time = time.strftime('%B %d %Y %H:%M:%S', config['ts']),
year = time.strftime('%Y', config['ts']),
version = config['version'],
path = os.getcwd(),
rdl_file = config['input_file'],
incdirs = '\n * - '.join(config['search_paths']),
config = '\n * - '.join(config['list_args']),
addrmap = self.name.upper(),
host = socket.gethostname()))
self.rtl_header.append(
AddrMap.templ_dict['module_declaration']['rtl'].format(

View File

@ -1,4 +1,64 @@
---
header: |-
/*****************************************************************
*
* ███████╗██████╗ ██████╗ ██╗ ██████╗ ███████╗██╗ ██╗
* ██╔════╝██╔══██╗██╔══██╗██║ ╚════██╗██╔════╝██║ ██║
* ███████╗██████╔╝██║ ██║██║ █████╔╝███████╗██║ ██║
* ╚════██║██╔══██╗██║ ██║██║ ██╔═══╝ ╚════██║╚██╗ ██╔╝
* ███████║██║ ██║██████╔╝███████╗███████╗███████║ ╚████╔╝
* ╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝╚══════╝ ╚═══╝
*
* The present RTL was generated by srdl2sv v{version}. The RTL and all
* templates the RTL is derived from are licensed under the MIT
* license. The license is shown below.
*
* srdl2sv itself is licensed under GPLv3.
*
* Maintainer : Dennis Potter <dennis@dennispotter.eu>
* Report Bugs: https://git.dennispotter.eu/Dennis/srdl2sv/issues
*
* ===GENERATION INFORMATION======================================
*
* Generation information:
* - User: : {user}
* - Time : {time}
* - Path : {path}
* - RDL file : {rdl_file}
* - Hostname : {host}
*
* RDL include directories:
* - {incdirs}
*
* Commandline arguments to srdl2sv:
* - {config}
*
* ===LICENSE OF {addrmap}.SV=====================================
*
* Copyright {year} Dennis Potter
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
****************************************************************/
module_declaration:
rtl: |-
module {name}