1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
from libghdl import libghdl
from ctypes import (c_char_p, c_int32, c_int, c_bool, sizeof, c_void_p)
import libghdl.iirs as iirs
import libghdl.nodes_meta as nodes_meta
from libghdl.nodes_meta import (Attr, types)
# from libghdl_defs import (fields, Iir_Kind, types, Attr)
assert sizeof(c_bool) == 1
# libghdl
_set_option = libghdl.libghdl__set_option
_analyze_file = libghdl.libghdl__analyze_file
def set_option(opt):
return _set_option(c_char_p(opt), len(opt))
def analyze_init():
return libghdl.libghdl__analyze_init()
def analyze_file(filename):
return _analyze_file(c_char_p(filename), len(filename))
# Lists
Get_Nbr_Elements = libghdl.lists__get_nbr_elements
Get_Nth_Element = libghdl.lists__get_nth_element
Create_Iir_List = libghdl.lists__create_list
Destroy_Iir_List = libghdl.lists__destroy_list
# Files
Location_To_File = libghdl.files_map__location_to_file
Location_File_To_Pos = libghdl.files_map__location_file_to_pos
Location_File_To_Line = libghdl.files_map__location_file_to_line
Location_File_Line_To_Col = libghdl.files_map__location_file_line_to_col
Get_File_Name = libghdl.files_map__get_file_name
Get_File_Buffer = libghdl.files_map__get_file_buffer
Get_File_Buffer.restype = c_void_p
Get_File_Length = libghdl.files_map__get_file_length
Read_Source_File = libghdl.files_map__read_source_file
No_Source_File_Entry = 0
No_Location = 0
# Names
Get_Name_Length = libghdl.name_table__get_name_length
Get_Name_Ptr = libghdl.name_table__get_name_ptr
Get_Name_Ptr.restype = c_char_p
_Get_Identifier_With_Len = libghdl.name_table__get_identifier_with_len
def Get_Identifier(s):
return _Get_Identifier_With_Len(c_char_p(s), len(s))
# Ieee
class Ieee:
# Get value
Std_Logic_Type = c_int.in_dll(
libghdl, "ieee__std_logic_1164__std_logic_type")
# Get value
Std_Logic_Vector_Type = c_int.in_dll(
libghdl, "ieee__std_logic_1164__std_logic_vector_type")
# Get value
Rising_Edge = c_int.in_dll(libghdl, "ieee__std_logic_1164__rising_edge")
# Get value
Falling_Edge = c_int.in_dll(libghdl, "ieee__std_logic_1164__falling_edge")
# Flags
class Flags:
Flag_Elocations = c_bool.in_dll(libghdl, "flags__flag_elocations")
# Scanner
class Scanner:
Set_File = libghdl.scanner__set_file
Close_File = libghdl.scanner__close_file
Scan = libghdl.scanner__scan
# This is a c_int, so you want to use its .value
Current_Token = c_int.in_dll(libghdl, "scanner__current_token")
Flag_Comment = c_bool.in_dll(libghdl, "scanner__flag_comment")
Get_Current_Line = libghdl.scanner__get_current_line
Get_Token_Column = libghdl.scanner__get_token_column
Get_Token_Position = libghdl.scanner__get_token_position
Get_Position = libghdl.scanner__get_position
Current_Identifier = libghdl.scanner__current_identifier
class Parse:
Parse_Design_File = libghdl.parse__parse_design_file
class Canon:
Flag_Concurrent_Stmts = c_bool.in_dll(
libghdl, "canon__canon_flag_concurrent_stmts");
Flag_Configurations = c_bool.in_dll(
libghdl, "canon__canon_flag_configurations");
Extract_Sequential_Statement_Chain_Sensitivity = \
libghdl.canon__canon_extract_sequential_statement_chain_sensitivity
# std.standard
# Use .value
Standard_Package = c_int32.in_dll(libghdl, "std_package__standard_package")
# Use .value
Character_Type_Definition = c_int32.in_dll(
libghdl, "std_package__character_type_definition")
# libraries
Get_Libraries_Chain = libghdl.libraries__get_libraries_chain
Add_Design_Unit_Into_Library = libghdl.libraries__add_design_unit_into_library
Finish_Compilation = libghdl.libraries__finish_compilation
# Use .value
Library_Location = c_int32.in_dll(libghdl, "libraries__library_location")
# Use .value
Work_Library = c_int32.in_dll(libghdl, "libraries__work_library")
Purge_Design_File = libghdl.libraries__purge_design_file
# Disp_Tree
Disp_Iir = libghdl.disp_tree__disp_iir
# Iirs_Utils
class Iirs_Utils:
Strip_Denoting_Name = libghdl.iirs_utils__strip_denoting_name
Get_Entity = libghdl.iirs_utils__get_entity
Is_Second_Subprogram_Specification = \
libghdl.iirs_utils__is_second_subprogram_specification
Null_Iir = 0
Null_Iir_List = 0
Iir_List_Others = 1
Iir_List_All = 2
|