gfn.gym.helpers.chip_design.utils ================================= .. py:module:: gfn.gym.helpers.chip_design.utils .. autoapi-nested-parse:: A collection of non-prod utility functions for placement. All the dependencies in this files should be non-prod. Attributes ---------- .. autoapisummary:: gfn.gym.helpers.chip_design.utils.COST_COMPONENTS gfn.gym.helpers.chip_design.utils.ORIENTATIONS Functions --------- .. autoapisummary:: gfn.gym.helpers.chip_design.utils._proxy_cost gfn.gym.helpers.chip_design.utils.cost_info_function gfn.gym.helpers.chip_design.utils.create_blockages_by_spacing_constraints gfn.gym.helpers.chip_design.utils.create_placement_cost gfn.gym.helpers.chip_design.utils.disconnect_high_fanout_nets gfn.gym.helpers.chip_design.utils.extract_attribute_from_comments gfn.gym.helpers.chip_design.utils.extract_blockages_from_file gfn.gym.helpers.chip_design.utils.extract_sizes_from_comments gfn.gym.helpers.chip_design.utils.fd_placement_schedule gfn.gym.helpers.chip_design.utils.fix_macros_by_regex gfn.gym.helpers.chip_design.utils.fix_port_coordinates gfn.gym.helpers.chip_design.utils.get_blockages_from_comments gfn.gym.helpers.chip_design.utils.get_macro_orientations gfn.gym.helpers.chip_design.utils.get_node_locations gfn.gym.helpers.chip_design.utils.get_node_ordering_by_size gfn.gym.helpers.chip_design.utils.get_node_type_counts gfn.gym.helpers.chip_design.utils.get_node_xy_coordinates gfn.gym.helpers.chip_design.utils.get_ordered_node_indices gfn.gym.helpers.chip_design.utils.grid_locations_near gfn.gym.helpers.chip_design.utils.legalize_placement gfn.gym.helpers.chip_design.utils.make_blockage_text gfn.gym.helpers.chip_design.utils.nodes_of_types gfn.gym.helpers.chip_design.utils.optimize_orientations gfn.gym.helpers.chip_design.utils.place_near gfn.gym.helpers.chip_design.utils.read_node_order_file gfn.gym.helpers.chip_design.utils.restore_macro_orientations gfn.gym.helpers.chip_design.utils.restore_node_xy_coordinates gfn.gym.helpers.chip_design.utils.save_node_order_file gfn.gym.helpers.chip_design.utils.save_placement Module Contents --------------- .. py:data:: COST_COMPONENTS :value: ['wirelength', 'congestion', 'density'] .. py:data:: ORIENTATIONS :value: ['N', 'S', 'E', 'W', 'FN', 'FS', 'FE', 'FW'] .. py:function:: _proxy_cost(plc, wirelength_weight, density_weight, congestion_weight) .. py:function:: cost_info_function(plc, done, infeasible_state = False, wirelength_weight = 1.0, density_weight = 1.0, congestion_weight = 0.5) Returns the RL cost and info. .. py:function:: create_blockages_by_spacing_constraints(canvas_width, canvas_height, macro_boundary_x_spacing = 0, macro_boundary_y_spacing = 0, rectilinear_blockages = None) Create blockages using macro-to-boundary spacing constraints. .. py:function:: create_placement_cost(netlist_file, init_placement, overlap_threshold = 0.004, congestion_smooth_range = 5, macro_macro_x_spacing = 0.1, macro_macro_y_spacing = 0.1, boundary_check = False, horizontal_routes_per_micron = 70.33, vertical_routes_per_micron = 74.51, macro_horizontal_routing_allocation = 51.79, macro_vertical_routing_allocation = 51.79, routes_per_congestion_grid = 1000, blockages = None, fixed_macro_names_regex = None, legacy_congestion_grid = False, singularity_image = None) Creates a placement_cost object. .. py:function:: disconnect_high_fanout_nets(plc, max_allowed_fanouts = 500) .. py:function:: extract_attribute_from_comments(attribute, filenames) Parses the files' comments section, tries to extract the attribute. .. py:function:: extract_blockages_from_file(filename, canvas_width, canvas_height) Reads blockage information from a given file. .. py:function:: extract_sizes_from_comments(filenames) Parses the file's comments section, tries to extract canvas/grid sizes. .. py:function:: fd_placement_schedule(plc, num_steps = (100, 100, 100), io_factor = 1.0, move_distance_factors = (1.0, 1.0, 1.0), attract_factor = (100.0, 0.001, 1e-05), repel_factor = (0.0, 1000000.0, 10000000.0), use_current_loc = False, move_macros = False) A placement schedule that uses force directed method. .. py:function:: fix_macros_by_regex(plc, macro_regex_str_list) Fix macro locations given a list of macro name regex strings. .. py:function:: fix_port_coordinates(plc) Find all ports and fix their coordinates. .. py:function:: get_blockages_from_comments(filenames) Returns list of blockages if they exist in the file's comments section. .. py:function:: get_macro_orientations(plc) Returns all macros' orientations in a dict. .. py:function:: get_node_locations(plc) Returns all node grid locations (macros and stdcells) in a dict. .. py:function:: get_node_ordering_by_size(plc) Returns the list of nodes (macros and stdcells) ordered by area. .. py:function:: get_node_type_counts(plc) Returns number of each type of nodes in the netlist. .. py:function:: get_node_xy_coordinates(plc) Returns all node x,y coordinates (canvas) in a dict. .. py:function:: get_ordered_node_indices(mode, plc, seed = 111, node_order_file = '', exclude_fixed_nodes = True) Returns an ordering of node indices according to the specified mode. .. py:function:: grid_locations_near(plc, start_grid_index) Yields node indices closest to the start_grid_index. .. py:function:: legalize_placement(plc) Places the nodes to legal positions snapping to grid cells. .. py:function:: make_blockage_text(plc) .. py:function:: nodes_of_types(plc, type_list) Yields the index of a node of certain types. .. py:function:: optimize_orientations(plc, wirelength_weight = 1.0, density_weight = 1.0, congestion_weight = 0.5, max_iterations = 2) Coordinate descent over macro orientations. For each macro, tries all 8 orientations and greedily picks the one that minimizes the proxy cost. Repeats for ``max_iterations`` sweeps (convergence is typically reached in 1-2). .. py:function:: place_near(plc, node_index, location) Places a node (legally) closest to the given location. .. py:function:: read_node_order_file(plc, node_order_file) Reads the node order from a file. .. py:function:: restore_macro_orientations(plc, macro_orientations) .. py:function:: restore_node_xy_coordinates(plc, node_coords) .. py:function:: save_node_order_file(plc, node_order, node_order_file) Saves the node order to a file. .. py:function:: save_placement(plc, filename, user_comments = '') Saves the placement file with some information in the comments section.