Access Libraries

Source Code

 1# Jack C. Cook
 2# Saturday, February 13, 2021
 3
 4"""
 5access_library.py
 6
 7Provide an example on how to access the following libraries:
 8- zoned rectangle
 9"""
10
11import gFunctionDatabase as gfl
12
13
14def main():
15    m = 5  # the x-direction
16    n = 4  # the y-direction
17    # ------- Rectangle Library Access Example ----------
18
19    r_lib = gfl.access.LibraryAccess(lib_style='rectangle', display=True)
20    # # find out what is available in the rectangle library
21    library_boundaries = r_lib.query_lib()
22    for key in library_boundaries:
23        start = library_boundaries[key][0]
24        stop = library_boundaries[key][1]
25        # print('({0}, {1}) -> ({2}, {3})'.format(str(start[0]).zfill(2), str(start[1]).zfill(2),
26        #                                         str(stop[0]).zfill(2), str(stop[1]).zfill(2)))
27    r_lib.primary_key_access(m, n)
28    print(r_lib.primary)
29    # ---------------------------------------------------
30    # ----- U configuration Library Access Example ------
31    u_lib = gfl.access.LibraryAccess(lib_style='U', display=True)
32    u_lib.primary_key_access(m, n)
33    print(u_lib.primary)
34    # ---------------------------------------------------
35    # ----- Open rectangle Library Access Example ------
36    o_lib = gfl.access.LibraryAccess(lib_style='Open', display=True)
37    o_lib.primary_key_access(m, n)
38    print(o_lib.primary)
39    # ---------------------------------------------------
40    # ----- Zoned Rectangle Library Access Example ------
41
42    # load up the library into memory
43    zr_lib = gfl.access.LibraryAccess(lib_style='zoned', display=True)
44    zr_lib.primary_key_access(m, n)
45    print(zr_lib.primary)
46    # ---------------------------------------------------
47
48    a = 1
49
50
51if __name__ == '__main__':
52    main()