diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-08-16 09:01:11 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-08-16 09:01:11 +0200 |
commit | a523865a36f56882d1d0653ba9b98c65138627f5 (patch) | |
tree | cf1ef42a0dceeb213346a6b0be603ba5c432021e /testsuite/python/001units/show_units.py | |
parent | 1767c924b553bd9e25ed6e9e58492bf7ebd4df3f (diff) | |
download | ghdl-a523865a36f56882d1d0653ba9b98c65138627f5.tar.gz ghdl-a523865a36f56882d1d0653ba9b98c65138627f5.tar.bz2 ghdl-a523865a36f56882d1d0653ba9b98c65138627f5.zip |
testsuite/python: fix test name (to follow the testsuite.sh convention)
Diffstat (limited to 'testsuite/python/001units/show_units.py')
-rwxr-xr-x | testsuite/python/001units/show_units.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/testsuite/python/001units/show_units.py b/testsuite/python/001units/show_units.py deleted file mode 100755 index ad002312f..000000000 --- a/testsuite/python/001units/show_units.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -import libghdl -import libghdl.thin.name_table as name_table -import libghdl.thin.files_map as files_map -import libghdl.thin.vhdl.nodes as nodes -import libghdl.thin.vhdl.sem_lib as sem_lib - -def init(): - """Initialization: set options and then load libaries""" - libghdl.set_option(b'--std=08') - libghdl.analyze_init() - -def get_identifier_ptr(n): - """Return the python string from node :param n: identifier""" - return name_table.Get_Name_Ptr(nodes.Get_Identifier(n)).decode('utf-8') - -def list_units(filename): - # Load the file - file_id = name_table.Get_Identifier(filename.encode('utf_8')) - sfe = files_map.Read_Source_File(name_table.Null_Identifier, file_id) - if sfe == files_map.No_Source_File_Entry: - print("cannot open file '{}'".format(filename)) - return - - # Parse and analyze - file = sem_lib.Load_File(sfe) - - # Display all design units - unit = nodes.Get_First_Design_Unit(file) - while unit != nodes.Null_Iir: - lib_unit = nodes.Get_Library_Unit(unit) - if nodes.Get_Kind(lib_unit) == nodes.Iir_Kind.Entity_Declaration: - print('entity {}'.format(get_identifier_ptr(lib_unit))) - elif nodes.Get_Kind(lib_unit) == nodes.Iir_Kind.Architecture_Body: - print('architecture {}'.format(get_identifier_ptr(lib_unit))) - else: - print('unknown unit!') - unit = nodes.Get_Chain(unit) - - -def main(): - init() - list_units('demo.vhdl') - -if __name__ == '__main__': - main() |