{"id":1580,"date":"2025-10-26T23:29:37","date_gmt":"2025-10-26T21:29:37","guid":{"rendered":"https:\/\/blog.the-leviathan.ch\/?p=1580"},"modified":"2025-10-26T23:29:37","modified_gmt":"2025-10-26T21:29:37","slug":"librepdk-mosfet-generator","status":"publish","type":"post","link":"https:\/\/blog.the-leviathan.ch\/?p=1580","title":{"rendered":"LibrePDK: MOSFET generator"},"content":{"rendered":"\n<p>OK. The last few weeks I&#8217;ve been hacking around on the LibrePDK support for <a href=\"https:\/\/www.ihp-microelectronics.com\/\" data-type=\"link\" data-id=\"https:\/\/www.ihp-microelectronics.com\/\">IHP&#8217;s<\/a> SG13G2 node.<\/p>\n\n\n\n<p>After lots of cursing and questioning my life&#8217;s choices which led me to the situation I was in, I just finally managed to make the tool dynamically spit out NMOS and PMOS FETs based on the input provided by a JSON file.<\/p>\n\n\n\n<p>For example for an NMOS (tests\/single_nmos\/single_nmos.json)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n        \"name\": \"single_nmos\",\n        \"nets\": &#91;\"drain\",\"gate\",\"source\"],\n        \"instances\": {\n                \"M1\": {\n                        \"type\":\"nmos\",\n                        \"nets\": {\n                                \"drain\": \"drain\",\n                                \"gate\": \"gate\",\n                                \"source\": \"source\",\n                                \"bulk\": \"source\"\n                        },\n                        \"R_on\": 100.0,\n                        \"V_DS\": 1.2\n                }\n        }\n}<\/code><\/pre>\n\n\n\n<p>Or matching for a PMOS (tests\/single_pmos\/single_pmos.json)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n        \"name\": \"single_pmos\",\n        \"nets\": &#91;\"drain\",\"gate\",\"source\"],\n        \"instances\": {\n                \"M1\": {\n                        \"type\":\"pmos\",\n                        \"nets\": {\n                                \"drain\": \"drain\",\n                                \"gate\": \"gate\",\n                                \"source\": \"source\",\n                                \"bulk\": \"source\"\n                        },\n                        \"R_on\": 100.0,\n                        \"V_DS\": 1.2\n                }\n        }\n}<\/code><\/pre>\n\n\n\n<p>Running <code>librepdk_generator -t SG13G2 -<br \/>d single_pmos.json -o out<\/code> in the tests\/single_pmos, opening the magic file in out results in a transistor with the proper amount of fingers.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"563\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1024x563.png\" alt=\"\" class=\"wp-image-1582\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1024x563.png 1024w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-300x165.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-768x422.png 768w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1536x844.png 1536w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image.png 1903w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>ngspice -a test1.spice produces the expected output. With 100 Ohms as target R_DS resistance in saturation, with 1.2V over Drain to Source, 12mA are pretty much what we need.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"385\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1-1024x385.png\" alt=\"\" class=\"wp-image-1583\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1-1024x385.png 1024w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1-300x113.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1-768x289.png 768w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-1.png 1400w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Same now also works for NMOS<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"572\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2-1024x572.png\" alt=\"\" class=\"wp-image-1585\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2-1024x572.png 1024w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2-300x168.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2-768x429.png 768w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2-1536x858.png 1536w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-2.png 1902w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"392\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-3-1024x392.png\" alt=\"\" class=\"wp-image-1586\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-3-1024x392.png 1024w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-3-300x115.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-3-768x294.png 768w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2025\/10\/image-3.png 1402w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>I&#8217;m done for today&#8230; OMG&#8230; that was a hackathon.<\/p>\n\n\n\n<p>You can check out the code on our LibreSilicon GitLab repo here: <a href=\"https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk\">https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk<\/a><\/p>\n\n\n\n<p>Please comment when you know why the predicted currents still are a bit off.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OK. The last few weeks I&#8217;ve been hacking around on the LibrePDK support for IHP&#8217;s SG13G2 node. After lots of cursing and questioning my life&#8217;s choices which led me to the situation I was in, I just finally managed to make the tool dynamically spit out NMOS and PMOS FETs based on the input provided &hellip; <a href=\"https:\/\/blog.the-leviathan.ch\/?p=1580\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">LibrePDK: MOSFET generator<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1580","post","type-post","status-publish","format-standard","hentry","category-daily"],"_links":{"self":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1580"}],"version-history":[{"count":3,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1580\/revisions"}],"predecessor-version":[{"id":1587,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1580\/revisions\/1587"}],"wp:attachment":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}