Hi, Is there a way to use constant parameters and...
# openlane
b
Hi, Is there a way to use constant parameters and arithmetic in macro.cfg? Such as base_x = 500 base_y = 400 my_unit_1 base_x base_y my_unit_2 base_x+100 base_y+100 Regards,
And I never seen any comment in macro.cfg file, is there any documentation regarding to macro.cfg telling it's syntax etc. ?
m
I think this is the code from
scripts/odbpy/manual_macro_place.py
Copy code
def manual_macro_place(reader, config, fixed):
    """
    Places macros in positions and orientations specified by a config file
    """

    db_units_per_micron = reader.block.getDbUnitsPerMicron()

    # read config
    macros = {}
    with open(config, "r") as config_file:
        for line in config_file:
            # Discard comments and empty lines
            line = line.split("#")[0].strip()
            if not line:
                continue
            line = line.split()
            macros[line[0]] = [
                str(int(float(line[1]) * db_units_per_micron)),
                str(int(float(line[2]) * db_units_per_micron)),
                line[3],
            ]

    print("Placing the following macros:")
    print(macros)
So it looks like comments start with
#
and are ignored along with blank lines. It doesn’t look like variables or equations would be processed as you suggested.
b
Thanks @Mitch Bailey It is prone to math errors if you try to calculate and write positions when you have too many macros, such as near 200 in my case, anyway I have to do manually and check in the layout view
m
I bet. I wonder if you could use a preprocess like
m4
to create a placement file outside the flow.
b
Hmm, I just wrote a python script for generating macro.cfg, which seems easier for me Thanks,
👍 1