RTimothyEdwards / magic

Magic VLSI Layout Tool
Other
498 stars 103 forks source link

LEF write seems to take forever #249

Open smunaut opened 1 year ago

smunaut commented 1 year ago

lef-bug.zip

Attached is a test case to reproduce. This was tested with magic 400 and it seems to hang. (I waited 30+ min for this test case but for another attempt I left it to run overnight for 10+ hours)

It was working with magic 394 however.

RTimothyEdwards commented 1 year ago

@smunaut : The issue here is not that it is taking forever, but that it is taking a very, very long time. The change from magic 394 was a necessity---previously, "lef write -hide" would rip out the middle of the circuit and then write out all pin information. However, then the antenna area calculations could be very far off because any antenna area that was inside the deleted area in the middle would not be counted. As a consequence, "lef write" now has to do a search on every net connected to every pin. For a large design, this takes a long time, although it is likely that the worst-case times are coming from running the checks on power supplies (which is not needed, but magic can't automatically tell what is and isn't a power supply).

I think some more detailed options are needed for "lef write". (1) Maybe make the antenna calculations optional, in which case the processing would be very fast at the expense of not having antenna areas output; (2) Maybe allow a list of nets to ignore for antenna processing to be passed to "lef write". I don't know what the performance impact of that would be; certainly longer than the original code but probably reasonable even for a large design like your example.

RTimothyEdwards commented 1 year ago

@smunaut : In the new magic version 8.3.403, I have added the new command option "lef nocheck [ ...]". This command allows you to specify a list of nets (presumably power and ground nets) which should not be checked for antenna diffusion and gate area. That allows magic to optimize the time taken to process the layout for LEF output while retaining the (correct) antenna gate and diffusion area measurements for those nets that require it.

For the Caravel user project wrapper, for example, the command would be "lef nocheck vccd vssd vccd1 vssd1 vccd2 vssd2 vdda vssa vdda1 vssa1 vdda2 vssa2". I ran this on our example user project from the "caravel_user_project" repository, and the time to write the LEF dropped from > 6 hours to about 10-15 minutes.