{"id":1599,"date":"2026-01-07T02:41:48","date_gmt":"2026-01-07T00:41:48","guid":{"rendered":"https:\/\/blog.the-leviathan.ch\/?p=1599"},"modified":"2026-01-07T02:41:48","modified_gmt":"2026-01-07T00:41:48","slug":"librepdk-auto-generator-driver-circuit","status":"publish","type":"post","link":"https:\/\/blog.the-leviathan.ch\/?p=1599","title":{"rendered":"LibrePDK auto generator: Driver Circuit"},"content":{"rendered":"\n<p>After fighting with the place and route part of LibrePDK for over a month now, I finally managed to turn a Qucs schematic like this one into a JSON netlist which then can be fed to the generator, placer and detailed router.<\/p>\n\n\n\n<p>The schematics below which has been drawn in Qucs, can be found in the <a href=\"https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk\/-\/blob\/master\/designs\/driver.vs?ref_type=heads\" data-type=\"link\" data-id=\"https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk\/-\/blob\/master\/designs\/driver.vs?ref_type=heads\">LibrePDK GitLab repo<\/a> and shows a driver with an input, output and enable signal.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"991\" height=\"848\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/image.png\" alt=\"\" class=\"wp-image-1600\" style=\"aspect-ratio:1.168656273538609\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/image.png 991w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/image-300x257.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/image-768x657.png 768w\" sizes=\"auto, (max-width: 991px) 100vw, 991px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Converting the netlist into JSON results in the file which can be found in the <a href=\"https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk\/-\/blob\/master\/tests\/driver_circuit\/driver_circuit.json?ref_type=heads\" data-type=\"link\" data-id=\"https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk\/-\/blob\/master\/tests\/driver_circuit\/driver_circuit.json?ref_type=heads\">GitLab repo as well<\/a><\/p>\n\n\n\n<p>It&#8217;s 8 transistors with M7\/M8 being the output stage which have to drive all the current and hence need a muss lower on resistance respectively saturation current.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n\t\"name\": \"driver_circuit\",\n\t\"nets\": &#91;\"VDD\",\"VSS\",\"EN\",\"IN\",\"OUT\"],\n\t\"instances\": {\n\t\t\"M1\": {\n\t\t\t\"type\":\"pmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"3\",\n\t\t\t\t\"gate\": \"EN\",\n\t\t\t\t\"source\": \"4\",\n\t\t\t\t\"bulk\": \"4\"\n\t\t\t},\n\t\t\t\"R_on\": 1000.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M2\": {\n\t\t\t\"type\":\"pmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"1\",\n\t\t\t\t\"gate\": \"EN\",\n\t\t\t\t\"source\": \"VDD\",\n\t\t\t\t\"bulk\": \"VDD\"\n\t\t\t},\n\t\t\t\"R_on\": 1000.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M3\": {\n\t\t\t\"type\":\"nmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"3\",\n\t\t\t\t\"gate\": \"1\",\n\t\t\t\t\"source\": \"2\",\n\t\t\t\t\"bulk\": \"2\"\n\t\t\t},\n\t\t\t\"R_on\": 1000.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M4\": {\n\t\t\t\"type\":\"nmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"2\",\n\t\t\t\t\"gate\": \"IN\",\n\t\t\t\t\"source\": \"VSS\",\n\t\t\t\t\"bulk\": \"VSS\"\n\t\t\t},\n\t\t\t\"R_on\": 1900.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M5\": {\n\t\t\t\"type\":\"pmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"4\",\n\t\t\t\t\"gate\": \"IN\",\n\t\t\t\t\"source\": \"VDD\",\n\t\t\t\t\"bulk\": \"VDD\"\n\t\t\t},\n\t\t\t\"R_on\": 1000.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M6\": {\n\t\t\t\"type\":\"nmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"1\",\n\t\t\t\t\"gate\": \"EN\",\n\t\t\t\t\"source\": \"VSS\",\n\t\t\t\t\"bulk\": \"VSS\"\n\t\t\t},\n\t\t\t\"R_on\": 1000.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M7\": {\n\t\t\t\"type\":\"pmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"OUT\",\n\t\t\t\t\"gate\": \"3\",\n\t\t\t\t\"source\": \"VDD\",\n\t\t\t\t\"bulk\": \"VDD\"\n\t\t\t},\n\t\t\t\"R_on\": 100.0,\n\t\t\t\"V_DS\": 1.2\n\t\t},\n\t\t\"M8\": {\n\t\t\t\"type\":\"nmos\",\n\t\t\t\"nets\": {\n\t\t\t\t\"drain\": \"OUT\",\n\t\t\t\t\"gate\": \"3\",\n\t\t\t\t\"source\": \"VSS\",\n\t\t\t\t\"bulk\": \"VSS\"\n\t\t\t},\n\t\t\t\"R_on\": 100.0,\n\t\t\t\"V_DS\": 1.2\n\t\t}\n\t}\n}<\/code><\/pre>\n\n\n\n<p>Lets say we&#8217;ve cloned the repo with<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/gitlab.libresilicon.com\/generator-tools\/librepdk.git\ncd librepdk\nexport LIBREPDK_REPO=`pwd`<\/code><\/pre>\n\n\n\n<p>Running that JSON file through LibrePDK with the command below leaves us not only with a GDSII but also a SPICE model, Magic VLSI, DEF and LEF file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export DESIGN_DIR=$LIBREPDK_REPO\/tests\/driver_circuit\nexport DESIGN_FILE=$DESIGN_DIR\/driver_circuit.json\nexport ANAROUTE_WORKDIR=$LIBREPDK_REPO\/workdir_driver\nexport ANAROUTE_DEBUG_OUT=$ANAROUTE_WORKDIR\/debug\/\nexport ANAROUTE_DEBUG_OUT_PREFIX=$ANAROUTE_DEBUG_OUT\/snapshot\n\nrm -rf $ANAROUTE_WORKDIR\nmkdir -p $ANAROUTE_DEBUG_OUT\npushd $ANAROUTE_WORKDIR\nuv run ..\/bin\/librepdk_generator -d $DESIGN_FILE -t SG13G2 -o out &amp;> out.log\ncp $DESIGN_DIR\/*.spice .\npopd<\/code><\/pre>\n\n\n\n<p>First lets look at the GDS2 file. We can easily identify M7 and M8 because they&#8217;re much larger than the other transistors and have fingers.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"540\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709-1024x540.png\" alt=\"\" class=\"wp-image-1603\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709-1024x540.png 1024w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709-300x158.png 300w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709-768x405.png 768w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709-1536x810.png 1536w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003709.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Running the test simulations in NG Spice for when the input is enabled and disabled results in the desired behavior.<\/p>\n\n\n\n<p>Output enable is inverted so when it&#8217;s 1 (VDD) the output is disabled, when it&#8217;s 0 (VSS), the output is enabled.<\/p>\n\n\n\n<p>The below NGSPice simulation shows the result of running `<code>ngspice workdir_driver\/test1.spice<\/code> with the output being disabled.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_004122.png\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"510\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_004122.png\" alt=\"\" class=\"wp-image-1606\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_004122.png 704w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_004122-300x217.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>The below NGSPice simulation shows the result of running `<code>ngspice workdir_driver\/test2.spice<\/code> with the output being enabled.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003851.png\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"510\" src=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003851.png\" alt=\"\" class=\"wp-image-1605\" srcset=\"https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003851.png 704w, https:\/\/blog.the-leviathan.ch\/wp-content\/uploads\/2026\/01\/Screenshot_20260107_003851-300x217.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/a><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>After fighting with the place and route part of LibrePDK for over a month now, I finally managed to turn a Qucs schematic like this one into a JSON netlist which then can be fed to the generator, placer and detailed router. The schematics below which has been drawn in Qucs, can be found in &hellip; <a href=\"https:\/\/blog.the-leviathan.ch\/?p=1599\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">LibrePDK auto generator: Driver Circuit<\/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-1599","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\/1599","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=1599"}],"version-history":[{"count":4,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions"}],"predecessor-version":[{"id":1607,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions\/1607"}],"wp:attachment":[{"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-leviathan.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}