Initial release: 130,409 ngspice-simulated SPICE netlists on SKY130
Browse files- LICENSE +190 -0
- LICENSES/LICENSE-AnalogGym +28 -0
- LICENSES/LICENSE-AnalogToBi +35 -0
- LICENSES/LICENSE-OCB +21 -0
- NOTICE +83 -0
- README.md +537 -3
- batches.json +22 -0
- dataset_schema.md +308 -0
- default/failed-00000-of-00001.parquet +3 -0
- default/test-00000-of-00001.parquet +3 -0
- default/train-00000-of-00001.parquet +3 -0
- default/validation-00000-of-00001.parquet +3 -0
- example_simulate.py +177 -0
- splits.json +0 -0
- with_testbench/failed-00000-of-00001.parquet +3 -0
- with_testbench/test-00000-of-00001.parquet +3 -0
- with_testbench/train-00000-of-00001.parquet +3 -0
- with_testbench/validation-00000-of-00001.parquet +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for describing the origin of the Work and
|
| 141 |
+
reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may accept support,
|
| 167 |
+
obligations, or charges a fee for, acceptance of support, warranty,
|
| 168 |
+
indemnity, or other liability obligations and/or rights consistent
|
| 169 |
+
with this License. However, in accepting such obligations, You may
|
| 170 |
+
act only on Your own behalf and on Your sole responsibility, not on
|
| 171 |
+
behalf of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
Copyright 2026 Philip Pilgerstorfer
|
| 179 |
+
|
| 180 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 181 |
+
you may not use this file except in compliance with the License.
|
| 182 |
+
You may obtain a copy of the License at
|
| 183 |
+
|
| 184 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 185 |
+
|
| 186 |
+
Unless required by applicable law or agreed to in writing, software
|
| 187 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 188 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 189 |
+
See the License for the specific language governing permissions and
|
| 190 |
+
limitations under the License.
|
LICENSES/LICENSE-AnalogGym
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BSD 3-Clause License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024, CODA-Team
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
1. Redistributions of source code must retain the above copyright notice, this
|
| 9 |
+
list of conditions and the following disclaimer.
|
| 10 |
+
|
| 11 |
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
| 12 |
+
this list of conditions and the following disclaimer in the documentation
|
| 13 |
+
and/or other materials provided with the distribution.
|
| 14 |
+
|
| 15 |
+
3. Neither the name of the copyright holder nor the names of its
|
| 16 |
+
contributors may be used to endorse or promote products derived from
|
| 17 |
+
this software without specific prior written permission.
|
| 18 |
+
|
| 19 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 20 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 21 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 22 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 23 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 24 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 25 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 26 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 27 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 28 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
LICENSES/LICENSE-AnalogToBi
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The upstream repository at https://github.com/Seungmin0825/AnalogToBi
|
| 2 |
+
declares itself under the MIT License in its README.md:
|
| 3 |
+
|
| 4 |
+
> ## License
|
| 5 |
+
> This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
| 6 |
+
|
| 7 |
+
The repository itself does not ship a LICENSE file at the path it references
|
| 8 |
+
(observed as of commit HEAD on the `main` branch on 2026-04-20). The standard
|
| 9 |
+
MIT License text below is reproduced here to satisfy the "above copyright
|
| 10 |
+
notice and this permission notice shall be included" clause when redistributing
|
| 11 |
+
derivatives of the AnalogToBi netlists as part of this corpus.
|
| 12 |
+
|
| 13 |
+
----------------------------------------------------------------------
|
| 14 |
+
|
| 15 |
+
MIT License
|
| 16 |
+
|
| 17 |
+
Copyright (c) AnalogToBi authors (Seungmin Lee et al.)
|
| 18 |
+
|
| 19 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 20 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 21 |
+
in the Software without restriction, including without limitation the rights
|
| 22 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 23 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 24 |
+
furnished to do so, subject to the following conditions:
|
| 25 |
+
|
| 26 |
+
The above copyright notice and this permission notice shall be included in all
|
| 27 |
+
copies or substantial portions of the Software.
|
| 28 |
+
|
| 29 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 30 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 31 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 32 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 33 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 34 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 35 |
+
SOFTWARE.
|
LICENSES/LICENSE-OCB
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2023 zehao-dong
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
NOTICE
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Analog SPICE Circuits on SKY130
|
| 2 |
+
Copyright 2026 Philip Pilgerstorfer
|
| 3 |
+
|
| 4 |
+
This dataset is released under the Apache License, Version 2.0 (see LICENSE).
|
| 5 |
+
|
| 6 |
+
================================================================================
|
| 7 |
+
This dataset contains Derivative Works of three upstream corpora. Their
|
| 8 |
+
original licences are reproduced verbatim in the LICENSES/ directory and MUST
|
| 9 |
+
be included in any downstream redistribution of this dataset.
|
| 10 |
+
================================================================================
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
1. Open Circuit Benchmark (OCB) — Ckt-Bench-101 + Ckt-Bench-301
|
| 14 |
+
Upstream: https://github.com/zehao-dong/CktGNN
|
| 15 |
+
Paper: Z. Dong, W. Cao, M. Zhang, D. Tao, Y. Chen, X. Zhang.
|
| 16 |
+
"CktGNN: Circuit Graph Neural Network for Electronic Design
|
| 17 |
+
Automation." ICLR 2023.
|
| 18 |
+
Licence: MIT (see LICENSES/LICENSE-OCB)
|
| 19 |
+
Use in this dataset:
|
| 20 |
+
The 60,000 rows where `source_dataset == "ocb"` are derived from OCB's
|
| 21 |
+
behavioural opamp graphs. Each graph was remapped from its upstream
|
| 22 |
+
(gm, R, C) sub-circuit representation to a transistor-level SKY130
|
| 23 |
+
netlist via an equivalent-subcircuit library, then simulated in ngspice.
|
| 24 |
+
Circuit IDs preserve the upstream sub-benchmark partition:
|
| 25 |
+
ocb_sky130_101_* — 10,000 graphs (Ckt-Bench-101, diversity sample)
|
| 26 |
+
ocb_sky130_301_* — 50,000 graphs (Ckt-Bench-301, BO-curated)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
2. AnalogToBi
|
| 30 |
+
Upstream: https://github.com/Seungmin0825/AnalogToBi
|
| 31 |
+
Paper: Seungmin Lee et al. "AnalogToBi: Device-Level Analog Circuit
|
| 32 |
+
Topology Generation via Bipartite Graph and Grammar-Guided
|
| 33 |
+
Decoding."
|
| 34 |
+
Licence: MIT (declared in upstream README; see LICENSES/LICENSE-AnalogToBi
|
| 35 |
+
for the note on the missing upstream LICENSE file and the
|
| 36 |
+
reproduced standard MIT text)
|
| 37 |
+
Use in this dataset:
|
| 38 |
+
The 67,736 converged + 2,177 failed rows where
|
| 39 |
+
`source_dataset == "analogtobi"` are derived from AnalogToBi's 3,350
|
| 40 |
+
textbook + paper analog-circuit topologies. This includes a 1× default-
|
| 41 |
+
sizing baseline and a 20-point Latin-Hypercube sweep over W, L, Ibias,
|
| 42 |
+
and CL applied by our simulation pipeline before ngspice runs. Upstream
|
| 43 |
+
netlists ship in Cadence Spectre dialect; our pipeline converted them
|
| 44 |
+
to ngspice dialect.
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
3. AnalogGym
|
| 48 |
+
Upstream: https://github.com/CODA-Team/AnalogGym
|
| 49 |
+
Paper: CODA-Team. "AnalogGym: An Open and Practical Testing Suite for
|
| 50 |
+
Analog Circuit Synthesis." ICCAD 2024.
|
| 51 |
+
doi:10.1145/3676536.3697117
|
| 52 |
+
Licence: BSD 3-Clause (see LICENSES/LICENSE-AnalogGym)
|
| 53 |
+
Use in this dataset:
|
| 54 |
+
The 500 rows where `source_dataset == "analoggym"` are derived from
|
| 55 |
+
AnalogGym's 22 ngspice-ready SKY130 topologies (16 amplifiers + 1 LDO
|
| 56 |
+
+ 4 voltage references + 1 charge pump), each expanded by a 20-point
|
| 57 |
+
LHS sweep. The charge-pump sub-circuit is a structural homage of the
|
| 58 |
+
SMIC 130 nm PLL charge pump from the AnalogGym repo — model-name
|
| 59 |
+
tokens were remapped to SKY130 equivalents and layout-dependent
|
| 60 |
+
parameters were stripped.
|
| 61 |
+
Per the BSD 3-Clause no-endorsement clause: neither the names of
|
| 62 |
+
AnalogGym, CODA-Team, nor any of their contributors may be used to
|
| 63 |
+
endorse or promote products derived from this dataset without specific
|
| 64 |
+
prior written permission.
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
Third-party tools and data referenced but NOT redistributed
|
| 68 |
+
================================================================================
|
| 69 |
+
|
| 70 |
+
- SkyWater SKY130 PDK (Apache 2.0) — https://github.com/google/skywater-pdk.
|
| 71 |
+
The shipped netlists reference SKY130 `.lib` and `.model` names (e.g.
|
| 72 |
+
`sky130_fd_pr__nfet_01v8`) but do not embed any PDK model files.
|
| 73 |
+
Users wishing to re-simulate must install the PDK themselves (e.g.
|
| 74 |
+
via https://github.com/efabless/volare).
|
| 75 |
+
|
| 76 |
+
- ngspice — http://ngspice.sourceforge.net/. The simulator used to
|
| 77 |
+
produce every row's metrics. Not redistributed.
|
| 78 |
+
|
| 79 |
+
- AICircuit (Avestimehr Research Group, MIT licence) was evaluated for
|
| 80 |
+
inclusion and deliberately excluded from this release. Its labels are
|
| 81 |
+
produced by Cadence Spectre against a closed FreePDK45 kit and cannot
|
| 82 |
+
be reproduced with open-source tooling, so shipping its CSV metrics
|
| 83 |
+
would have introduced numbers no open pipeline can verify.
|
README.md
CHANGED
|
@@ -1,3 +1,537 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
task_categories:
|
| 6 |
+
- graph-ml
|
| 7 |
+
- tabular-regression
|
| 8 |
+
- tabular-classification
|
| 9 |
+
size_categories:
|
| 10 |
+
- 100K<n<1M
|
| 11 |
+
pretty_name: Analog SPICE Circuits on SKY130
|
| 12 |
+
tags:
|
| 13 |
+
- analog
|
| 14 |
+
- analog-ic
|
| 15 |
+
- spice
|
| 16 |
+
- spice-netlist
|
| 17 |
+
- ngspice
|
| 18 |
+
- sky130
|
| 19 |
+
- graph-neural-networks
|
| 20 |
+
- pyg
|
| 21 |
+
- netlist
|
| 22 |
+
- eda
|
| 23 |
+
source_datasets:
|
| 24 |
+
- zehao-dong/CktGNN
|
| 25 |
+
- Seungmin0825/AnalogToBi
|
| 26 |
+
- CODA-Team/AnalogGym
|
| 27 |
+
configs:
|
| 28 |
+
- config_name: default
|
| 29 |
+
data_files:
|
| 30 |
+
- split: train
|
| 31 |
+
path: default/train-*.parquet
|
| 32 |
+
- split: validation
|
| 33 |
+
path: default/validation-*.parquet
|
| 34 |
+
- split: test
|
| 35 |
+
path: default/test-*.parquet
|
| 36 |
+
- split: failed
|
| 37 |
+
path: default/failed-*.parquet
|
| 38 |
+
- config_name: with_testbench
|
| 39 |
+
data_files:
|
| 40 |
+
- split: train
|
| 41 |
+
path: with_testbench/train-*.parquet
|
| 42 |
+
- split: validation
|
| 43 |
+
path: with_testbench/validation-*.parquet
|
| 44 |
+
- split: test
|
| 45 |
+
path: with_testbench/test-*.parquet
|
| 46 |
+
- split: failed
|
| 47 |
+
path: with_testbench/failed-*.parquet
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
# Dataset Card for Analog SPICE Circuits on SKY130
|
| 51 |
+
|
| 52 |
+
**130,409 ngspice-simulated SPICE netlists on the open-source SkyWater SKY130 PDK**, unified from three upstream sources into a single HuggingFace-loadable schema with deterministic topology-aware train/validation/test splits. Designed as a supervised `(SPICE netlist → performance metrics)` corpus for training of models for analog circuit design.
|
| 53 |
+
|
| 54 |
+
**Fully open toolchain.** Analog-EDA datasets commonly require a commercial SPICE simulator and/or a closed foundry PDK to reproduce or extend — here, every row can be re-simulated with `ngspice` against SKY130 using only open-source tools. The `with_testbench` config ships the exact ngspice-ready SPICE on every row so `ngspice -b row.testbench_spice` bit-reproduces any shipped metric. See [Reproducibility](#reproducibility).
|
| 55 |
+
|
| 56 |
+
### Configs
|
| 57 |
+
|
| 58 |
+
| Config | Download size | Columns | Use when |
|
| 59 |
+
|---|---:|---|---|
|
| 60 |
+
| `default` | ~85 MB | `circuit_id`, `base_circuit_id`, `topology`, `source_dataset`, `pdk`, `sim_params`, `converged`, `error`, `metrics`, `netlist_json` | Training a GNN on shipped metrics. |
|
| 61 |
+
| `with_testbench` | ~125 MB | everything in `default` + `testbench_spice` | Re-simulating or verifying any row end-to-end with ngspice. |
|
| 62 |
+
|
| 63 |
+
Both configs share the same 4 splits (`train` / `validation` / `test` / `failed`) and the same `base_circuit_id → split` map (`splits.json`), so a model trained on `default/train` evaluates identically on `with_testbench/test`.
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from datasets import load_dataset
|
| 67 |
+
|
| 68 |
+
# Lean — for GNN training
|
| 69 |
+
ds = load_dataset("pphilip/analog-circuits-sky130", split="train")
|
| 70 |
+
|
| 71 |
+
# With runnable SPICE — for re-simulation / extension
|
| 72 |
+
ds = load_dataset("pphilip/analog-circuits-sky130", "with_testbench", split="train")
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Dataset Summary
|
| 76 |
+
|
| 77 |
+
Every row pairs a **transistor-level SPICE netlist** with the performance metrics measured from an **ngspice** simulation (DC operating point, AC response, transient). The **`netlist_json`** column carries a lossless typed-pin primitive that can be projected into three common GNN input shapes (bipartite / bus / node-centric) via the accompanying converter library. 50 topology families span op-amps, LDOs, bandgap references, switched-capacitor samplers, power converters, VCOs, mixers, LNAs, PAs, and more.
|
| 78 |
+
|
| 79 |
+
Splits are **topology-aware**: whole topology classes (or whole structural graphs, for OCB where everything is one class) are assigned to exactly one of train / validation / test, so held-out evaluation measures generalisation across unseen topologies, not just unseen parameter samples.
|
| 80 |
+
|
| 81 |
+
- **Total rows:** 130,409 (128,226 converged + 2,183 failed)
|
| 82 |
+
- **Topology families:** 49
|
| 83 |
+
- **Distinct structural graphs:** 63,354
|
| 84 |
+
- **Netlist dialect:** SPICE (ngspice dialect, `ngbehavior=hs`, HSPICE-compatible)
|
| 85 |
+
- **PDK:** SkyWater SKY130 (130 nm CMOS, 1.8 V, BSIM4 TT corner)
|
| 86 |
+
- **Simulator:** ngspice 46 with OSDI + KLU
|
| 87 |
+
- **Parameter sweeps:** 20-point Latin-Hypercube Samples over `(W_scale, L_scale, I_bias_scale, C_load)` on AnalogToBi + AnalogGym subsets; OCB is one-sample-per-graph (60K distinct graphs).
|
| 88 |
+
|
| 89 |
+
## Supported Tasks
|
| 90 |
+
|
| 91 |
+
Three primary task variants (see `dataset_schema.md` for code):
|
| 92 |
+
|
| 93 |
+
1. **netlist → metrics** — predict `dc_gain_dB`, `ugf_Hz`, `phase_margin_deg`, `power_W`, etc. from the graph + parameters. Regression. Primary benchmark for GNN architectures.
|
| 94 |
+
2. **metrics → topology** — classify the topology family or the specific structural graph from metric vectors. Classification (49 classes) or retrieval (63K graphs).
|
| 95 |
+
3. **metrics → sizing** — predict W/L/bias currents from target metrics + topology. Regression, conditioned on topology. Matches the FALCON/AICircuit inverse-design task shape.
|
| 96 |
+
|
| 97 |
+
The topology-aware splits make all three tasks measure generalisation rather than interpolation.
|
| 98 |
+
|
| 99 |
+
## Languages
|
| 100 |
+
|
| 101 |
+
SPICE netlists are programming-language artefacts (`code`), not natural language. Metric columns are numeric.
|
| 102 |
+
|
| 103 |
+
## Dataset Structure
|
| 104 |
+
|
| 105 |
+
### Splits
|
| 106 |
+
|
| 107 |
+
One unified dataset with four splits. Group-aware by `base_circuit_id` — every structural graph (and all its sweep siblings) is assigned to exactly one of train / validation / test, so held-out evaluation is fair across unseen circuits.
|
| 108 |
+
|
| 109 |
+
| Split | Rows | Groups (distinct graphs) | Description |
|
| 110 |
+
|---|---:|---:|---|
|
| 111 |
+
| `train` | 89,708 | 44,348 | Primary training set. |
|
| 112 |
+
| `validation` | 19,116 | 9,503 | Held-out. |
|
| 113 |
+
| `test` | 19,402 | 9,503 | Held-out. |
|
| 114 |
+
| `failed` | 2,183 | — | Simulation errors (non-convergence, timeouts, singular matrices). Same `netlist_json` as converged rows; `metrics` may be empty. Useful for failure-mode study. |
|
| 115 |
+
|
| 116 |
+
70/15/15 groupwise split with `seed=42`; the `splits.json` file in the repo maps `base_circuit_id → split` for reproducibility.
|
| 117 |
+
|
| 118 |
+
### Upstream-source breakdown
|
| 119 |
+
|
| 120 |
+
All four upstream corpora are pooled into the above splits. The **`source_dataset`** column tells you which upstream each row came from; **`sim_params.sweep`** (JSON) tells you whether the row is a default-sizing sample or a specific LHS point.
|
| 121 |
+
|
| 122 |
+
| `source_dataset` | Upstream | Distinct graphs | Families | Sweeps/graph | Converged | Failed |
|
| 123 |
+
|---|---|---:|---:|---:|---:|---:|
|
| 124 |
+
| `ocb` | CktGNN behavioural opamps remapped to SKY130 | 59,990 | 1 (all opamps) | 1.0 | 59,990 | 10 |
|
| 125 |
+
| `analogtobi` (1× + 20× LHS) | AnalogToBi textbook topologies | 3,263 | 48 | ~21 (1 default + 20 LHS) | 67,736 | 2,177 |
|
| 126 |
+
| `analoggym` | AnalogGym amps + LDO + VRef + charge pump, 20× LHS | 25 | 4 | 20.0 | 500 | 0 |
|
| 127 |
+
|
| 128 |
+
**Filtering by upstream:**
|
| 129 |
+
|
| 130 |
+
```python
|
| 131 |
+
from datasets import load_dataset
|
| 132 |
+
ds = load_dataset("pphilip/analog-circuits-sky130", split="train")
|
| 133 |
+
|
| 134 |
+
# All AnalogToBi rows
|
| 135 |
+
atb = ds.filter(lambda r: r["source_dataset"] == "analogtobi")
|
| 136 |
+
|
| 137 |
+
# Only LHS sweep rows (exclude default-sizing baseline)
|
| 138 |
+
import json
|
| 139 |
+
sweep_only = ds.filter(lambda r: json.loads(r["sim_params"]).get("sweep") is not None)
|
| 140 |
+
|
| 141 |
+
# One topology family
|
| 142 |
+
opamps = ds.filter(lambda r: r["topology"] == "operational_amplifier")
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
**Why pool everything under one config instead of per-source configs?** Because split membership depends on `base_circuit_id`, not on source. Separate configs would force consumers to manage their own global no-leakage rule across configs — error-prone. One pool + column filters keeps the fair-eval guarantee intact.
|
| 146 |
+
|
| 147 |
+
### Topology families
|
| 148 |
+
|
| 149 |
+
49 families across all sources, skewed toward opamp for structural reasons (OCB contributes 60K opamp graphs). The table below lists every family with its total converged sample count, the number of distinct structural graphs it covers, and which upstream sources include it. Filter with `ds.filter(lambda r: r["topology"] == "<family>")`.
|
| 150 |
+
|
| 151 |
+
| Family | Samples | Graphs | Sources |
|
| 152 |
+
|---|---:|---:|---|
|
| 153 |
+
| operational_amplifier | 70,595 | 60,496 | analoggym, analogtobi, ocb |
|
| 154 |
+
| switched_capacitor_sampler | 18,236 | 871 | analogtobi |
|
| 155 |
+
| ldo | 9,517 | 454 | analoggym, analogtobi |
|
| 156 |
+
| bandgap_reference | 7,101 | 343 | analoggym, analogtobi |
|
| 157 |
+
| power_converter | 5,498 | 269 | analogtobi |
|
| 158 |
+
| vco | 1,515 | 78 | analogtobi |
|
| 159 |
+
| current_mirror_bias | 1,428 | 68 | analogtobi |
|
| 160 |
+
| feedback | 966 | 46 | analogtobi |
|
| 161 |
+
| lna | 821 | 40 | analogtobi |
|
| 162 |
+
| frequency_response | 777 | 37 | analogtobi |
|
| 163 |
+
| high_perf_opamp | 767 | 37 | analogtobi |
|
| 164 |
+
| noise | 735 | 35 | analogtobi |
|
| 165 |
+
| mixer | 708 | 34 | analogtobi |
|
| 166 |
+
| switched_capacitor | 693 | 33 | analogtobi |
|
| 167 |
+
| oscillator | 651 | 39 | analogtobi |
|
| 168 |
+
| single_stage_amplifier | 546 | 26 | analogtobi |
|
| 169 |
+
| stability_compensation | 525 | 25 | analogtobi |
|
| 170 |
+
| cmos_amplifier | 525 | 25 | analogtobi |
|
| 171 |
+
| power_amplifier | 504 | 24 | analogtobi |
|
| 172 |
+
| frequency_synthesizer | 462 | 22 | analogtobi |
|
| 173 |
+
| differential_amplifier | 462 | 22 | analogtobi |
|
| 174 |
+
| continuous_time_filter | 437 | 21 | analogtobi |
|
| 175 |
+
| analog_subcircuit | 420 | 20 | analogtobi |
|
| 176 |
+
| current_mirror_amplifier | 378 | 18 | analogtobi |
|
| 177 |
+
| sample_hold | 357 | 17 | analogtobi |
|
| 178 |
+
| output_stage | 336 | 16 | analogtobi |
|
| 179 |
+
| transceiver | 315 | 15 | analogtobi |
|
| 180 |
+
| cmos_opamp | 315 | 15 | analogtobi |
|
| 181 |
+
| rf_basic | 252 | 12 | analogtobi |
|
| 182 |
+
| single_transistor_amplifier | 252 | 12 | analogtobi |
|
| 183 |
+
| nanometer_design | 252 | 12 | analogtobi |
|
| 184 |
+
| fully_differential_opamp | 252 | 12 | analogtobi |
|
| 185 |
+
| comparator | 236 | 24 | analogtobi |
|
| 186 |
+
| misc | 231 | 11 | analogtobi |
|
| 187 |
+
| voltage_regulator | 231 | 11 | analogtobi |
|
| 188 |
+
| unknown | 189 | 9 | analogtobi |
|
| 189 |
+
| nonlinearity_mismatch | 147 | 7 | analogtobi |
|
| 190 |
+
| nonlinear | 126 | 6 | analogtobi |
|
| 191 |
+
| adc | 71 | 4 | analogtobi |
|
| 192 |
+
| transconductance_amplifier | 63 | 3 | analogtobi |
|
| 193 |
+
| layout_packaging | 63 | 3 | analogtobi |
|
| 194 |
+
| dac | 63 | 3 | analogtobi |
|
| 195 |
+
| power | 42 | 2 | analogtobi |
|
| 196 |
+
| current_source | 42 | 2 | analogtobi |
|
| 197 |
+
| converter | 41 | 2 | analogtobi |
|
| 198 |
+
| cmos_processing | 21 | 1 | analogtobi |
|
| 199 |
+
| filter | 21 | 1 | analogtobi |
|
| 200 |
+
| fractional_n_synthesizer | 21 | 1 | analogtobi |
|
| 201 |
+
| charge_pump | 20 | 1 | analoggym |
|
| 202 |
+
|
| 203 |
+
**Observations:**
|
| 204 |
+
|
| 205 |
+
- **Opamps dominate by sample count** (70.5K / 128.6K = 55%) due to OCB's 60K-graph contribution, but only 4 of the 49 families appear in more than one upstream source (opamp, LDO, bandgap, charge-pump). The 45 other families are AnalogToBi-only.
|
| 206 |
+
- **Three families cross all three device-level sources**: `operational_amplifier`, `ldo`, `bandgap_reference`. These are the only families where a model can be trained on one upstream and tested on another.
|
| 207 |
+
- **Long tail** — 20 families have <500 samples. Useful for few-shot / meta-learning evaluation but small for end-to-end training in isolation.
|
| 208 |
+
- **`charge_pump`** is exclusive to `analoggym` and has only 20 samples (1 graph × 20 sweeps) — the most specialised class in the corpus.
|
| 209 |
+
|
| 210 |
+
### Data Instances
|
| 211 |
+
|
| 212 |
+
One row:
|
| 213 |
+
|
| 214 |
+
```json
|
| 215 |
+
{
|
| 216 |
+
"circuit_id": "analogtobi_0705_s003",
|
| 217 |
+
"base_circuit_id": "analogtobi_0705",
|
| 218 |
+
"topology": "operational_amplifier",
|
| 219 |
+
"source_dataset": "analogtobi",
|
| 220 |
+
"pdk": "sky130",
|
| 221 |
+
"sim_params": "{\"vdd\": 1.8, \"vth\": 0.5, \"vov\": 0.2, \"testbench\": \"OpampTestbench\", \"sweep\": {\"design\": {\"w_scale\": 1.34, \"l_scale\": 0.92}, \"test\": {\"ib_scale\": 0.67, \"cl_F\": 4.2e-12}}, ...}",
|
| 222 |
+
"converged": true,
|
| 223 |
+
"error": "",
|
| 224 |
+
"metrics": "{\"dc_gain_dB\": 38.2, \"ugf_Hz\": 1.25e6, \"phase_at_ugf_deg\": 52.3, \"power_W\": 0.00083, \"vout_dc_V\": 0.87, \"vdd_current_A\": 4.6e-4}",
|
| 225 |
+
"netlist_json": "{\"nets\":[{\"name\":\"VDD\",\"role\":\"supply_pos\",\"external\":true},...],\"devices\":[{\"name\":\"M1\",\"type\":\"nmos\",\"model\":\"nmos4\",\"pins\":[{\"role\":\"D\",\"net\":\"vout\"},{\"role\":\"G\",\"net\":\"vinn\"},{\"role\":\"S\",\"net\":\"tail\"},{\"role\":\"B\",\"net\":\"VSS\"}],\"params\":{}},...]}"
|
| 226 |
+
}
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
### Data Fields
|
| 230 |
+
|
| 231 |
+
| Column | Type | Description |
|
| 232 |
+
|---|---|---|
|
| 233 |
+
| `circuit_id` | string | Unique row id. Sweep siblings share a `base_circuit_id` prefix + `_sNNN` suffix. |
|
| 234 |
+
| `base_circuit_id` | string | Structural identity, shared across sweep siblings of one graph. |
|
| 235 |
+
| `topology` | string | Coarse topology family (one of 50). |
|
| 236 |
+
| `source_dataset` | string | `ocb`, `analogtobi`, or `analoggym`. |
|
| 237 |
+
| `pdk` | string | Always `sky130` in this release. |
|
| 238 |
+
| `sim_params` | string (JSON) | Full simulation parameters for reproducibility: PDK config (VDD, Vth, Vov, model_map), testbench class, convergence options, and sweep point `{design: {...}, test: {...}}`. |
|
| 239 |
+
| `converged` | bool | Whether the ngspice DC operating point + requested analyses completed. |
|
| 240 |
+
| `error` | string | Failure mode if `converged=false`: `no_convergence`, `singular_matrix`, `timeout`, `sim_error`, `no_output_port`. |
|
| 241 |
+
| `metrics` | string (JSON) | All output metrics for this row. Schema varies by testbench (op-amp vs LDO vs bandgap, etc.). |
|
| 242 |
+
| `netlist_json` | string (JSON) | Lossless typed-pin graph primitive — see "Graph Representation" below. |
|
| 243 |
+
|
| 244 |
+
### Data Splits
|
| 245 |
+
|
| 246 |
+
| Config | Train | Val | Test |
|
| 247 |
+
|---|---:|---:|---:|
|
| 248 |
+
| `ocb` | 41,994 | 8,998 | 8,998 |
|
| 249 |
+
| `analogtobi` | 3,001 | 95 | 128 |
|
| 250 |
+
| `analogtobi_sweep20` | 60,573 | 1,753 | 2,577 |
|
| 251 |
+
| `analoggym_sweep20` | 400 | 20 | 80 |
|
| 252 |
+
|
| 253 |
+
Splits are **group-aware**: for OCB, groups are `base_circuit_id` (so no sweep siblings cross the split boundary); for the rest, groups are `topology` labels (so whole families are held out at eval time).
|
| 254 |
+
|
| 255 |
+
### Graph Representation
|
| 256 |
+
|
| 257 |
+
Each row's `netlist_json` carries a canonical primitive that can be projected into any of the three common PyG shapes (bipartite / bus / node-centric) at load time — without re-parsing the SPICE text. Consumers parse the JSON string and build the representation they need; an example bus-style projection is shown in the "How to Use" section below.
|
| 258 |
+
|
| 259 |
+
Primitive schema (compact JSON stored per row):
|
| 260 |
+
|
| 261 |
+
```json
|
| 262 |
+
{
|
| 263 |
+
"nets": [
|
| 264 |
+
{"name": "VDD", "role": "supply_pos", "external": true},
|
| 265 |
+
{"name": "NET1", "role": "internal", "external": false}
|
| 266 |
+
],
|
| 267 |
+
"devices": [
|
| 268 |
+
{"name": "M1", "type": "nmos", "model": "nmos4",
|
| 269 |
+
"pins": [{"role": "D", "net": "NET1"}, {"role": "G", "net": "VIN"},
|
| 270 |
+
{"role": "S", "net": "VSS"}, {"role": "B", "net": "VSS"}],
|
| 271 |
+
"params": {"W": 10.0, "L": 0.5}}
|
| 272 |
+
]
|
| 273 |
+
}
|
| 274 |
+
```
|
| 275 |
+
|
| 276 |
+
Pin roles: MOSFET `D G S B`; BJT `C B E SUB`; 2-terminal `P N`. Device types: `nmos pmos npn pnp res cap ind isrc vsrc other`.
|
| 277 |
+
|
| 278 |
+
## Dataset Creation
|
| 279 |
+
|
| 280 |
+
### Curation Rationale
|
| 281 |
+
|
| 282 |
+
Open-source analog circuit design tooling has lacked a labelled benchmark corpus at the scale GNNs expect. Existing datasets are either topology-only (AnalogToBi: 3,350 textbook graphs, no sizing), Cadence-locked (AnalogGym PLL, AICircuit), or behavioural-only (OCB: 60K opamp graphs without transistor-level metrics). This dataset unifies three permissively-licensed upstream sources under a single open PDK (SKY130) and simulator (ngspice), so the entire pipeline — netlist → simulator → labels → graph representation — is reproducible from open source.
|
| 283 |
+
|
| 284 |
+
### Source Data
|
| 285 |
+
|
| 286 |
+
**OCB** (Open Circuit Benchmark, 60,000 graphs). Zehao Dong et al., "CktGNN: Circuit Graph Neural Network for Electronic Design Automation", ICLR 2023. Behavioural `(gm, R, C)` opamp subgraphs remapped to SKY130 transistor-level netlists using a library of equivalent sub-circuits. MIT License. The 60K graphs come from **two upstream sub-benchmarks** which this release keeps pooled under the `ocb` `source_dataset` value but remains distinguishable via the `circuit_id` prefix:
|
| 287 |
+
|
| 288 |
+
- **Ckt-Bench-101** (10,000 graphs, `circuit_id` like `ocb_sky130_101_*`) — the paper's diversity-focused sample; per the CktGNN authors' data-generation procedure, topologies here are drawn broadly across the opamp graph space without a performance prior.
|
| 289 |
+
- **Ckt-Bench-301** (50,000 graphs, `circuit_id` like `ocb_sky130_301_*`) — generated by a Bayesian-optimisation search in the CktGNN graph latent space. This is **not an i.i.d. sample**: graphs were selected because the BO thought they'd score high on the FoM metric, so the 301 subset is distribution-shifted toward high-performance opamps. Downstream models trained on it inherit that prior — useful if you want performance-focused training, a caveat if you want an unbiased opamp-graph distribution.
|
| 290 |
+
|
| 291 |
+
Filter with `circuit_id` prefix if you want just one:
|
| 292 |
+
|
| 293 |
+
```python
|
| 294 |
+
ds_101 = ds.filter(lambda r: r["circuit_id"].startswith("ocb_sky130_101_")) # 10K diverse
|
| 295 |
+
ds_301 = ds.filter(lambda r: r["circuit_id"].startswith("ocb_sky130_301_")) # 50K BO-curated
|
| 296 |
+
```
|
| 297 |
+
|
| 298 |
+
**AnalogToBi** (3,350 topologies, 49 families). Seungmin Lee et al. Textbook + paper analog circuits (Razavi, Camenzind, Carusone/Johns/Martin, Gray/Hurst/Lewis/Meyer, Allen/Holberg, RF Microelectronics, plus assorted papers). Topology-only — our pipeline supplies default sizing and a 20-LHS sweep per topology. MIT License.
|
| 299 |
+
|
| 300 |
+
**AnalogGym** (22 ngspice-ready topologies: 16 amplifiers + 1 LDO + 4 voltage references + 1 charge pump). CODA-Team, ICCAD 2024. Native SKY130 netlists with upstream sizing. Charge-pump is a structural homage — the upstream targets SMIC 130 nm devices at 3.3V, remapped here to SKY130 1.8V core devices; AnalogGym's published current-mismatch targets are not reproducible at this voltage. BSD 3-Clause.
|
| 301 |
+
|
| 302 |
+
**PDK.** SkyWater SKY130 (Apache 2.0), accessed via [volare](https://github.com/efabless/volare). Only `.lib` and `.model` references appear in the shipped netlists; no PDK model files are redistributed as part of this dataset.
|
| 303 |
+
|
| 304 |
+
### Simulation Pipeline
|
| 305 |
+
|
| 306 |
+
Every row was generated by the same deterministic pipeline:
|
| 307 |
+
|
| 308 |
+
1. **Parse** upstream netlists via per-source readers — one reader per source handles Spectre→ngspice dialect conversion, model-name remapping (proprietary PDK tokens → SKY130 equivalents), and the ingest of AnalogGym's Markdown-inlined voltage-reference netlists.
|
| 309 |
+
2. **Emit testbench** per topology type: op-amp AC, LDO AC-on-VDD, bandgap DC+temp-sweep, comparator transient, VCO transient, mixer AC+LO, PA AC+50Ω.
|
| 310 |
+
3. **Bias inference** via graph-distance BFS + Vth/Vov formulas, plus self-biasing current mirrors for gate-only bias ports (follows AnalogToBi Appendix G).
|
| 311 |
+
4. **Apply 20-point LHS sweep** over `(W_scale ∈ [0.3,3.0], L_scale ∈ [0.7,1.5], I_bias_scale ∈ [0.3,3.0], C_load ∈ [10fF,100pF])` with a post-sweep `W_MAX = 500µm` clamp to stay inside BSIM4 bin coverage.
|
| 312 |
+
5. **Run ngspice 46** with per-PDK convergence options (`gmin=1e-10`, `gminsteps=10` for SKY130) and a 60-second per-sim timeout.
|
| 313 |
+
6. **Extract metrics** from `.measure` statements + control-block prints.
|
| 314 |
+
7. **Merge** per-batch outputs globally with group-aware splits (`base_circuit_id`, seed 42) applied once across all sources.
|
| 315 |
+
|
| 316 |
+
The `sim_params` column on every row captures the full reproducibility-relevant configuration (PDK tokens, testbench class, convergence options, sweep point); `netlist_json` captures the exact transistor-level graph that went into ngspice. Together with the upstream raw data, these are sufficient to reproduce any row with the open-source toolchain listed above.
|
| 317 |
+
|
| 318 |
+
### Personal and Sensitive Information
|
| 319 |
+
|
| 320 |
+
None. The dataset contains circuit netlists and their simulated electrical metrics; no personal data, no text generated by humans beyond device/net naming conventions.
|
| 321 |
+
|
| 322 |
+
## Considerations for Using the Data
|
| 323 |
+
|
| 324 |
+
### Social Impact
|
| 325 |
+
|
| 326 |
+
Open analog design tooling is a long-standing gap in EDA. A labelled benchmark at this scale enables researchers without Cadence licences to develop and evaluate analog-domain GNNs, lowering the barrier to entry for analog circuit ML. We expect primary uptake in academic circuit-design labs and hobbyist/open-source hardware communities.
|
| 327 |
+
|
| 328 |
+
### Discussion of Biases
|
| 329 |
+
|
| 330 |
+
- **Opamp over-representation.** After rebalancing with 20× sweeps, op-amps still account for ~55% of rows due to OCB's 60K-graph contribution. Training a `(graph, metrics)` model without stratified sampling will bias the encoder toward opamp features. The long tail of 48 non-opamp families averages ~1,200 rows each — enough for within-family `metrics → sizing` work but small for transfer-learning claims.
|
| 331 |
+
- **OCB-301 is BO-curated, not random.** 50K of the 60K OCB rows come from Ckt-Bench-301, which the original CktGNN authors generated via Bayesian optimisation in the graph latent space. That sub-corpus is distribution-shifted toward high-FoM opamps; 301 is not an unbiased sample of the opamp graph space. Ckt-Bench-101 (10K rows, `ocb_sky130_101_*`) is the upstream's diversity-focused sample and is closer to uniform. Train on `ocb` indiscriminately and the opamp encoder inherits the 301 prior. Filter by the `circuit_id` prefix if you want to remove that bias.
|
| 332 |
+
- **Default-sizing artefacts.** AnalogToBi ships topology-only; our pipeline supplies uniform default W = 10 µm, L = 0.5 µm on the 1× baseline rows. Circuits where performance depends on heterogeneous sizing (cascode headroom, compensation-cap tuning) are under-represented at their intended operating points. Use the 20× LHS sweep rows (the majority of AnalogToBi rows) for downstream work that needs realistic sizings.
|
| 333 |
+
- **Testbench-topology mismatch for non-amplifier circuits.** Many non-opamp topologies (switched-capacitor samplers, filters, mixers, LNAs, sample-hold, etc.) are simulated with the op-amp AC testbench — the only testbench type applied to most AnalogToBi families in this release. Their `metrics` reflect the AC response of the circuit, which is a real physical quantity but often not the metric a circuit engineer would quote for that topology (e.g., SC samplers don't have a meaningful small-signal gain). The concrete symptom: **~22% of converged rows have `|dc_gain_dB| < 0.1`**, dominated by OCB opamps (19K rows with degenerate structure after behavioural→transistor remap) and AnalogToBi SC samplers (5.6K rows). Treat these as testbench-AC measurements, not as the topology's canonical performance metric.
|
| 334 |
+
- **Family-specific `metrics` keys.** Not every row carries `dc_gain_dB`. 7.6% of converged rows instead emit testbench-appropriate metrics: bandgaps give `vout_27 / vout_m40 / vout_125` (temperature sweep), VCOs give `osc_freq_Hz`, comparators and the charge-pump give `prop_delay_s`. See `dataset_schema.md` for the full per-testbench metric catalogue.
|
| 335 |
+
- **Single-PDK.** Everything is SKY130 1.8V. Models trained here should not be assumed to transfer to other process nodes without explicit retraining.
|
| 336 |
+
- **Convergence bias.** The 2,187 failed rows are preserved in the `failed` split, not silently dropped. Rows there carry the same `netlist_json` as converged rows but empty `metrics`, letting consumers study the boundary between convergent and divergent circuits.
|
| 337 |
+
|
| 338 |
+
### Other Known Limitations
|
| 339 |
+
|
| 340 |
+
- `sim_params.sweep.design.w_scale` and `l_scale` are applied uniformly across every MOSFET. Real circuit design varies W and L per-transistor; our sweep is a global perturbation, not a fine-grained sizing exploration.
|
| 341 |
+
- AnalogGym's 4 voltage-reference circuits come with redacted-PDK netlists; our pipeline strips layout-dependent parameters (`sd`, `ad`, `ps`, etc.) and remaps SMIC/proprietary model-name tokens to SKY130. The graph structure is intact; absolute metric values reflect SKY130, not the upstream process.
|
| 342 |
+
- The `.spice` netlist column is not included in this release (too large for Hub storage). Derive it from `netlist_json` via the repository's converter if needed, or re-run the pipeline from the upstream raw data.
|
| 343 |
+
|
| 344 |
+
## Additional Information
|
| 345 |
+
|
| 346 |
+
### Dataset Curators
|
| 347 |
+
|
| 348 |
+
Philip Pilgerstorfer (`pphilip` on hf).
|
| 349 |
+
|
| 350 |
+
### Licensing Information
|
| 351 |
+
|
| 352 |
+
This dataset is released under the **Apache License 2.0** (`LICENSE`). Upstream source-dataset licences are included in `LICENSES/` and must be carried forward by any downstream redistribution:
|
| 353 |
+
|
| 354 |
+
- `LICENSES/LICENSE-OCB`: MIT (CktGNN authors, Washington University in St. Louis)
|
| 355 |
+
- `LICENSES/LICENSE-AnalogToBi`: MIT (Seungmin Lee et al.)
|
| 356 |
+
- `LICENSES/LICENSE-AnalogGym`: BSD 3-Clause (CODA-Team)
|
| 357 |
+
|
| 358 |
+
### Citation Information
|
| 359 |
+
|
| 360 |
+
If you use this dataset, please cite it and all upstream sources:
|
| 361 |
+
|
| 362 |
+
```bibtex
|
| 363 |
+
@dataset{pilgerstorfer_analog_circuits_sky130,
|
| 364 |
+
title = {{Analog SPICE Circuits on SKY130}},
|
| 365 |
+
author = {Pilgerstorfer, Philip},
|
| 366 |
+
year = 2026,
|
| 367 |
+
publisher = {Hugging Face},
|
| 368 |
+
url = {https://huggingface.co/datasets/pphilip/analog-circuits-sky130}
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
@inproceedings{dong2023cktgnn,
|
| 372 |
+
title = {{CktGNN}: Circuit Graph Neural Network for Electronic Design Automation},
|
| 373 |
+
author = {Dong, Zehao and Cao, Weidong and Zhang, Muhan and Tao, Dacheng and Chen, Yixin and Zhang, Xuan},
|
| 374 |
+
booktitle = {International Conference on Learning Representations (ICLR)},
|
| 375 |
+
year = 2023
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
@misc{lee_analogtobi,
|
| 379 |
+
title = {{AnalogToBi}: A Dataset of Analog Circuit Schematics},
|
| 380 |
+
author = {Lee, Seungmin and others},
|
| 381 |
+
howpublished = {\url{https://github.com/Seungmin0825/AnalogToBi}},
|
| 382 |
+
note = {MIT License}
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
@inproceedings{coda2024analoggym,
|
| 386 |
+
title = {{AnalogGym}: An Open and Practical Testing Suite for Analog Circuit Synthesis},
|
| 387 |
+
author = {{CODA-Team}},
|
| 388 |
+
booktitle = {International Conference on Computer-Aided Design (ICCAD)},
|
| 389 |
+
year = 2024,
|
| 390 |
+
doi = {10.1145/3676536.3697117}
|
| 391 |
+
}
|
| 392 |
+
```
|
| 393 |
+
|
| 394 |
+
### Contributions
|
| 395 |
+
|
| 396 |
+
Thanks to the CktGNN, AnalogToBi, and AnalogGym teams for making their upstream corpora available under permissive licenses. Thanks to the SkyWater + Google + efabless teams for the SKY130 open PDK and the ngspice team for the open-source simulator.
|
| 397 |
+
|
| 398 |
+
## Reproducibility
|
| 399 |
+
|
| 400 |
+
The **`with_testbench`** config ships the exact ngspice-ready SPICE that produced every row's `metrics`. Reproducing any shipped number is three steps:
|
| 401 |
+
|
| 402 |
+
1. Load the row — `row["testbench_spice"]` is a self-contained SPICE deck.
|
| 403 |
+
2. Substitute `{{SKY130_LIB}}` with your local SKY130 combined/continuous `.lib` path (portability placeholder — the only environment-specific token in the deck).
|
| 404 |
+
3. Run `ngspice -b <spice>` and parse `.meas` output.
|
| 405 |
+
|
| 406 |
+
The `example_simulate.py` file in this repo does exactly those three steps:
|
| 407 |
+
|
| 408 |
+
```bash
|
| 409 |
+
# One-time setup
|
| 410 |
+
pip install datasets volare
|
| 411 |
+
volare fetch --pdk sky130
|
| 412 |
+
export SKY130_LIB="$(volare show sky130)/sky130A/libs.tech/combined/continuous/sky130.lib.spice"
|
| 413 |
+
# Install ngspice 46+ via your package manager or from source
|
| 414 |
+
|
| 415 |
+
# Reproduce the first converged row of the train split
|
| 416 |
+
python example_simulate.py
|
| 417 |
+
|
| 418 |
+
# Reproduce a specific circuit
|
| 419 |
+
python example_simulate.py --circuit-id analoggym_amp_leung_nmcf_pin_3_s000
|
| 420 |
+
|
| 421 |
+
# Inspect the reconstructed SPICE without running
|
| 422 |
+
python example_simulate.py --print-spice
|
| 423 |
+
```
|
| 424 |
+
|
| 425 |
+
Expected output (bit-exact match to four decimal places):
|
| 426 |
+
|
| 427 |
+
```
|
| 428 |
+
circuit_id: analoggym_amp_alfio_raffc_pin_3_s000
|
| 429 |
+
topology: operational_amplifier (source: analoggym)
|
| 430 |
+
shipped metric: dc_gain_dB = -30.741 dB
|
| 431 |
+
|
| 432 |
+
Running ngspice…
|
| 433 |
+
reproduced: dc_gain_dB = -30.741 dB
|
| 434 |
+
delta: 0.000000 dB ✓ bit-exact
|
| 435 |
+
```
|
| 436 |
+
|
| 437 |
+
### Extending the corpus
|
| 438 |
+
|
| 439 |
+
Every row is a starting point for new samples. You can:
|
| 440 |
+
|
| 441 |
+
- **Perturb a sweep point.** Edit `sim_params.sweep.design.w_scale` / `l_scale` / `sweep.test.ib_scale` / `cl_F`, rescale the corresponding values in `testbench_spice` (a simple regex on `W=` / `L=` / DC-source values), and run ngspice.
|
| 442 |
+
- **Rewire the DUT.** `netlist_json` is the lossless graph representation: add a device, change a pin's net, and regenerate the SPICE lines. The `with_testbench` column shows you the full deck format your emission needs to match.
|
| 443 |
+
- **Swap the testbench.** Replace the analysis block in `testbench_spice` (the lines after `* --- DUT ---`) with `.tran`, `.noise`, or whatever ngspice analysis you need — the DUT section is already correct.
|
| 444 |
+
|
| 445 |
+
None of these extensions require a commercial simulator or PDK.
|
| 446 |
+
|
| 447 |
+
## How to Use
|
| 448 |
+
|
| 449 |
+
### Load the dataset
|
| 450 |
+
|
| 451 |
+
```python
|
| 452 |
+
from datasets import load_dataset
|
| 453 |
+
ds = load_dataset("pphilip/analog-circuits-sky130", split="train")
|
| 454 |
+
# also available: "validation", "test", "failed"
|
| 455 |
+
```
|
| 456 |
+
|
| 457 |
+
### Iterate rows and pull metrics
|
| 458 |
+
|
| 459 |
+
```python
|
| 460 |
+
import json
|
| 461 |
+
row = ds[0]
|
| 462 |
+
metrics = json.loads(row["metrics"])
|
| 463 |
+
print(f"{row['circuit_id']}: gain = {metrics['dc_gain_dB']:.1f} dB, UGF = {metrics['ugf_Hz']:.2e} Hz")
|
| 464 |
+
```
|
| 465 |
+
|
| 466 |
+
### Filter to a specific upstream, family, or sweep axis
|
| 467 |
+
|
| 468 |
+
```python
|
| 469 |
+
# AnalogToBi circuits only
|
| 470 |
+
atb = ds.filter(lambda r: r["source_dataset"] == "analogtobi")
|
| 471 |
+
|
| 472 |
+
# Only AnalogGym charge pumps
|
| 473 |
+
cp = ds.filter(lambda r: r["topology"] == "charge_pump")
|
| 474 |
+
|
| 475 |
+
# Only LHS sweep samples (exclude AnalogToBi default-sizing 1× baseline)
|
| 476 |
+
sweep = ds.filter(lambda r: json.loads(r["sim_params"]).get("sweep") is not None)
|
| 477 |
+
```
|
| 478 |
+
|
| 479 |
+
### Build a PyG graph from `netlist_json`
|
| 480 |
+
|
| 481 |
+
`netlist_json` is a self-contained JSON string — no pipeline library required. The example below builds a bus-style graph (nets as nodes, devices as edges — FALCON's `graph.json` shape). See `dataset_schema.md` for the full primitive schema and the bipartite / node-centric alternatives.
|
| 482 |
+
|
| 483 |
+
```python
|
| 484 |
+
import json
|
| 485 |
+
import torch
|
| 486 |
+
from torch_geometric.data import Data
|
| 487 |
+
|
| 488 |
+
def to_bus(netlist_json: str) -> Data:
|
| 489 |
+
"""Project the row's netlist_json primitive into a bus graph (nets as nodes, devices as edges).
|
| 490 |
+
|
| 491 |
+
Every device becomes K*(K-1)/2 parallel edges (all pin-pairs), so a 4-terminal
|
| 492 |
+
MOSFET adds 6 edges with a shared `device_id` group tag.
|
| 493 |
+
"""
|
| 494 |
+
from itertools import combinations
|
| 495 |
+
p = json.loads(netlist_json)
|
| 496 |
+
net_idx = {n["name"]: i for i, n in enumerate(p["nets"])}
|
| 497 |
+
|
| 498 |
+
src, dst, dev_id, dev_type = [], [], [], []
|
| 499 |
+
type_vocab = {t: i for i, t in enumerate(
|
| 500 |
+
["nmos","pmos","npn","pnp","res","cap","ind","isrc","vsrc","other"]
|
| 501 |
+
)}
|
| 502 |
+
for i, d in enumerate(p["devices"]):
|
| 503 |
+
pins = d["pins"]
|
| 504 |
+
for a, b in combinations(range(len(pins)), 2):
|
| 505 |
+
na, nb = net_idx[pins[a]["net"]], net_idx[pins[b]["net"]]
|
| 506 |
+
for (s, t) in ((na, nb), (nb, na)): # both directions
|
| 507 |
+
src.append(s); dst.append(t)
|
| 508 |
+
dev_id.append(i)
|
| 509 |
+
dev_type.append(type_vocab.get(d["type"], type_vocab["other"]))
|
| 510 |
+
|
| 511 |
+
return Data(
|
| 512 |
+
edge_index=torch.tensor([src, dst], dtype=torch.long),
|
| 513 |
+
edge_attr=torch.tensor(dev_type, dtype=torch.long).unsqueeze(1),
|
| 514 |
+
num_nodes=len(p["nets"]),
|
| 515 |
+
)
|
| 516 |
+
|
| 517 |
+
graph = to_bus(ds[0]["netlist_json"])
|
| 518 |
+
```
|
| 519 |
+
|
| 520 |
+
### Group-aware split reproducibility
|
| 521 |
+
|
| 522 |
+
Split assignment is keyed by `base_circuit_id` with `seed=42`. The dataset's `splits.json` maps every group to its split, so you can reconstruct the exact train/val/test partition locally without re-running a splitter:
|
| 523 |
+
|
| 524 |
+
```python
|
| 525 |
+
import json, urllib.request
|
| 526 |
+
with urllib.request.urlopen(
|
| 527 |
+
"https://huggingface.co/datasets/pphilip/analog-circuits-sky130/resolve/main/splits.json"
|
| 528 |
+
) as f:
|
| 529 |
+
splits = json.load(f)
|
| 530 |
+
# splits["<base_circuit_id>"] == "train" / "validation" / "test"
|
| 531 |
+
```
|
| 532 |
+
|
| 533 |
+
## Release notes — 2026-04-21
|
| 534 |
+
|
| 535 |
+
- **130,409 rows** across **49 topology families**, SKY130 only. Available in a lean `default` config and a reproducibility-focused `with_testbench` config, each with `train` / `validation` / `test` / `failed` splits.
|
| 536 |
+
- Group-aware split by `base_circuit_id` (seed=42) — every structural graph and all its sweep siblings land in exactly one split, no leakage.
|
| 537 |
+
- Primitive `netlist_json` column on every row — a lossless typed-pin JSON description of the circuit graph that can be projected into bipartite / bus / node-centric PyG shapes at load time (example in § How to Use).
|
batches.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n_groups": 63354,
|
| 3 |
+
"n_rows": {
|
| 4 |
+
"failed": 2183,
|
| 5 |
+
"test": 19402,
|
| 6 |
+
"train": 89708,
|
| 7 |
+
"validation": 19116
|
| 8 |
+
},
|
| 9 |
+
"n_rows_total": 130409,
|
| 10 |
+
"seed": 42,
|
| 11 |
+
"source_counts": {
|
| 12 |
+
"_dropped_no_testbench": 4,
|
| 13 |
+
"_excluded_topologies": 399,
|
| 14 |
+
"analoggym/performance_v2": 500,
|
| 15 |
+
"analogtobi/performance_sweep20_v2": 66582,
|
| 16 |
+
"analogtobi/performance_v2": 3331,
|
| 17 |
+
"ocb/performance_v2": 60000
|
| 18 |
+
},
|
| 19 |
+
"split_by": "base_circuit_id",
|
| 20 |
+
"test_ratio": 0.15,
|
| 21 |
+
"validation_ratio": 0.15
|
| 22 |
+
}
|
dataset_schema.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dataset Schema
|
| 2 |
+
|
| 3 |
+
Per-row reference for `pphilip/analog-circuits-sky130`. Companion document to the dataset card.
|
| 4 |
+
|
| 5 |
+
Three of the columns are JSON strings carrying nested structure (`sim_params`, `metrics`, `netlist_json`). This document freezes the key names and semantics within those strings so consumers can parse them with confidence.
|
| 6 |
+
|
| 7 |
+
## Arrow schema
|
| 8 |
+
|
| 9 |
+
Every row, every split, every source:
|
| 10 |
+
|
| 11 |
+
| Column | Type | Description |
|
| 12 |
+
|---|---|-------------------------------------------------------------------------------------------------|
|
| 13 |
+
| `circuit_id` | `string` | Unique row id. Sweep siblings share a `base_circuit_id` prefix + `_sNNN` suffix. |
|
| 14 |
+
| `base_circuit_id` | `string` | Structural identity — sweep siblings of one graph share this value. Used as the split-group key. |
|
| 15 |
+
| `topology` | `string` | Topology family label (one of 49 — see vocabulary below). |
|
| 16 |
+
| `source_dataset` | `string` | `"ocb"` / `"analogtobi"` / `"analoggym"`. |
|
| 17 |
+
| `pdk` | `string` | `"sky130"` in current release |
|
| 18 |
+
| `sim_params` | `string` (JSON) | Simulation configuration + sweep point. See § sim_params. |
|
| 19 |
+
| `converged` | `bool` | `true` if ngspice reached a valid operating point and the requested analyses completed. |
|
| 20 |
+
| `error` | `string` | Empty `""` on converged rows; one of 7 vocabulary strings otherwise. See § error vocabulary. |
|
| 21 |
+
| `metrics` | `string` (JSON) | Testbench-type-specific measurements. See § metrics. |
|
| 22 |
+
| `netlist_json` | `string` (JSON) | Lossless typed-pin graph primitive. See § netlist_json. |
|
| 23 |
+
| `testbench_spice` | `string` (SPICE) | **Only present in the `with_testbench` config.** The exact ngspice-ready testbench that produced `metrics`. Contains a `{{SKY130_LIB}}` placeholder that consumers substitute with their local PDK `.lib` path before running ngspice. See § testbench_spice. |
|
| 24 |
+
|
| 25 |
+
**Stability intent:** column additions across releases will be append-only so existing consumers don't break silently. Any column rename or removal would be flagged prominently in the release notes.
|
| 26 |
+
|
| 27 |
+
## Topology vocabulary (49 families)
|
| 28 |
+
|
| 29 |
+
Every row's `topology` value comes from a fixed set of 49 strings in this release. Full list + sample counts + upstream sources is in the dataset card's "Topology families" table.
|
| 30 |
+
|
| 31 |
+
## `sim_params` (JSON string)
|
| 32 |
+
|
| 33 |
+
Captures everything needed to re-run the exact same simulation. Parsed as:
|
| 34 |
+
|
| 35 |
+
```json
|
| 36 |
+
{
|
| 37 |
+
"vdd": 1.8,
|
| 38 |
+
"vth": 0.5,
|
| 39 |
+
"vov": 0.2,
|
| 40 |
+
"kp_n": 2e-4,
|
| 41 |
+
"kp_p": 8e-5,
|
| 42 |
+
"default_l": 0.5,
|
| 43 |
+
"model_map": {
|
| 44 |
+
"nmos4": "sky130_fd_pr__nfet_01v8",
|
| 45 |
+
"pmos4": "sky130_fd_pr__pfet_01v8",
|
| 46 |
+
"npn": "sky130_fd_pr__npn_05v5_W1p00L1p00",
|
| 47 |
+
"pnp": "sky130_fd_pr__pnp_05v5_W3p40L3p40"
|
| 48 |
+
},
|
| 49 |
+
"testbench": "OpampTestbench",
|
| 50 |
+
"convergence_opts": {},
|
| 51 |
+
"sweep": {
|
| 52 |
+
"design": {"w_scale": 1.34, "l_scale": 0.92},
|
| 53 |
+
"test": {"ib_scale": 0.67, "cl_F": 4.2e-12}
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
| Key | Type | Meaning |
|
| 59 |
+
|---|---|---|
|
| 60 |
+
| `vdd` | float | Supply voltage used for this sim (V). |
|
| 61 |
+
| `vth` | float | Nominal MOSFET threshold voltage (V). Used by the bias-inference heuristic. |
|
| 62 |
+
| `vov` | float | Nominal gate overdrive voltage (V). |
|
| 63 |
+
| `kp_n`, `kp_p` | float | Nominal NMOS / PMOS transconductance parameter (A/V²). |
|
| 64 |
+
| `default_l` | float | Default channel length applied when the DUT builder has no better info (µm). |
|
| 65 |
+
| `model_map` | dict[str,str] | Mapping from abstract device-type token → PDK-specific subcircuit name. Captures which SKY130 model bin each MOSFET/BJT uses. |
|
| 66 |
+
| `testbench` | str | One of: `OpampTestbench`, `LdoTestbench`, `BandgapTestbench`, `ComparatorTestbench`, `VcoTestbench`, `MixerTestbench`, `PaTestbench`. Determines which metric keys appear in `metrics`. |
|
| 67 |
+
| `convergence_opts` | dict | Per-PDK `.option` directives (gmin, gminsteps) appended to the testbench header. Empty for SKY130 in this release. |
|
| 68 |
+
| `sweep` | dict or null | Null for 1× default-sizing rows (OCB and AnalogToBi baseline); populated for LHS sweep points. |
|
| 69 |
+
| `sweep.design.w_scale` | float | Multiplicative factor applied to every MOSFET W. Log-uniform over [0.3, 3.0], post-clamped to W_MAX = 500 µm. |
|
| 70 |
+
| `sweep.design.l_scale` | float | Multiplicative factor applied to every MOSFET L. Log-uniform over [0.7, 1.5]. |
|
| 71 |
+
| `sweep.test.ib_scale` | float | Scale applied to external `I__*` bias sources. Log-uniform over [0.3, 3.0]. |
|
| 72 |
+
| `sweep.test.cl_F` | float | Absolute load capacitance (F). Log-uniform over [1e-14, 1e-10]. |
|
| 73 |
+
|
| 74 |
+
**Design / test axis split** (inspired by FALCON's contribution gap): `sweep.design` modifies the DUT itself (wing geometry); `sweep.test` modifies the testbench harness (airspeed). Consumers can project the 4-D LHS down to design-only or operating-condition-only as needed.
|
| 75 |
+
|
| 76 |
+
## `metrics` (JSON string)
|
| 77 |
+
|
| 78 |
+
Keys depend on the testbench (`sim_params.testbench`) because different analyses emit different output signals. `dc_gain_dB` only appears on AC-based testbenches; time-domain ones emit `vout_min_V` / `vout_max_V` / `t_*_s` instead.
|
| 79 |
+
|
| 80 |
+
### Key catalogue per testbench
|
| 81 |
+
|
| 82 |
+
| Testbench | Always-present keys | Conditional keys | Sample rows |
|
| 83 |
+
|---|---|---|---|
|
| 84 |
+
| `OpampTestbench` | `dc_gain_dB`, `vdd_current_A`, `power_W` | `vout_dc_V` (98.6%), `ugf_Hz` (27.4%), `phase_at_ugf_deg` (27.4%) | 107,672 |
|
| 85 |
+
| `LdoTestbench` | `vdd_current_A`, `power_W` | `dc_gain_dB` (99.1%), `vout_dc_V` (98.1%), `ugf_Hz` (1.3%) | 9,748 |
|
| 86 |
+
| `BandgapTestbench` | `vdd_current_A`, `power_W` | `vout_dc_V` (96.7%) | 7,101 |
|
| 87 |
+
| `VcoTestbench` | `vout_min_V`, `vout_max_V` | `vdd_current_A` (93%), `power_W` (93%), `vout_dc_V` (53%), `osc_freq_Hz` (1.8%), `t_rise1_s`, `t_rise2_s` | 2,166 |
|
| 88 |
+
| `MixerTestbench` | `dc_gain_dB` | `vdd_current_A` (97%), `power_W` (97%), `vout_dc_V` (47%) | 708 |
|
| 89 |
+
| `PaTestbench` | `dc_gain_dB`, `vdd_current_A`, `power_W` | `vout_dc_V` (67%), `ugf_Hz` (4.2%) | 504 |
|
| 90 |
+
| `ComparatorTestbench` | `vout_min_V`, `vout_max_V`, `vdd_current_A`, `power_W` | `vout_dc_V` (85%), `t_out_cross_s` (6%) | 327 |
|
| 91 |
+
|
| 92 |
+
Conditional-key percentages are measured against converged rows in this release.
|
| 93 |
+
|
| 94 |
+
### Key semantics
|
| 95 |
+
|
| 96 |
+
| Key | Unit | Meaning |
|
| 97 |
+
|---|---|---|
|
| 98 |
+
| `dc_gain_dB` | dB | Small-signal AC gain at 1 Hz. For `LdoTestbench`, this is `vdb(vout)` with `VDD AC 1` — functionally the negated PSRR (conventionally reported as the absolute value). |
|
| 99 |
+
| `ugf_Hz` | Hz | Unity-gain frequency — lowest frequency at which `vdb(vout) = 0`. NaN-equivalent (key absent) if the AC sweep never crosses 0 dB. |
|
| 100 |
+
| `phase_at_ugf_deg` | degrees | Phase margin proxy — phase of the AC response at `ugf_Hz`. |
|
| 101 |
+
| `vout_dc_V` | V | Output node DC level from the `.op` solve. |
|
| 102 |
+
| `vout_min_V`, `vout_max_V` | V | Transient output extremes over the simulated window. Used by time-domain testbenches (VCO, comparator) to detect oscillation amplitude / switching range. |
|
| 103 |
+
| `vdd_current_A` | A | Current into `VDD` at the DC operating point. Sign convention: negative = sourcing (VDD → circuit → GND), which is the typical case. |
|
| 104 |
+
| `power_W` | W | `abs(vdd_current_A) * vdd`. |
|
| 105 |
+
| `osc_freq_Hz` | Hz | Detected oscillation frequency (VCO, oscillator). Present only when the transient produced a stable oscillation — rare at default sizing (1.8% of VCO rows). |
|
| 106 |
+
| `t_rise1_s`, `t_rise2_s`, `t_out_cross_s` | s | Transient timestamp markers for switching measurements (comparator, VCO first/second zero-crossing). |
|
| 107 |
+
|
| 108 |
+
### ⚠️ Known caveats on `metrics` semantics
|
| 109 |
+
|
| 110 |
+
1. **Testbench-topology mismatch for non-amplifier circuits.** Most non-op-amp topologies are simulated with `OpampTestbench` (the only shipped AC testbench that fits a 2-input / 1-output pattern). Their `dc_gain_dB` is the literal small-signal AC response of the circuit, which is a real physical number, but often not the canonical metric a designer would cite for that topology. Concrete symptom: **~22% of converged rows have `|dc_gain_dB| < 0.1`**, dominated by OCB opamps with degenerate behavioural→transistor remaps (19K rows) and AnalogToBi switched-capacitor samplers (5.6K rows). Treat `dc_gain_dB` as a signal-path DC indicator, not a performance metric.
|
| 111 |
+
|
| 112 |
+
2. **Missing `dc_gain_dB` is not an error.** Time-domain testbenches (`VcoTestbench`, `ComparatorTestbench`, `BandgapTestbench`) don't produce an AC gain; they emit temperature-sweep voltages, oscillation metrics, or transient edge timestamps instead. 7.6% of converged rows land in this regime.
|
| 113 |
+
|
| 114 |
+
3. **Units are SI throughout** (V, A, W, Hz, s). MOSFET dimensions in `netlist_json.devices[].params` are in µm (our `ngspice` runs with `ngbehavior=hs` + `scale=1e-6`).
|
| 115 |
+
|
| 116 |
+
## `netlist_json` (JSON string)
|
| 117 |
+
|
| 118 |
+
Lossless typed-pin primitive — the canonical graph representation. See `scripts/pyg/schema.py` for the builder; full primitive schema:
|
| 119 |
+
|
| 120 |
+
```json
|
| 121 |
+
{
|
| 122 |
+
"nets": [
|
| 123 |
+
{"name": "VDD", "role": "supply_pos", "external": true},
|
| 124 |
+
{"name": "NET1", "role": "internal", "external": false}
|
| 125 |
+
],
|
| 126 |
+
"devices": [
|
| 127 |
+
{"name": "M1", "type": "nmos", "model": "nmos4",
|
| 128 |
+
"pins": [{"role": "D", "net": "NET1"}, {"role": "G", "net": "VIN"},
|
| 129 |
+
{"role": "S", "net": "VSS"}, {"role": "B", "net": "VSS"}],
|
| 130 |
+
"params": {"W": 10.0, "L": 0.5}}
|
| 131 |
+
]
|
| 132 |
+
}
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
**Vocabularies** (frozen, tested in `tests/test_vocabularies.py`):
|
| 136 |
+
|
| 137 |
+
- **Device types:** `nmos`, `pmos`, `npn`, `pnp`, `res`, `cap`, `ind`, `isrc`, `vsrc`, `other` (overflow).
|
| 138 |
+
- **Pin roles:** `D` / `G` / `S` / `B` (MOSFET drain/gate/source/bulk), `C` / `B` / `E` / `SUB` (BJT collector/base/emitter/substrate), `P` / `N` (2-terminal positive/negative), `X` (overflow).
|
| 139 |
+
- **Net roles:** `supply_pos`, `supply_neg`, `input_v`, `input_i`, `output_v`, `output_i`, `bias_voltage`, `bias_current`, `clock`, `logic`, `lo_drive`, `rf_input`, `internal`, `unknown`.
|
| 140 |
+
|
| 141 |
+
Three projections live in `scripts/pyg/`:
|
| 142 |
+
|
| 143 |
+
| Function | Shape | Typical use |
|
| 144 |
+
|---|---|---|
|
| 145 |
+
| `to_bipartite(p)` | Two node classes (devices + nets), incidence edges. | OCB-style heterogeneous GNNs. |
|
| 146 |
+
| `to_bus(p)` | Nets as nodes, devices as multi-edges. | FALCON's `graph.json` shape. |
|
| 147 |
+
| `to_node_centric(p)` | Devices as nodes, shared nets as edges. | Compact device-level GNNs. |
|
| 148 |
+
|
| 149 |
+
Every projection carries pin-role and net-role attributes so the primitive is fully recoverable.
|
| 150 |
+
|
| 151 |
+
## `testbench_spice` (SPICE text, `with_testbench` config only)
|
| 152 |
+
|
| 153 |
+
The exact ngspice-ready SPICE that produced this row's `metrics`. Running `ngspice -b` on this text (after substituting the PDK path placeholder) bit-reproduces every numeric value in `metrics`.
|
| 154 |
+
|
| 155 |
+
Structure (roughly, varies per testbench type):
|
| 156 |
+
|
| 157 |
+
```spice
|
| 158 |
+
* testbench for <circuit_id> (sky130 typical)
|
| 159 |
+
.lib "{{SKY130_LIB}}" tt ← placeholder; consumers substitute their local lib path
|
| 160 |
+
|
| 161 |
+
* --- Supply ---
|
| 162 |
+
VDD VDD 0 DC 1.8
|
| 163 |
+
VSS VSS 0 DC 0
|
| 164 |
+
|
| 165 |
+
* --- Bias (BFS + Vth/Vov) ---
|
| 166 |
+
V__VB1 VB1 0 DC 0.900 ← inferred bias voltages (port-role heuristic)
|
| 167 |
+
I__IB1 IB1 VSS DC 0.000050 ← inferred bias currents
|
| 168 |
+
|
| 169 |
+
* --- Input ---
|
| 170 |
+
VIN1 VIN1 0 DC 0.9 AC 1 ← topology-specific stimulus
|
| 171 |
+
|
| 172 |
+
* --- DUT: <circuit_id> ---
|
| 173 |
+
X<name> <d> <g> <s> <b> <sky130 model> W=... L=...
|
| 174 |
+
...
|
| 175 |
+
|
| 176 |
+
* --- Load ---
|
| 177 |
+
CL VOUT 0 10p
|
| 178 |
+
|
| 179 |
+
* --- Analysis ---
|
| 180 |
+
.control
|
| 181 |
+
op
|
| 182 |
+
ac dec 20 1 1G
|
| 183 |
+
meas ac dc_gain_dB find vdb(vout) at=1
|
| 184 |
+
...
|
| 185 |
+
quit
|
| 186 |
+
.endc
|
| 187 |
+
.end
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
The **only environment-specific token** is the `{{SKY130_LIB}}` placeholder — everything else is deterministic given the same circuit + ngspice version.
|
| 191 |
+
|
| 192 |
+
Consumer workflow:
|
| 193 |
+
|
| 194 |
+
```python
|
| 195 |
+
import os
|
| 196 |
+
sky130_lib = os.environ["SKY130_LIB"]
|
| 197 |
+
spice = row["testbench_spice"].replace("{{SKY130_LIB}}", sky130_lib)
|
| 198 |
+
# → hand to ngspice as a batch-mode input
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
`example_simulate.py` in the repo automates this. The `with_testbench` config adds ~40 MB to the default download; skip it if you only need to train on `metrics` and don't need to re-run ngspice.
|
| 202 |
+
|
| 203 |
+
### Notes
|
| 204 |
+
|
| 205 |
+
- **ngspice lowercases output.** `ngbehavior=hs` (which the testbench sets via `.spiceinit`) lowercases tokens during parsing. `.meas ac dc_gain_dB` prints as `dc_gain_db = …`. Parse case-insensitively.
|
| 206 |
+
- **Sweep-aware deck.** Rows with `sim_params.sweep ≠ null` carry their sweep's W/L/Ibias/CL values baked into the deck. You don't need to re-apply the sweep yourself — what's in `testbench_spice` IS the sweep sample.
|
| 207 |
+
- **Failed rows (`converged=false`).** The `failed` split also carries `testbench_spice` for rows where the builder succeeded but ngspice didn't converge. Re-running these with different `.option` directives or tighter initial conditions may rescue some.
|
| 208 |
+
|
| 209 |
+
## `error` vocabulary
|
| 210 |
+
|
| 211 |
+
Converged rows carry `error = ""`. Failed rows use exactly one of:
|
| 212 |
+
|
| 213 |
+
| Value | Cause |
|
| 214 |
+
|---|---|
|
| 215 |
+
| `no_convergence` | ngspice DC operating point iteration hit the step limit without converging. |
|
| 216 |
+
| `singular_matrix` | Jacobian was singular — typically compact-model internal parasitic nodes without a DC path to ground. |
|
| 217 |
+
| `timeout` | Runner killed ngspice after `sim_params.convergence_opts`-defined timeout (60 s for sky130). |
|
| 218 |
+
| `sim_error` | ngspice exited non-zero with an unclassified failure. Often a parser or model-lookup error. |
|
| 219 |
+
| `no_output_port` | Testbench generator couldn't identify an output node in the netlist — structural issue, not a simulator one. |
|
| 220 |
+
| `netlist_not_found` | The source `.spice` file wasn't on disk at simulation time. Shouldn't appear in the shipped release. |
|
| 221 |
+
| `model_not_found` | PDK subcircuit for a device's `model` token couldn't be resolved — e.g. W/L outside BSIM4 bin coverage. |
|
| 222 |
+
|
| 223 |
+
## Supported tasks
|
| 224 |
+
|
| 225 |
+
Three task variants are explicitly supported by the schema. Code snippets use the unified config (`load_dataset("pphilip/analog-circuits-sky130", split="train")`).
|
| 226 |
+
|
| 227 |
+
### 1. `netlist → metrics` (regression)
|
| 228 |
+
|
| 229 |
+
Predict performance metrics from the circuit graph + sweep parameters.
|
| 230 |
+
|
| 231 |
+
```python
|
| 232 |
+
import json, torch
|
| 233 |
+
from datasets import load_dataset
|
| 234 |
+
from scripts.pyg import to_bus
|
| 235 |
+
from torch_geometric.data import Data
|
| 236 |
+
|
| 237 |
+
ds = load_dataset("pphilip/analog-circuits-sky130", split="train")
|
| 238 |
+
|
| 239 |
+
def row_to_pyg(r):
|
| 240 |
+
g = to_bus(r["netlist_json"])
|
| 241 |
+
y = json.loads(r["metrics"]).get("dc_gain_dB", float("nan"))
|
| 242 |
+
return Data(
|
| 243 |
+
edge_index=torch.tensor(g["edge_index"], dtype=torch.long),
|
| 244 |
+
edge_attr=torch.tensor(g["edge_device_params"], dtype=torch.float),
|
| 245 |
+
num_nodes=g["num_nodes"],
|
| 246 |
+
y=torch.tensor([y], dtype=torch.float),
|
| 247 |
+
)
|
| 248 |
+
```
|
| 249 |
+
|
| 250 |
+
Filter to op-amp testbench rows first if you want a uniform target:
|
| 251 |
+
|
| 252 |
+
```python
|
| 253 |
+
op_ds = ds.filter(lambda r: json.loads(r["sim_params"])["testbench"] == "OpampTestbench")
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
### 2. `metrics → topology` (classification)
|
| 257 |
+
|
| 258 |
+
49-class classification from the metric vector.
|
| 259 |
+
|
| 260 |
+
```python
|
| 261 |
+
import json
|
| 262 |
+
from datasets import load_dataset
|
| 263 |
+
|
| 264 |
+
TOPO_VOCAB = sorted({r["topology"] for r in load_dataset(
|
| 265 |
+
"pphilip/analog-circuits-sky130", split="train"
|
| 266 |
+
)})
|
| 267 |
+
TOPO_TO_IDX = {t: i for i, t in enumerate(TOPO_VOCAB)}
|
| 268 |
+
|
| 269 |
+
def row_to_cls(r):
|
| 270 |
+
m = json.loads(r["metrics"])
|
| 271 |
+
features = [m.get(k, float("nan")) for k in (
|
| 272 |
+
"dc_gain_dB", "ugf_Hz", "phase_at_ugf_deg",
|
| 273 |
+
"vout_dc_V", "vdd_current_A", "power_W"
|
| 274 |
+
)]
|
| 275 |
+
return features, TOPO_TO_IDX[r["topology"]]
|
| 276 |
+
```
|
| 277 |
+
|
| 278 |
+
Class imbalance is extreme (55% opamp). Apply `torch.utils.data.WeightedRandomSampler` or class-weighted loss.
|
| 279 |
+
|
| 280 |
+
### 3. `metrics → sizing` (inverse-design regression)
|
| 281 |
+
|
| 282 |
+
Predict `W`, `L`, `I_bias` scale factors (and/or per-device sizing from `netlist_json.devices[].params`) from target metrics. Requires conditioning on topology.
|
| 283 |
+
|
| 284 |
+
```python
|
| 285 |
+
import json
|
| 286 |
+
from datasets import load_dataset
|
| 287 |
+
|
| 288 |
+
ds = load_dataset("pphilip/analog-circuits-sky130", split="train")
|
| 289 |
+
# Sweep rows only — the default-sizing 1× baseline carries no sizing signal
|
| 290 |
+
sweep = ds.filter(lambda r: json.loads(r["sim_params"]).get("sweep") is not None)
|
| 291 |
+
|
| 292 |
+
def row_to_inverse(r):
|
| 293 |
+
sp = json.loads(r["sim_params"])
|
| 294 |
+
m = json.loads(r["metrics"])
|
| 295 |
+
target_metrics = [m.get(k, float("nan")) for k in ("dc_gain_dB", "ugf_Hz", "power_W")]
|
| 296 |
+
sizing = [
|
| 297 |
+
sp["sweep"]["design"]["w_scale"],
|
| 298 |
+
sp["sweep"]["design"]["l_scale"],
|
| 299 |
+
sp["sweep"]["test"]["ib_scale"],
|
| 300 |
+
]
|
| 301 |
+
return target_metrics, sizing, r["topology"]
|
| 302 |
+
```
|
| 303 |
+
|
| 304 |
+
## Reproducibility
|
| 305 |
+
|
| 306 |
+
- **Split determinism:** `base_circuit_id → split` is stored in `splits.json`. Rebuild with `scripts/build_hf_release.py --seed 42` (default).
|
| 307 |
+
- **Simulation determinism:** ngspice DC / AC analyses are deterministic given the same netlist + `.option` directives. Transient solvers can diverge across versions — `sim_params` captures every parameter needed to re-run.
|
| 308 |
+
- **Schema stability:** the vocabularies (`DEVICE_TYPES`, `PIN_ROLES`, `NET_ROLES`, error strings, topology families) in this release are fixed; any change in a future release would be announced in the release notes.
|
default/failed-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b13cd3b5c7ff74a3caeb477f7f97db50bb87351cf74cd68c75805490151558b7
|
| 3 |
+
size 331139
|
default/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e961c1e962131a4d3947ba2c8d792877c2a5803dc89fc378f20297773ce22412
|
| 3 |
+
size 12377404
|
default/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:208bf1a7ba615530129ceca34188368be463f88021660e48a2d13502535126e6
|
| 3 |
+
size 59404076
|
default/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:990974a6ecf30776074dba23aeef2d58ca527b6296971146b50eecc44cce6ee8
|
| 3 |
+
size 12272521
|
example_simulate.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Reproduce any row of `pphilip/analog-circuits-sky130` with ngspice.
|
| 3 |
+
|
| 4 |
+
Usage
|
| 5 |
+
-----
|
| 6 |
+
python example_simulate.py # first converged row of train
|
| 7 |
+
python example_simulate.py --split test --row 42
|
| 8 |
+
python example_simulate.py --circuit-id analoggym_amp_leung_nmcf_pin_3_s000
|
| 9 |
+
python example_simulate.py --row 0 --print-spice # dump the reconstructed SPICE
|
| 10 |
+
|
| 11 |
+
Every row of the `with_testbench` config carries the exact, ngspice-ready
|
| 12 |
+
SPICE that produced its `metrics`. Reproducing a row is:
|
| 13 |
+
1. Load the row.
|
| 14 |
+
2. Substitute `{{SKY130_LIB}}` with your local SKY130 `.lib` path.
|
| 15 |
+
3. Run ngspice on the result.
|
| 16 |
+
4. Parse the `.meas` output.
|
| 17 |
+
|
| 18 |
+
Prerequisites
|
| 19 |
+
-------------
|
| 20 |
+
pip install datasets
|
| 21 |
+
# Install ngspice (v46+):
|
| 22 |
+
# brew install ngspice (macOS)
|
| 23 |
+
# apt install ngspice (Debian/Ubuntu)
|
| 24 |
+
# (or build from source: http://ngspice.sourceforge.net/)
|
| 25 |
+
# Install the SkyWater SKY130 PDK (Apache 2.0):
|
| 26 |
+
pip install volare && volare fetch --pdk sky130
|
| 27 |
+
# Point SKY130_LIB at the combined/continuous lib:
|
| 28 |
+
export SKY130_LIB="$(volare show sky130)/sky130A/libs.tech/combined/continuous/sky130.lib.spice"
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
from __future__ import annotations
|
| 32 |
+
|
| 33 |
+
import argparse
|
| 34 |
+
import json
|
| 35 |
+
import os
|
| 36 |
+
import shutil
|
| 37 |
+
import subprocess
|
| 38 |
+
import sys
|
| 39 |
+
import tempfile
|
| 40 |
+
from pathlib import Path
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# ---------------------------------------------------------------------------
|
| 44 |
+
# Run ngspice + parse .meas output
|
| 45 |
+
# ---------------------------------------------------------------------------
|
| 46 |
+
|
| 47 |
+
def run_ngspice(spice_text: str) -> tuple[dict[str, float], str]:
|
| 48 |
+
"""Run ngspice in batch mode. Returns (parsed_metrics, raw_log).
|
| 49 |
+
|
| 50 |
+
ngspice's `ngbehavior=hs` mode lowercases every token, so `.meas`
|
| 51 |
+
labels come back as `dc_gain_db` even if the SPICE source wrote
|
| 52 |
+
`dc_gain_dB`. Parsing is case-insensitive.
|
| 53 |
+
"""
|
| 54 |
+
if shutil.which("ngspice") is None:
|
| 55 |
+
raise RuntimeError(
|
| 56 |
+
"ngspice not found on PATH. Install it (see prerequisites above)."
|
| 57 |
+
)
|
| 58 |
+
with tempfile.TemporaryDirectory() as d:
|
| 59 |
+
tb = Path(d) / "tb.spice"
|
| 60 |
+
tb.write_text(spice_text)
|
| 61 |
+
r = subprocess.run(
|
| 62 |
+
["ngspice", "-b", str(tb)],
|
| 63 |
+
capture_output=True, text=True, timeout=60,
|
| 64 |
+
)
|
| 65 |
+
log = r.stdout + r.stderr
|
| 66 |
+
|
| 67 |
+
# `.meas` output looks like: dc_gain_db = -3.07410e+01 at= 1.00000e+00
|
| 68 |
+
metrics: dict[str, float] = {}
|
| 69 |
+
for line in log.splitlines():
|
| 70 |
+
parts = line.strip().split("=", 1)
|
| 71 |
+
if len(parts) != 2:
|
| 72 |
+
continue
|
| 73 |
+
key = parts[0].strip().lower()
|
| 74 |
+
if not key or " " in key:
|
| 75 |
+
continue
|
| 76 |
+
# Take the first numeric token after `=`
|
| 77 |
+
for tok in parts[1].split():
|
| 78 |
+
try:
|
| 79 |
+
metrics[key] = float(tok)
|
| 80 |
+
break
|
| 81 |
+
except ValueError:
|
| 82 |
+
continue
|
| 83 |
+
return metrics, log
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def first_converged_row(ds) -> int:
|
| 87 |
+
"""Return the index of the first row with a non-empty testbench_spice."""
|
| 88 |
+
for i in range(len(ds)):
|
| 89 |
+
if ds[i].get("testbench_spice"):
|
| 90 |
+
return i
|
| 91 |
+
raise RuntimeError("no row with testbench_spice found in this split")
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def main() -> int:
|
| 95 |
+
ap = argparse.ArgumentParser(description=__doc__)
|
| 96 |
+
ap.add_argument("--split", default="train",
|
| 97 |
+
choices=["train", "validation", "test", "failed"])
|
| 98 |
+
ap.add_argument("--row", type=int, default=None,
|
| 99 |
+
help="Row index within the split (default: first usable row)")
|
| 100 |
+
ap.add_argument("--circuit-id", default=None,
|
| 101 |
+
help="Alternative to --row: look up by exact circuit_id")
|
| 102 |
+
ap.add_argument("--print-spice", action="store_true",
|
| 103 |
+
help="Print the reconstructed SPICE and exit without running")
|
| 104 |
+
args = ap.parse_args()
|
| 105 |
+
|
| 106 |
+
sky130_lib = os.environ.get("SKY130_LIB")
|
| 107 |
+
if not sky130_lib or not Path(sky130_lib).exists():
|
| 108 |
+
print(
|
| 109 |
+
"ERROR: SKY130_LIB env var not set or doesn't point to a valid file.\n"
|
| 110 |
+
"Install the PDK: `pip install volare && volare fetch --pdk sky130`\n"
|
| 111 |
+
"Then: `export SKY130_LIB=<path to sky130.lib.spice>` "
|
| 112 |
+
"(combined/continuous variant).",
|
| 113 |
+
file=sys.stderr,
|
| 114 |
+
)
|
| 115 |
+
return 2
|
| 116 |
+
|
| 117 |
+
from datasets import load_dataset
|
| 118 |
+
print(f"Loading pphilip/analog-circuits-sky130 (config: with_testbench, split: {args.split})…")
|
| 119 |
+
ds = load_dataset(
|
| 120 |
+
"pphilip/analog-circuits-sky130",
|
| 121 |
+
"with_testbench",
|
| 122 |
+
split=args.split,
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
if args.circuit_id is not None:
|
| 126 |
+
matches = [i for i, r in enumerate(ds) if r["circuit_id"] == args.circuit_id]
|
| 127 |
+
if not matches:
|
| 128 |
+
print(f"circuit_id {args.circuit_id!r} not in split {args.split!r}",
|
| 129 |
+
file=sys.stderr)
|
| 130 |
+
return 1
|
| 131 |
+
idx = matches[0]
|
| 132 |
+
elif args.row is not None:
|
| 133 |
+
idx = args.row
|
| 134 |
+
else:
|
| 135 |
+
idx = first_converged_row(ds)
|
| 136 |
+
|
| 137 |
+
row = ds[idx]
|
| 138 |
+
shipped = json.loads(row["metrics"]) if row["metrics"] else {}
|
| 139 |
+
spice = row["testbench_spice"]
|
| 140 |
+
|
| 141 |
+
print(f" circuit_id: {row['circuit_id']}")
|
| 142 |
+
print(f" topology: {row['topology']} (source: {row['source_dataset']})")
|
| 143 |
+
print(f" shipped metric: dc_gain_dB = {shipped.get('dc_gain_dB', 'n/a')} dB")
|
| 144 |
+
|
| 145 |
+
if not spice:
|
| 146 |
+
print("\n ERROR: this row has no testbench_spice (failed-build case).",
|
| 147 |
+
file=sys.stderr)
|
| 148 |
+
return 1
|
| 149 |
+
|
| 150 |
+
# Swap the portability placeholder for the user's local PDK path.
|
| 151 |
+
spice = spice.replace("{{SKY130_LIB}}", sky130_lib)
|
| 152 |
+
|
| 153 |
+
if args.print_spice:
|
| 154 |
+
print("\n--- reconstructed SPICE ---")
|
| 155 |
+
print(spice)
|
| 156 |
+
return 0
|
| 157 |
+
|
| 158 |
+
print("\nRunning ngspice…")
|
| 159 |
+
try:
|
| 160 |
+
metrics, log = run_ngspice(spice)
|
| 161 |
+
except RuntimeError as e:
|
| 162 |
+
print(f"ERROR: {e}", file=sys.stderr)
|
| 163 |
+
return 3
|
| 164 |
+
|
| 165 |
+
reproduced = metrics.get("dc_gain_db") # ngspice lowercases output keys
|
| 166 |
+
print(f" reproduced: dc_gain_dB = {reproduced} dB")
|
| 167 |
+
|
| 168 |
+
if reproduced is not None and "dc_gain_dB" in shipped:
|
| 169 |
+
delta = abs(reproduced - shipped["dc_gain_dB"])
|
| 170 |
+
tag = "✓ bit-exact" if delta < 1e-3 else ("~ within 0.1 dB" if delta < 0.1 else "✗ mismatch")
|
| 171 |
+
print(f" delta: {delta:.6f} dB {tag}")
|
| 172 |
+
|
| 173 |
+
return 0
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
if __name__ == "__main__":
|
| 177 |
+
sys.exit(main())
|
splits.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
with_testbench/failed-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:29ccc212bd904c085ae22fd013e58fc3fdbfc2fc4fdc29d828efb8dd5900f464
|
| 3 |
+
size 900340
|
with_testbench/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a0c1091946167fa4a9ee8f87927e0e2085ce772bb6b7191ce92513d03765ddb
|
| 3 |
+
size 18426906
|
with_testbench/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abd8a4fbfdf1001ba2b78cf182289fa72c559746e39a9c2befe4421cbd0ae523
|
| 3 |
+
size 87395685
|
with_testbench/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:420be50ca0acdb6b99a4737c2da0982576a2011cd3aa946eb6c71f449ec4ae91
|
| 3 |
+
size 18226729
|