[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DC1HR7DX8DG6N533CFQBCJ":3,"skill-same:01M7DC1HR7DX8DG6N533CFQBCJ":50},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":28,"updatedAt":29,"install":30,"resources":43},"01M7DC1HR7DX8DG6N533CFQBCJ","macro_pin_side",null,"FeSens\u002FopenTPU","FeSens","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12564805?v=4","01M7DC0SN8SKKXCAKHK8DJTYVB","Felipe Sens Bonetto","01M7DC0SNY1FBQJGE5TQY1NXX7",971,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fmacro_pin_side\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# Skill: Macro pin-side highlight\n\nDetect the **signal-pin side(s)** of every macro from OpenROAD DB geometry and draw a\nthick highlight line on **every** pin-bearing edge in a whole-die PNG. A macro may have\npins on more than one side (e.g. an SRAM with pins on both L and R) — each real pin side\nis highlighted, not just the single dominant one.\n\n**Key idea:** never infer the pin side visually from a screenshot. The side comes\nfrom `iterm getBBox`, which already reflects the macro's *current placed\norientation* (R0\u002FR90\u002FMX\u002FMY…). The screenshot is only the canvas we annotate.\n\n## What it does\n\n1. OpenROAD loads the placement (`--odb`, or `--def` + LEFs).\n2. For every **BLOCK** instance:\n   - take the placed bbox (`inst getBBox`),\n   - iterate `inst getITerms`, keep only `getSigType == SIGNAL`,\n   - compute each pin center from `iterm getBBox`,\n   - measure its distance to the macro L\u002FR\u002FT\u002FB edges and count it toward the\n     nearest edge,\n   - dominant side = edge with the most pins (`NONE` if no signal pins).\n3. Writes structured text, one line per macro (the per-edge `counts` are the source\n   of truth; pin **side(s)** are derived from them in Python — see step 5):\n   ```\n   MACRO_PIN_SIDE name=\u003Cinst> orient=\u003Corient> side=\u003CL\u002FR\u002FT\u002FB\u002FNONE> dominant=\u003Cn> \\\n       counts=L:\u003Cn>,R:\u003Cn>,T:\u003Cn>,B:\u003Cn> bbox=(x0,y0,x1,y1)\n   ```\n   (bbox in microns. `side` = the single dominant edge; `counts` carry all four so a\n   multi-side macro can be recovered without re-running OpenROAD.)\n4. `save_image` of the whole die, following the **whole-die-with-pins** convention\n   of `skills_Nangate45\u002Fimage_snapshot`: the save area is the union of the die box\n   and the top-level IO-pin (bterm) boxes, padded by `margin`, and the signal\u002Fclock\n   bterm boxes are recorded so they can be redrawn (OpenROAD rasterizes thin pins to\n   near-invisibility at die zoom).\n5. Python derives each macro's pin **side(s)** from the per-edge counts with\n   `pin_sides(counts, min_pins)`: an edge is a pin side when it carries at least\n   `--min-pins` signal pins (default **1** = every edge with any pins). Each pin is\n   already binned to its geometrically nearest edge, so this reports **all** real\n   pin sides — a macro with address\u002Fdata on L+R and control on T+B shows **four**\n   bars (e.g. `L:40 R:38 T:10 B:10` → `L,R,T,B`). Then it maps each macro\u002Fpin bbox\n   micron→pixel (with Y-flip) and draws:\n   - the **IO pins** as small **cyan** boxes (so the die-edge pins stay visible), then\n   - a **black-shadow + bright-red** bar on **each** pin side of every macro, drawn\n     **just inside that macro**, hugging the pin edge and **inset to ~70%** of the\n     edge length. Keeping it inside (not in the channel) means the bar is never\n     confused with the neighbouring macro across an abutting edge,\n   - a **numbered label** (yellow-on-black) drawn **once per macro**, on the dominant\n     pin side. The number is the macro's index in the printed summary \u002F\n     `MACRO_PIN_SIDE` order, so you can read bar → macro name. Disable with `--no-label`.\n\n   The stdout summary prints `sides=\u003Ccomma list>` and a `side_combos` histogram\n   (e.g. `{'LR': 12}`) so multi-side macros are obvious without opening the image.\n\n## Usage\n\n```bash\nconda activate coder\n\npython skills\u002Fskills_Nangate45\u002Fmacro_pin_side\u002Fmacro_pin_side.py \\\n    --def     Benchmark\u002FPlaceReasoner-Bench\u002Fbp_fe\u002Fdef\u002Fu65_placed.def \\\n    --lef-dir Benchmark\u002FPlaceReasoner-Bench\u002Fbp_fe\u002Flef \\\n    --out-dir \u002F…\u002FOpenLayout_macro\u002Fwork_images \\\n    --design  bp_fe_u65\n```\n\nFrom a checkpoint ODB instead (one `read_db` restores tech + LEF + placement):\n\n```bash\npython macro_pin_side.py --odb run\u002Ffloorplan.odb --out-dir work_images --design foo\n```\n\n### Options\n- `--lef LEF1 LEF2 …` — explicit LEFs (tech first) instead of `--lef-dir` glob.\n  `--lef-dir` globs `*.lef` and reads any name containing `tech` first.\n- `--width` (default 1600) — `save_image` pixel width; height keeps aspect.\n- `--margin` (default 0.03) — pad fraction on the die∪pins union, `pad = max(w,h) * margin`.\n- `--min-pins` (default 1) — an edge is highlighted as a pin side when it carries at\n  least this many signal pins. Default 1 shows **every** edge that has any pins (a\n  four-side macro gets four bars). Raise it (e.g. `3`) to suppress edges with only a\n  stray pin or two.\n- `--no-pins` — skip the IO-pin overlay (pins on by default, matching `image_snapshot`).\n- `--no-label` — skip the numbered macro labels next to each bar.\n- `--openroad` (default `\u002Fusr\u002Fbin\u002Fopenroad`).\n\n### Outputs (in `--out-dir`, prefixed `\u003Cdesign>_`)\n- `\u003Cdesign>_pin_side.txt` — the `MACRO_PIN_SIDE` lines (machine-readable).\n- `\u003Cdesign>_iopins.txt` — `IO_PIN sig=… box=(…)` lines for the bterm overlay.\n- `\u003Cdesign>_pin_side.png` — annotated whole-die-with-pins image.\n- `\u003Cdesign>_raw.png` — un-annotated OpenROAD render.\n- `\u003Cdesign>_pin_side.tcl` — the generated TCL (re-runnable \u002F inspectable).\n\nThe driver also prints a per-macro summary and the side distribution.\n\n## Notes \u002F gotchas\n- **Headless render needs `xvfb-run`** in this repo (`offscreen`\u002F`xcb` both fail —\n  see memory `feedback_openroad_save_image`). The driver already wraps OpenROAD in\n  `xvfb-run -a`.\n- `parse_sides()` and `draw_overlay()` are importable if you want to reuse the\n  highlight on an image you rendered elsewhere — pass the same micron `area` that\n  `save_image -area` used (the driver reads it from the `IMAGE_AREA` stdout line).\n- Verified on bp_fe `u65_placed.def`: 11 BLOCK macros, 8×R \u002F 3×L; red line lands on\n  the correct geometric edge (right edge present, left edge clean) under the Y-flip.\n```\n",{},"main","d84db55712aba0d40811d7762cb052f05d55b7e5","asic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fmacro_pin_side",96,"https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU","https:\u002F\u002Fgithub.com\u002FFeSens","Deep learning enthusiast.","2026-11-12 05:37:03",{"source":7,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add FeSens\u002FopenTPU --skill macro_pin_side",{"tool":36,"command":37},"bunx","bunx skills add FeSens\u002FopenTPU --skill macro_pin_side",{"tool":39,"command":40},"pnpm","pnpm dlx skills add FeSens\u002FopenTPU --skill macro_pin_side","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fmacro_pin_side\u002FSKILL.md",true,[44],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"macro_pin_side.py","SCRIPT","脚本",15525,"https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fmacro_pin_side\u002Fmacro_pin_side.py",[51,58,64,70,76,82],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M7DC1P0AS3FHJ3H19GNR2DRH","openroad-image-snapshot","Whole-die layout snapshot for any checkpoint: the executable template reads an ODB, expands the die box by a margin so boundary pins stay visible, and saves a PNG. The Worker runs it after every stage; it can also be run standalone on any saved checkpoint.","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_openroad_flow\u002Fimage_snapshot\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M7DC1E5PMVPG7RWPNW9RQXXT","image_snapshot","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fimage_snapshot\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M7DC1AYAZ3V1GWB7513BC2GN","get_macro_current_location","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fget_macro_current_location\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M7DC18434W33RQ3VA7Y75Q1R","get_die_core_info","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002Fget_die_core_info\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M7DC15TY115SNAJ7JVXRBX6G","5.optimizer","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002F5.optimizer\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M7DC0ZM9Z5RXP9Y16F67FXDK","post-route-timing-check","Check post-route static timing (TNS\u002FWNS) in OpenROAD to decide whether a macro placement exploration iteration is done. Use this skill whenever the user is running macro placement exploration, sweeping floorplans, or asking whether a placement run is \"good enough to stop\" — anytime post-route timing in OpenROAD needs to be read and compared against a goal, even if the user doesn't explicitly say \"TNS\" or \"WNS\".","https:\u002F\u002Fgithub.com\u002FFeSens\u002FopenTPU\u002Fblob\u002Fmain\u002Fasic\u002Fnangate45\u002Fopenlayout\u002Fskills\u002Fskills_Nangate45\u002F4.PPA_checker\u002FSKILL.md",[],[]]