From 95fef548cf7cffe1d4451a20aeb3fe16642023cb Mon Sep 17 00:00:00 2001 From: Dennis Date: Sat, 26 Jun 2021 11:37:56 +0200 Subject: [PATCH] Add header with license and generation information to addrmap --- srdl2sv/cli/cli.py | 13 +++++ srdl2sv/components/addrmap.py | 18 +++++++ srdl2sv/components/templates/addrmap.yaml | 60 +++++++++++++++++++++++ 3 files changed, 91 insertions(+) diff --git a/srdl2sv/cli/cli.py b/srdl2sv/cli/cli.py index b5a2cb4..4e4a3b8 100644 --- a/srdl2sv/cli/cli.py +++ b/srdl2sv/cli/cli.py @@ -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 diff --git a/srdl2sv/components/addrmap.py b/srdl2sv/components/addrmap.py index 73fbf07..35b7ae8 100644 --- a/srdl2sv/components/addrmap.py +++ b/srdl2sv/components/addrmap.py @@ -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( diff --git a/srdl2sv/components/templates/addrmap.yaml b/srdl2sv/components/templates/addrmap.yaml index 4174852..a6a4b2a 100644 --- a/srdl2sv/components/templates/addrmap.yaml +++ b/srdl2sv/components/templates/addrmap.yaml @@ -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 + * 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}