Compare commits

...

37 Commits
main ... sim

Author SHA1 Message Date
dcc8a7262b v1.8: 仍然存在各种BUG 2023-08-22 07:06:18 +00:00
5ba2dbde89 v1.7: 优化了stuck-at模型,但还是存在BUG 2023-08-21 08:53:56 +00:00
90a85d9119 v1.6: 结合SAT-ATPG,覆盖率拉满 2023-08-17 13:03:08 +00:00
30eac7dc0e v1.5: 第一个基准测试版本 2023-08-14 06:40:21 +00:00
2dc85e3e88 v1.4: 初步解决了效率问题 2023-08-14 02:57:32 +00:00
c112a34dd6 v1.3: 修复了权重BUG,但求可行解的能力大幅下降 2023-08-11 08:02:19 +00:00
7a3e157bb7 v1.2: 过程中仿真采样输出 2023-08-10 02:15:06 +00:00
0431ca531a v1.1: 修改了t=20,速度变快,结果变好 2023-08-09 08:59:24 +00:00
ba70167a6b v1.0: 实现了ATPG全流程 2023-08-09 07:47:50 +00:00
535cc3bd81 带sim的版本 2023-07-31 05:55:25 +00:00
4aa1c086b7 比较高效的分数计算 2023-07-18 10:52:51 +00:00
b4916a2a9b 正确的记录score 2023-07-18 04:05:32 +00:00
c80b0ea45b 划分LUT 2023-07-03 06:52:47 +00:00
e74d0af54b 通过编译 2023-06-30 03:26:15 +00:00
34f17a7b2e 同步代码 2023-05-10 11:41:00 +08:00
482069812f 测试 2023-05-10 10:32:52 +08:00
85cd5aa62b 没有问题的good_var,但是巨慢 2023-05-09 23:14:22 +08:00
cc370586ae 同步代码 2023-05-07 04:48:44 +00:00
78df039924 修改目录结构 2023-05-05 02:48:27 +00:00
38f925c9a4 可用版 2023-05-05 02:40:33 +00:00
d4c6df7b98 同步代码 2023-03-22 03:25:38 +00:00
181e57aa7f 更新代码 2023-03-22 03:16:17 +00:00
39e218b333 修改项目结构 2023-03-22 02:46:14 +00:00
c8ef5ac6dd vscode自动编译调试程序 2023-03-11 07:02:02 +00:00
329f3a849f 增量 STEM-INC 实验 2023-03-09 14:54:23 +08:00
421d533c4a 动态调整STEM_INC 2023-03-09 13:49:18 +08:00
061c66e888 python脚本只统计不运行 2023-03-09 05:45:39 +00:00
8e923f249d 增加结果 2023-03-09 13:17:53 +08:00
622f0f11f9 增加结果 2023-03-09 12:58:14 +08:00
2337c138d2 增加测试脚本 2023-03-09 03:31:16 +00:00
77a4984f3a gate 增加了 level 字段 2023-03-09 02:51:10 +00:00
8f2262eaee 删除所有txt 2023-03-08 07:24:08 +00:00
041ff6c2e3 修复BUG,现在可以统计错误传播层数了 2023-03-08 07:22:28 +00:00
6be4d80653 计算出错误传播的长度 2023-03-06 11:05:30 +00:00
c15186ad01 修改了一些参数 2023-03-05 06:24:10 +00:00
17e95ded9b 修复了旧版的BUG 2023-03-03 07:33:14 +00:00
1a93b8a8a3 修复了所有问题 2023-03-02 08:17:53 +00:00
89 changed files with 3266 additions and 44271 deletions

17
.gitignore vendored
View File

@ -1,3 +1,18 @@
*.o
*.d
.vscode
output.txt
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
benchmark
build
old
experiment

17
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}

34
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,34 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/atpg",
"args": ["-i", "${workspaceFolder}/benchmark/c17.bench"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "build"
}
]
}

95
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,95 @@
{
"files.associations": {
"*.ejs": "html",
"array": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"set": "cpp",
"algorithm": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"random": "cpp",
"regex": "cpp",
"fstream": "cpp",
"iostream": "cpp",
"cinttypes": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"__verbose_abort": "cpp",
"complex": "cpp",
"cstring": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"locale": "cpp",
"mutex": "cpp",
"optional": "cpp",
"queue": "cpp",
"stack": "cpp",
"variant": "cpp",
"__nullptr": "cpp",
"__string": "cpp",
"condition_variable": "cpp",
"list": "cpp",
"map": "cpp",
"shared_mutex": "cpp",
"thread": "cpp",
"typeindex": "cpp",
"csignal": "cpp",
"strstream": "cpp",
"codecvt": "cpp",
"cfenv": "cpp"
}
}

12
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "make -j 8"
}
]
}

1
Atalanta Submodule

@ -0,0 +1 @@
Subproject commit 12d405311c3dc9f371a9009bb5cdc8844fe34f90

9
CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.20)
project(atpg-ls)
#
add_subdirectory(tg-pro)
add_subdirectory(src)
target_link_libraries(atpg atpg_backend sat_solver)

View File

@ -1,109 +0,0 @@
library(demo) {
cell(NAND4) {
area: 15;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(D) { direction: input; }
pin(Y) { direction: output; function: "(A*B*C*D)'"; } }
cell(NAND3) {
area: 12;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(Y) { direction: output; function: "(A*B*C)'"; } }
cell(NAND2) {
area: 10;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A*B)'"; } }
cell(AND4) {
area: 20;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(D) { direction: input; }
pin(Y) { direction: output; function: "(A*B*C*D)"; } }
cell(AND3) {
area: 15;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(Y) { direction: output; function: "(A*B*C)"; } }
cell(AND2) {
area: 12;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A*B)"; } }
cell(NOR4) {
area: 20;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(D) { direction: input; }
pin(Y) { direction: output; function: "(A+B+C+D)'"; } }
cell(NOR3) {
area: 15;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(Y) { direction: output; function: "(A+B+C)'"; } }
cell(NOR2) {
area: 10;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A+B)'"; } }
cell(OR4) {
area: 20;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(D) { direction: input; }
pin(Y) { direction: output; function: "(A+B+C+D)"; } }
cell(OR3) {
area: 15;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(C) { direction: input; }
pin(Y) { direction: output; function: "(A+B+C)"; } }
cell(OR2) {
area: 10;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A+B)"; } }
cell(XNOR2) {
area: 25;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A^B)'"; } }
cell(XOR2) {
area: 25;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A^B)"; } }
cell(BUF) {
area: 12;
pin(A) { direction: input; }
pin(Y) { direction: output; function: "A"; } }
cell(NOT) {
area: 6;
pin(A) { direction: input; }
pin(Y) { direction: output; function: "A'"; } }
}

View File

View File

View File

@ -1,17 +0,0 @@
import os
import re
for file in os.listdir("."):
if not file.endswith(".bench"): continue
content = open(file, "r").read()
content = re.sub(r"(\d+)", r"\\\1", content)
print(content)
f = open("new/" + file, "w")
f.write(content)
f.close()

View File

@ -1,623 +0,0 @@
# c\1355
INPUT(\1)
INPUT(\8)
INPUT(\15)
INPUT(\22)
INPUT(\29)
INPUT(\36)
INPUT(\43)
INPUT(\50)
INPUT(\57)
INPUT(\64)
INPUT(\71)
INPUT(\78)
INPUT(\85)
INPUT(\92)
INPUT(\99)
INPUT(\106)
INPUT(\113)
INPUT(\120)
INPUT(\127)
INPUT(\134)
INPUT(\141)
INPUT(\148)
INPUT(\155)
INPUT(\162)
INPUT(\169)
INPUT(\176)
INPUT(\183)
INPUT(\190)
INPUT(\197)
INPUT(\204)
INPUT(\211)
INPUT(\218)
INPUT(\225)
INPUT(\226)
INPUT(\227)
INPUT(\228)
INPUT(\229)
INPUT(\230)
INPUT(\231)
INPUT(\232)
INPUT(\233)
OUTPUT(\1324)
OUTPUT(\1325)
OUTPUT(\1326)
OUTPUT(\1327)
OUTPUT(\1328)
OUTPUT(\1329)
OUTPUT(\1330)
OUTPUT(\1331)
OUTPUT(\1332)
OUTPUT(\1333)
OUTPUT(\1334)
OUTPUT(\1335)
OUTPUT(\1336)
OUTPUT(\1337)
OUTPUT(\1338)
OUTPUT(\1339)
OUTPUT(\1340)
OUTPUT(\1341)
OUTPUT(\1342)
OUTPUT(\1343)
OUTPUT(\1344)
OUTPUT(\1345)
OUTPUT(\1346)
OUTPUT(\1347)
OUTPUT(\1348)
OUTPUT(\1349)
OUTPUT(\1350)
OUTPUT(\1351)
OUTPUT(\1352)
OUTPUT(\1353)
OUTPUT(\1354)
OUTPUT(\1355)
\242 = AND(\225, \233)
\245 = AND(\226, \233)
\248 = AND(\227, \233)
\251 = AND(\228, \233)
\254 = AND(\229, \233)
\257 = AND(\230, \233)
\260 = AND(\231, \233)
\263 = AND(\232, \233)
\266 = NAND(\1, \8)
\269 = NAND(\15, \22)
\272 = NAND(\29, \36)
\275 = NAND(\43, \50)
\278 = NAND(\57, \64)
\281 = NAND(\71, \78)
\284 = NAND(\85, \92)
\287 = NAND(\99, \106)
\290 = NAND(\113, \120)
\293 = NAND(\127, \134)
\296 = NAND(\141, \148)
\299 = NAND(\155, \162)
\302 = NAND(\169, \176)
\305 = NAND(\183, \190)
\308 = NAND(\197, \204)
\311 = NAND(\211, \218)
\314 = NAND(\1, \29)
\317 = NAND(\57, \85)
\320 = NAND(\8, \36)
\323 = NAND(\64, \92)
\326 = NAND(\15, \43)
\329 = NAND(\71, \99)
\332 = NAND(\22, \50)
\335 = NAND(\78, \106)
\338 = NAND(\113, \141)
\341 = NAND(\169, \197)
\344 = NAND(\120, \148)
\347 = NAND(\176, \204)
\350 = NAND(\127, \155)
\353 = NAND(\183, \211)
\356 = NAND(\134, \162)
\359 = NAND(\190, \218)
\362 = NAND(\1, \266)
\363 = NAND(\8, \266)
\364 = NAND(\15, \269)
\365 = NAND(\22, \269)
\366 = NAND(\29, \272)
\367 = NAND(\36, \272)
\368 = NAND(\43, \275)
\369 = NAND(\50, \275)
\370 = NAND(\57, \278)
\371 = NAND(\64, \278)
\372 = NAND(\71, \281)
\373 = NAND(\78, \281)
\374 = NAND(\85, \284)
\375 = NAND(\92, \284)
\376 = NAND(\99, \287)
\377 = NAND(\106, \287)
\378 = NAND(\113, \290)
\379 = NAND(\120, \290)
\380 = NAND(\127, \293)
\381 = NAND(\134, \293)
\382 = NAND(\141, \296)
\383 = NAND(\148, \296)
\384 = NAND(\155, \299)
\385 = NAND(\162, \299)
\386 = NAND(\169, \302)
\387 = NAND(\176, \302)
\388 = NAND(\183, \305)
\389 = NAND(\190, \305)
\390 = NAND(\197, \308)
\391 = NAND(\204, \308)
\392 = NAND(\211, \311)
\393 = NAND(\218, \311)
\394 = NAND(\1, \314)
\395 = NAND(\29, \314)
\396 = NAND(\57, \317)
\397 = NAND(\85, \317)
\398 = NAND(\8, \320)
\399 = NAND(\36, \320)
\400 = NAND(\64, \323)
\401 = NAND(\92, \323)
\402 = NAND(\15, \326)
\403 = NAND(\43, \326)
\404 = NAND(\71, \329)
\405 = NAND(\99, \329)
\406 = NAND(\22, \332)
\407 = NAND(\50, \332)
\408 = NAND(\78, \335)
\409 = NAND(\106, \335)
\410 = NAND(\113, \338)
\411 = NAND(\141, \338)
\412 = NAND(\169, \341)
\413 = NAND(\197, \341)
\414 = NAND(\120, \344)
\415 = NAND(\148, \344)
\416 = NAND(\176, \347)
\417 = NAND(\204, \347)
\418 = NAND(\127, \350)
\419 = NAND(\155, \350)
\420 = NAND(\183, \353)
\421 = NAND(\211, \353)
\422 = NAND(\134, \356)
\423 = NAND(\162, \356)
\424 = NAND(\190, \359)
\425 = NAND(\218, \359)
\426 = NAND(\362, \363)
\429 = NAND(\364, \365)
\432 = NAND(\366, \367)
\435 = NAND(\368, \369)
\438 = NAND(\370, \371)
\441 = NAND(\372, \373)
\444 = NAND(\374, \375)
\447 = NAND(\376, \377)
\450 = NAND(\378, \379)
\453 = NAND(\380, \381)
\456 = NAND(\382, \383)
\459 = NAND(\384, \385)
\462 = NAND(\386, \387)
\465 = NAND(\388, \389)
\468 = NAND(\390, \391)
\471 = NAND(\392, \393)
\474 = NAND(\394, \395)
\477 = NAND(\396, \397)
\480 = NAND(\398, \399)
\483 = NAND(\400, \401)
\486 = NAND(\402, \403)
\489 = NAND(\404, \405)
\492 = NAND(\406, \407)
\495 = NAND(\408, \409)
\498 = NAND(\410, \411)
\501 = NAND(\412, \413)
\504 = NAND(\414, \415)
\507 = NAND(\416, \417)
\510 = NAND(\418, \419)
\513 = NAND(\420, \421)
\516 = NAND(\422, \423)
\519 = NAND(\424, \425)
\522 = NAND(\426, \429)
\525 = NAND(\432, \435)
\528 = NAND(\438, \441)
\531 = NAND(\444, \447)
\534 = NAND(\450, \453)
\537 = NAND(\456, \459)
\540 = NAND(\462, \465)
\543 = NAND(\468, \471)
\546 = NAND(\474, \477)
\549 = NAND(\480, \483)
\552 = NAND(\486, \489)
\555 = NAND(\492, \495)
\558 = NAND(\498, \501)
\561 = NAND(\504, \507)
\564 = NAND(\510, \513)
\567 = NAND(\516, \519)
\570 = NAND(\426, \522)
\571 = NAND(\429, \522)
\572 = NAND(\432, \525)
\573 = NAND(\435, \525)
\574 = NAND(\438, \528)
\575 = NAND(\441, \528)
\576 = NAND(\444, \531)
\577 = NAND(\447, \531)
\578 = NAND(\450, \534)
\579 = NAND(\453, \534)
\580 = NAND(\456, \537)
\581 = NAND(\459, \537)
\582 = NAND(\462, \540)
\583 = NAND(\465, \540)
\584 = NAND(\468, \543)
\585 = NAND(\471, \543)
\586 = NAND(\474, \546)
\587 = NAND(\477, \546)
\588 = NAND(\480, \549)
\589 = NAND(\483, \549)
\590 = NAND(\486, \552)
\591 = NAND(\489, \552)
\592 = NAND(\492, \555)
\593 = NAND(\495, \555)
\594 = NAND(\498, \558)
\595 = NAND(\501, \558)
\596 = NAND(\504, \561)
\597 = NAND(\507, \561)
\598 = NAND(\510, \564)
\599 = NAND(\513, \564)
\600 = NAND(\516, \567)
\601 = NAND(\519, \567)
\602 = NAND(\570, \571)
\607 = NAND(\572, \573)
\612 = NAND(\574, \575)
\617 = NAND(\576, \577)
\622 = NAND(\578, \579)
\627 = NAND(\580, \581)
\632 = NAND(\582, \583)
\637 = NAND(\584, \585)
\642 = NAND(\586, \587)
\645 = NAND(\588, \589)
\648 = NAND(\590, \591)
\651 = NAND(\592, \593)
\654 = NAND(\594, \595)
\657 = NAND(\596, \597)
\660 = NAND(\598, \599)
\663 = NAND(\600, \601)
\666 = NAND(\602, \607)
\669 = NAND(\612, \617)
\672 = NAND(\602, \612)
\675 = NAND(\607, \617)
\678 = NAND(\622, \627)
\681 = NAND(\632, \637)
\684 = NAND(\622, \632)
\687 = NAND(\627, \637)
\690 = NAND(\602, \666)
\691 = NAND(\607, \666)
\692 = NAND(\612, \669)
\693 = NAND(\617, \669)
\694 = NAND(\602, \672)
\695 = NAND(\612, \672)
\696 = NAND(\607, \675)
\697 = NAND(\617, \675)
\698 = NAND(\622, \678)
\699 = NAND(\627, \678)
\700 = NAND(\632, \681)
\701 = NAND(\637, \681)
\702 = NAND(\622, \684)
\703 = NAND(\632, \684)
\704 = NAND(\627, \687)
\705 = NAND(\637, \687)
\706 = NAND(\690, \691)
\709 = NAND(\692, \693)
\712 = NAND(\694, \695)
\715 = NAND(\696, \697)
\718 = NAND(\698, \699)
\721 = NAND(\700, \701)
\724 = NAND(\702, \703)
\727 = NAND(\704, \705)
\730 = NAND(\242, \718)
\733 = NAND(\245, \721)
\736 = NAND(\248, \724)
\739 = NAND(\251, \727)
\742 = NAND(\254, \706)
\745 = NAND(\257, \709)
\748 = NAND(\260, \712)
\751 = NAND(\263, \715)
\754 = NAND(\242, \730)
\755 = NAND(\718, \730)
\756 = NAND(\245, \733)
\757 = NAND(\721, \733)
\758 = NAND(\248, \736)
\759 = NAND(\724, \736)
\760 = NAND(\251, \739)
\761 = NAND(\727, \739)
\762 = NAND(\254, \742)
\763 = NAND(\706, \742)
\764 = NAND(\257, \745)
\765 = NAND(\709, \745)
\766 = NAND(\260, \748)
\767 = NAND(\712, \748)
\768 = NAND(\263, \751)
\769 = NAND(\715, \751)
\770 = NAND(\754, \755)
\773 = NAND(\756, \757)
\776 = NAND(\758, \759)
\779 = NAND(\760, \761)
\782 = NAND(\762, \763)
\785 = NAND(\764, \765)
\788 = NAND(\766, \767)
\791 = NAND(\768, \769)
\794 = NAND(\642, \770)
\797 = NAND(\645, \773)
\800 = NAND(\648, \776)
\803 = NAND(\651, \779)
\806 = NAND(\654, \782)
\809 = NAND(\657, \785)
\812 = NAND(\660, \788)
\815 = NAND(\663, \791)
\818 = NAND(\642, \794)
\819 = NAND(\770, \794)
\820 = NAND(\645, \797)
\821 = NAND(\773, \797)
\822 = NAND(\648, \800)
\823 = NAND(\776, \800)
\824 = NAND(\651, \803)
\825 = NAND(\779, \803)
\826 = NAND(\654, \806)
\827 = NAND(\782, \806)
\828 = NAND(\657, \809)
\829 = NAND(\785, \809)
\830 = NAND(\660, \812)
\831 = NAND(\788, \812)
\832 = NAND(\663, \815)
\833 = NAND(\791, \815)
\834 = NAND(\818, \819)
\847 = NAND(\820, \821)
\860 = NAND(\822, \823)
\873 = NAND(\824, \825)
\886 = NAND(\828, \829)
\899 = NAND(\832, \833)
\912 = NAND(\830, \831)
\925 = NAND(\826, \827)
\938 = NOT(\834)
\939 = NOT(\847)
\940 = NOT(\860)
\941 = NOT(\834)
\942 = NOT(\847)
\943 = NOT(\873)
\944 = NOT(\834)
\945 = NOT(\860)
\946 = NOT(\873)
\947 = NOT(\847)
\948 = NOT(\860)
\949 = NOT(\873)
\950 = NOT(\886)
\951 = NOT(\899)
\952 = NOT(\886)
\953 = NOT(\912)
\954 = NOT(\925)
\955 = NOT(\899)
\956 = NOT(\925)
\957 = NOT(\912)
\958 = NOT(\925)
\959 = NOT(\886)
\960 = NOT(\912)
\961 = NOT(\925)
\962 = NOT(\886)
\963 = NOT(\899)
\964 = NOT(\925)
\965 = NOT(\912)
\966 = NOT(\899)
\967 = NOT(\886)
\968 = NOT(\912)
\969 = NOT(\899)
\970 = NOT(\847)
\971 = NOT(\873)
\972 = NOT(\847)
\973 = NOT(\860)
\974 = NOT(\834)
\975 = NOT(\873)
\976 = NOT(\834)
\977 = NOT(\860)
\978 = AND(\938, \939, \940, \873)
\979 = AND(\941, \942, \860, \943)
\980 = AND(\944, \847, \945, \946)
\981 = AND(\834, \947, \948, \949)
\982 = AND(\958, \959, \960, \899)
\983 = AND(\961, \962, \912, \963)
\984 = AND(\964, \886, \965, \966)
\985 = AND(\925, \967, \968, \969)
\986 = OR(\978, \979, \980, \981)
\991 = OR(\982, \983, \984, \985)
\996 = AND(\925, \950, \912, \951, \986)
\1001 = AND(\925, \952, \953, \899, \986)
\1006 = AND(\954, \886, \912, \955, \986)
\1011 = AND(\956, \886, \957, \899, \986)
\1016 = AND(\834, \970, \860, \971, \991)
\1021 = AND(\834, \972, \973, \873, \991)
\1026 = AND(\974, \847, \860, \975, \991)
\1031 = AND(\976, \847, \977, \873, \991)
\1036 = AND(\834, \996)
\1039 = AND(\847, \996)
\1042 = AND(\860, \996)
\1045 = AND(\873, \996)
\1048 = AND(\834, \1001)
\1051 = AND(\847, \1001)
\1054 = AND(\860, \1001)
\1057 = AND(\873, \1001)
\1060 = AND(\834, \1006)
\1063 = AND(\847, \1006)
\1066 = AND(\860, \1006)
\1069 = AND(\873, \1006)
\1072 = AND(\834, \1011)
\1075 = AND(\847, \1011)
\1078 = AND(\860, \1011)
\1081 = AND(\873, \1011)
\1084 = AND(\925, \1016)
\1087 = AND(\886, \1016)
\1090 = AND(\912, \1016)
\1093 = AND(\899, \1016)
\1096 = AND(\925, \1021)
\1099 = AND(\886, \1021)
\1102 = AND(\912, \1021)
\1105 = AND(\899, \1021)
\1108 = AND(\925, \1026)
\1111 = AND(\886, \1026)
\1114 = AND(\912, \1026)
\1117 = AND(\899, \1026)
\1120 = AND(\925, \1031)
\1123 = AND(\886, \1031)
\1126 = AND(\912, \1031)
\1129 = AND(\899, \1031)
\1132 = NAND(\1, \1036)
\1135 = NAND(\8, \1039)
\1138 = NAND(\15, \1042)
\1141 = NAND(\22, \1045)
\1144 = NAND(\29, \1048)
\1147 = NAND(\36, \1051)
\1150 = NAND(\43, \1054)
\1153 = NAND(\50, \1057)
\1156 = NAND(\57, \1060)
\1159 = NAND(\64, \1063)
\1162 = NAND(\71, \1066)
\1165 = NAND(\78, \1069)
\1168 = NAND(\85, \1072)
\1171 = NAND(\92, \1075)
\1174 = NAND(\99, \1078)
\1177 = NAND(\106, \1081)
\1180 = NAND(\113, \1084)
\1183 = NAND(\120, \1087)
\1186 = NAND(\127, \1090)
\1189 = NAND(\134, \1093)
\1192 = NAND(\141, \1096)
\1195 = NAND(\148, \1099)
\1198 = NAND(\155, \1102)
\1201 = NAND(\162, \1105)
\1204 = NAND(\169, \1108)
\1207 = NAND(\176, \1111)
\1210 = NAND(\183, \1114)
\1213 = NAND(\190, \1117)
\1216 = NAND(\197, \1120)
\1219 = NAND(\204, \1123)
\1222 = NAND(\211, \1126)
\1225 = NAND(\218, \1129)
\1228 = NAND(\1, \1132)
\1229 = NAND(\1036, \1132)
\1230 = NAND(\8, \1135)
\1231 = NAND(\1039, \1135)
\1232 = NAND(\15, \1138)
\1233 = NAND(\1042, \1138)
\1234 = NAND(\22, \1141)
\1235 = NAND(\1045, \1141)
\1236 = NAND(\29, \1144)
\1237 = NAND(\1048, \1144)
\1238 = NAND(\36, \1147)
\1239 = NAND(\1051, \1147)
\1240 = NAND(\43, \1150)
\1241 = NAND(\1054, \1150)
\1242 = NAND(\50, \1153)
\1243 = NAND(\1057, \1153)
\1244 = NAND(\57, \1156)
\1245 = NAND(\1060, \1156)
\1246 = NAND(\64, \1159)
\1247 = NAND(\1063, \1159)
\1248 = NAND(\71, \1162)
\1249 = NAND(\1066, \1162)
\1250 = NAND(\78, \1165)
\1251 = NAND(\1069, \1165)
\1252 = NAND(\85, \1168)
\1253 = NAND(\1072, \1168)
\1254 = NAND(\92, \1171)
\1255 = NAND(\1075, \1171)
\1256 = NAND(\99, \1174)
\1257 = NAND(\1078, \1174)
\1258 = NAND(\106, \1177)
\1259 = NAND(\1081, \1177)
\1260 = NAND(\113, \1180)
\1261 = NAND(\1084, \1180)
\1262 = NAND(\120, \1183)
\1263 = NAND(\1087, \1183)
\1264 = NAND(\127, \1186)
\1265 = NAND(\1090, \1186)
\1266 = NAND(\134, \1189)
\1267 = NAND(\1093, \1189)
\1268 = NAND(\141, \1192)
\1269 = NAND(\1096, \1192)
\1270 = NAND(\148, \1195)
\1271 = NAND(\1099, \1195)
\1272 = NAND(\155, \1198)
\1273 = NAND(\1102, \1198)
\1274 = NAND(\162, \1201)
\1275 = NAND(\1105, \1201)
\1276 = NAND(\169, \1204)
\1277 = NAND(\1108, \1204)
\1278 = NAND(\176, \1207)
\1279 = NAND(\1111, \1207)
\1280 = NAND(\183, \1210)
\1281 = NAND(\1114, \1210)
\1282 = NAND(\190, \1213)
\1283 = NAND(\1117, \1213)
\1284 = NAND(\197, \1216)
\1285 = NAND(\1120, \1216)
\1286 = NAND(\204, \1219)
\1287 = NAND(\1123, \1219)
\1288 = NAND(\211, \1222)
\1289 = NAND(\1126, \1222)
\1290 = NAND(\218, \1225)
\1291 = NAND(\1129, \1225)
\1292 = NAND(\1228, \1229)
\1293 = NAND(\1230, \1231)
\1294 = NAND(\1232, \1233)
\1295 = NAND(\1234, \1235)
\1296 = NAND(\1236, \1237)
\1297 = NAND(\1238, \1239)
\1298 = NAND(\1240, \1241)
\1299 = NAND(\1242, \1243)
\1300 = NAND(\1244, \1245)
\1301 = NAND(\1246, \1247)
\1302 = NAND(\1248, \1249)
\1303 = NAND(\1250, \1251)
\1304 = NAND(\1252, \1253)
\1305 = NAND(\1254, \1255)
\1306 = NAND(\1256, \1257)
\1307 = NAND(\1258, \1259)
\1308 = NAND(\1260, \1261)
\1309 = NAND(\1262, \1263)
\1310 = NAND(\1264, \1265)
\1311 = NAND(\1266, \1267)
\1312 = NAND(\1268, \1269)
\1313 = NAND(\1270, \1271)
\1314 = NAND(\1272, \1273)
\1315 = NAND(\1274, \1275)
\1316 = NAND(\1276, \1277)
\1317 = NAND(\1278, \1279)
\1318 = NAND(\1280, \1281)
\1319 = NAND(\1282, \1283)
\1320 = NAND(\1284, \1285)
\1321 = NAND(\1286, \1287)
\1322 = NAND(\1288, \1289)
\1323 = NAND(\1290, \1291)
\1324 = BUFF(\1292)
\1325 = BUFF(\1293)
\1326 = BUFF(\1294)
\1327 = BUFF(\1295)
\1328 = BUFF(\1296)
\1329 = BUFF(\1297)
\1330 = BUFF(\1298)
\1331 = BUFF(\1299)
\1332 = BUFF(\1300)
\1333 = BUFF(\1301)
\1334 = BUFF(\1302)
\1335 = BUFF(\1303)
\1336 = BUFF(\1304)
\1337 = BUFF(\1305)
\1338 = BUFF(\1306)
\1339 = BUFF(\1307)
\1340 = BUFF(\1308)
\1341 = BUFF(\1309)
\1342 = BUFF(\1310)
\1343 = BUFF(\1311)
\1344 = BUFF(\1312)
\1345 = BUFF(\1313)
\1346 = BUFF(\1314)
\1347 = BUFF(\1315)
\1348 = BUFF(\1316)
\1349 = BUFF(\1317)
\1350 = BUFF(\1318)
\1351 = BUFF(\1319)
\1352 = BUFF(\1320)
\1353 = BUFF(\1321)
\1354 = BUFF(\1322)
\1355 = BUFF(\1323)

View File

@ -1,17 +0,0 @@
# c\17
INPUT(\1)
INPUT(\2)
INPUT(\3)
INPUT(\6)
INPUT(\7)
OUTPUT(\22)
OUTPUT(\23)
\10 = NAND(\1, \3)
\11 = NAND(\3, \6)
\16 = NAND(\2, \11)
\19 = NAND(\11, \7)
\22 = NAND(\10, \16)
\23 = NAND(\16, \19)

View File

@ -1,16 +0,0 @@
* Name of circuit: c17.bench
* Primary inputs :
\1 \2 \3 \6 \7
* Primary outputs:
\22 \23
* Test patterns and fault free responses:
1: 01100 11
2: 10000 00
3: 00001 01
4: 00111 00
5: 01110 00
6: 01010 11
7: 10100 10

View File

@ -1,8 +0,0 @@
01100
10000
00001
00111
01110
01010
10100
END

View File

@ -1,942 +0,0 @@
# c\1908
INPUT(\1)
INPUT(\4)
INPUT(\7)
INPUT(\10)
INPUT(\13)
INPUT(\16)
INPUT(\19)
INPUT(\22)
INPUT(\25)
INPUT(\28)
INPUT(\31)
INPUT(\34)
INPUT(\37)
INPUT(\40)
INPUT(\43)
INPUT(\46)
INPUT(\49)
INPUT(\53)
INPUT(\56)
INPUT(\60)
INPUT(\63)
INPUT(\66)
INPUT(\69)
INPUT(\72)
INPUT(\76)
INPUT(\79)
INPUT(\82)
INPUT(\85)
INPUT(\88)
INPUT(\91)
INPUT(\94)
INPUT(\99)
INPUT(\104)
OUTPUT(\2753)
OUTPUT(\2754)
OUTPUT(\2755)
OUTPUT(\2756)
OUTPUT(\2762)
OUTPUT(\2767)
OUTPUT(\2768)
OUTPUT(\2779)
OUTPUT(\2780)
OUTPUT(\2781)
OUTPUT(\2782)
OUTPUT(\2783)
OUTPUT(\2784)
OUTPUT(\2785)
OUTPUT(\2786)
OUTPUT(\2787)
OUTPUT(\2811)
OUTPUT(\2886)
OUTPUT(\2887)
OUTPUT(\2888)
OUTPUT(\2889)
OUTPUT(\2890)
OUTPUT(\2891)
OUTPUT(\2892)
OUTPUT(\2899)
\190 = NOT(\1)
\194 = NOT(\4)
\197 = NOT(\7)
\201 = NOT(\10)
\206 = NOT(\13)
\209 = NOT(\16)
\212 = NOT(\19)
\216 = NOT(\22)
\220 = NOT(\25)
\225 = NOT(\28)
\229 = NOT(\31)
\232 = NOT(\34)
\235 = NOT(\37)
\239 = NOT(\40)
\243 = NOT(\43)
\247 = NOT(\46)
\251 = NAND(\63, \88)
\252 = NAND(\66, \91)
\253 = NOT(\72)
\256 = NOT(\72)
\257 = BUFF(\69)
\260 = BUFF(\69)
\263 = NOT(\76)
\266 = NOT(\79)
\269 = NOT(\82)
\272 = NOT(\85)
\275 = NOT(\104)
\276 = NOT(\104)
\277 = NOT(\88)
\280 = NOT(\91)
\283 = BUFF(\94)
\290 = NOT(\94)
\297 = BUFF(\94)
\300 = NOT(\94)
\303 = BUFF(\99)
\306 = NOT(\99)
\313 = NOT(\99)
\316 = BUFF(\104)
\319 = NOT(\104)
\326 = BUFF(\104)
\331 = BUFF(\104)
\338 = NOT(\104)
\343 = BUFF(\1)
\346 = BUFF(\4)
\349 = BUFF(\7)
\352 = BUFF(\10)
\355 = BUFF(\13)
\358 = BUFF(\16)
\361 = BUFF(\19)
\364 = BUFF(\22)
\367 = BUFF(\25)
\370 = BUFF(\28)
\373 = BUFF(\31)
\376 = BUFF(\34)
\379 = BUFF(\37)
\382 = BUFF(\40)
\385 = BUFF(\43)
\388 = BUFF(\46)
\534 = NOT(\343)
\535 = NOT(\346)
\536 = NOT(\349)
\537 = NOT(\352)
\538 = NOT(\355)
\539 = NOT(\358)
\540 = NOT(\361)
\541 = NOT(\364)
\542 = NOT(\367)
\543 = NOT(\370)
\544 = NOT(\373)
\545 = NOT(\376)
\546 = NOT(\379)
\547 = NOT(\382)
\548 = NOT(\385)
\549 = NOT(\388)
\550 = NAND(\306, \331)
\551 = NAND(\306, \331)
\552 = NAND(\306, \331)
\553 = NAND(\306, \331)
\554 = NAND(\306, \331)
\555 = NAND(\306, \331)
\556 = BUFF(\190)
\559 = BUFF(\194)
\562 = BUFF(\206)
\565 = BUFF(\209)
\568 = BUFF(\225)
\571 = BUFF(\243)
\574 = AND(\63, \319)
\577 = BUFF(\220)
\580 = BUFF(\229)
\583 = BUFF(\232)
\586 = AND(\66, \319)
\589 = BUFF(\239)
\592 = AND(\49, \253, \319)
\595 = BUFF(\247)
\598 = BUFF(\239)
\601 = NAND(\326, \277)
\602 = NAND(\326, \280)
\603 = NAND(\260, \72)
\608 = NAND(\260, \300)
\612 = NAND(\256, \300)
\616 = BUFF(\201)
\619 = BUFF(\216)
\622 = BUFF(\220)
\625 = BUFF(\239)
\628 = BUFF(\190)
\631 = BUFF(\190)
\634 = BUFF(\194)
\637 = BUFF(\229)
\640 = BUFF(\197)
\643 = AND(\56, \257, \319)
\646 = BUFF(\232)
\649 = BUFF(\201)
\652 = BUFF(\235)
\655 = AND(\60, \257, \319)
\658 = BUFF(\263)
\661 = BUFF(\263)
\664 = BUFF(\266)
\667 = BUFF(\266)
\670 = BUFF(\269)
\673 = BUFF(\269)
\676 = BUFF(\272)
\679 = BUFF(\272)
\682 = AND(\251, \316)
\685 = AND(\252, \316)
\688 = BUFF(\197)
\691 = BUFF(\197)
\694 = BUFF(\212)
\697 = BUFF(\212)
\700 = BUFF(\247)
\703 = BUFF(\247)
\706 = BUFF(\235)
\709 = BUFF(\235)
\712 = BUFF(\201)
\715 = BUFF(\201)
\718 = BUFF(\206)
\721 = BUFF(\216)
\724 = AND(\53, \253, \319)
\727 = BUFF(\243)
\730 = BUFF(\220)
\733 = BUFF(\220)
\736 = BUFF(\209)
\739 = BUFF(\216)
\742 = BUFF(\225)
\745 = BUFF(\243)
\748 = BUFF(\212)
\751 = BUFF(\225)
\886 = NOT(\682)
\887 = NOT(\685)
\888 = NOT(\616)
\889 = NOT(\619)
\890 = NOT(\622)
\891 = NOT(\625)
\892 = NOT(\631)
\893 = NOT(\643)
\894 = NOT(\649)
\895 = NOT(\652)
\896 = NOT(\655)
\897 = AND(\49, \612)
\898 = AND(\56, \608)
\899 = NAND(\53, \612)
\903 = NAND(\60, \608)
\907 = NAND(\49, \612)
\910 = NAND(\56, \608)
\913 = NOT(\661)
\914 = NOT(\658)
\915 = NOT(\667)
\916 = NOT(\664)
\917 = NOT(\673)
\918 = NOT(\670)
\919 = NOT(\679)
\920 = NOT(\676)
\921 = NAND(\277, \297, \326, \603)
\922 = NAND(\280, \297, \326, \603)
\923 = NAND(\303, \338, \603)
\926 = AND(\303, \338, \603)
\935 = BUFF(\556)
\938 = NOT(\688)
\939 = BUFF(\556)
\942 = NOT(\691)
\943 = BUFF(\562)
\946 = NOT(\694)
\947 = BUFF(\562)
\950 = NOT(\697)
\951 = BUFF(\568)
\954 = NOT(\700)
\955 = BUFF(\568)
\958 = NOT(\703)
\959 = BUFF(\574)
\962 = BUFF(\574)
\965 = BUFF(\580)
\968 = NOT(\706)
\969 = BUFF(\580)
\972 = NOT(\709)
\973 = BUFF(\586)
\976 = NOT(\712)
\977 = BUFF(\586)
\980 = NOT(\715)
\981 = BUFF(\592)
\984 = NOT(\628)
\985 = BUFF(\592)
\988 = NOT(\718)
\989 = NOT(\721)
\990 = NOT(\634)
\991 = NOT(\724)
\992 = NOT(\727)
\993 = NOT(\637)
\994 = BUFF(\595)
\997 = NOT(\730)
\998 = BUFF(\595)
\1001 = NOT(\733)
\1002 = NOT(\736)
\1003 = NOT(\739)
\1004 = NOT(\640)
\1005 = NOT(\742)
\1006 = NOT(\745)
\1007 = NOT(\646)
\1008 = NOT(\748)
\1009 = NOT(\751)
\1010 = BUFF(\559)
\1013 = BUFF(\559)
\1016 = BUFF(\565)
\1019 = BUFF(\565)
\1022 = BUFF(\571)
\1025 = BUFF(\571)
\1028 = BUFF(\577)
\1031 = BUFF(\577)
\1034 = BUFF(\583)
\1037 = BUFF(\583)
\1040 = BUFF(\589)
\1043 = BUFF(\589)
\1046 = BUFF(\598)
\1049 = BUFF(\598)
\1054 = NAND(\619, \888)
\1055 = NAND(\616, \889)
\1063 = NAND(\625, \890)
\1064 = NAND(\622, \891)
\1067 = NAND(\655, \895)
\1068 = NAND(\652, \896)
\1119 = NAND(\721, \988)
\1120 = NAND(\718, \989)
\1121 = NAND(\727, \991)
\1122 = NAND(\724, \992)
\1128 = NAND(\739, \1002)
\1129 = NAND(\736, \1003)
\1130 = NAND(\745, \1005)
\1131 = NAND(\742, \1006)
\1132 = NAND(\751, \1008)
\1133 = NAND(\748, \1009)
\1148 = NOT(\939)
\1149 = NOT(\935)
\1150 = NAND(\1054, \1055)
\1151 = NOT(\943)
\1152 = NOT(\947)
\1153 = NOT(\955)
\1154 = NOT(\951)
\1155 = NOT(\962)
\1156 = NOT(\969)
\1157 = NOT(\977)
\1158 = NAND(\1063, \1064)
\1159 = NOT(\985)
\1160 = NAND(\985, \892)
\1161 = NOT(\998)
\1162 = NAND(\1067, \1068)
\1163 = NOT(\899)
\1164 = BUFF(\899)
\1167 = NOT(\903)
\1168 = BUFF(\903)
\1171 = NAND(\921, \923)
\1188 = NAND(\922, \923)
\1205 = NOT(\1010)
\1206 = NAND(\1010, \938)
\1207 = NOT(\1013)
\1208 = NAND(\1013, \942)
\1209 = NOT(\1016)
\1210 = NAND(\1016, \946)
\1211 = NOT(\1019)
\1212 = NAND(\1019, \950)
\1213 = NOT(\1022)
\1214 = NAND(\1022, \954)
\1215 = NOT(\1025)
\1216 = NAND(\1025, \958)
\1217 = NOT(\1028)
\1218 = NOT(\959)
\1219 = NOT(\1031)
\1220 = NOT(\1034)
\1221 = NAND(\1034, \968)
\1222 = NOT(\965)
\1223 = NOT(\1037)
\1224 = NAND(\1037, \972)
\1225 = NOT(\1040)
\1226 = NAND(\1040, \976)
\1227 = NOT(\973)
\1228 = NOT(\1043)
\1229 = NAND(\1043, \980)
\1230 = NOT(\981)
\1231 = NAND(\981, \984)
\1232 = NAND(\1119, \1120)
\1235 = NAND(\1121, \1122)
\1238 = NOT(\1046)
\1239 = NAND(\1046, \997)
\1240 = NOT(\994)
\1241 = NOT(\1049)
\1242 = NAND(\1049, \1001)
\1243 = NAND(\1128, \1129)
\1246 = NAND(\1130, \1131)
\1249 = NAND(\1132, \1133)
\1252 = BUFF(\907)
\1255 = BUFF(\907)
\1258 = BUFF(\910)
\1261 = BUFF(\910)
\1264 = NOT(\1150)
\1267 = NAND(\631, \1159)
\1309 = NAND(\688, \1205)
\1310 = NAND(\691, \1207)
\1311 = NAND(\694, \1209)
\1312 = NAND(\697, \1211)
\1313 = NAND(\700, \1213)
\1314 = NAND(\703, \1215)
\1315 = NAND(\706, \1220)
\1316 = NAND(\709, \1223)
\1317 = NAND(\712, \1225)
\1318 = NAND(\715, \1228)
\1319 = NOT(\1158)
\1322 = NAND(\628, \1230)
\1327 = NAND(\730, \1238)
\1328 = NAND(\733, \1241)
\1334 = NOT(\1162)
\1344 = NAND(\1267, \1160)
\1345 = NAND(\1249, \894)
\1346 = NOT(\1249)
\1348 = NOT(\1255)
\1349 = NOT(\1252)
\1350 = NOT(\1261)
\1351 = NOT(\1258)
\1352 = NAND(\1309, \1206)
\1355 = NAND(\1310, \1208)
\1358 = NAND(\1311, \1210)
\1361 = NAND(\1312, \1212)
\1364 = NAND(\1313, \1214)
\1367 = NAND(\1314, \1216)
\1370 = NAND(\1315, \1221)
\1373 = NAND(\1316, \1224)
\1376 = NAND(\1317, \1226)
\1379 = NAND(\1318, \1229)
\1383 = NAND(\1322, \1231)
\1386 = NOT(\1232)
\1387 = NAND(\1232, \990)
\1388 = NOT(\1235)
\1389 = NAND(\1235, \993)
\1390 = NAND(\1327, \1239)
\1393 = NAND(\1328, \1242)
\1396 = NOT(\1243)
\1397 = NAND(\1243, \1004)
\1398 = NOT(\1246)
\1399 = NAND(\1246, \1007)
\1409 = NOT(\1319)
\1412 = NAND(\649, \1346)
\1413 = NOT(\1334)
\1416 = BUFF(\1264)
\1419 = BUFF(\1264)
\1433 = NAND(\634, \1386)
\1434 = NAND(\637, \1388)
\1438 = NAND(\640, \1396)
\1439 = NAND(\646, \1398)
\1440 = NOT(\1344)
\1443 = NAND(\1355, \1148)
\1444 = NOT(\1355)
\1445 = NAND(\1352, \1149)
\1446 = NOT(\1352)
\1447 = NAND(\1358, \1151)
\1448 = NOT(\1358)
\1451 = NAND(\1361, \1152)
\1452 = NOT(\1361)
\1453 = NAND(\1367, \1153)
\1454 = NOT(\1367)
\1455 = NAND(\1364, \1154)
\1456 = NOT(\1364)
\1457 = NAND(\1373, \1156)
\1458 = NOT(\1373)
\1459 = NAND(\1379, \1157)
\1460 = NOT(\1379)
\1461 = NOT(\1383)
\1462 = NAND(\1393, \1161)
\1463 = NOT(\1393)
\1464 = NAND(\1345, \1412)
\1468 = NOT(\1370)
\1469 = NAND(\1370, \1222)
\1470 = NOT(\1376)
\1471 = NAND(\1376, \1227)
\1472 = NAND(\1387, \1433)
\1475 = NOT(\1390)
\1476 = NAND(\1390, \1240)
\1478 = NAND(\1389, \1434)
\1481 = NAND(\1399, \1439)
\1484 = NAND(\1397, \1438)
\1487 = NAND(\939, \1444)
\1488 = NAND(\935, \1446)
\1489 = NAND(\943, \1448)
\1490 = NOT(\1419)
\1491 = NOT(\1416)
\1492 = NAND(\947, \1452)
\1493 = NAND(\955, \1454)
\1494 = NAND(\951, \1456)
\1495 = NAND(\969, \1458)
\1496 = NAND(\977, \1460)
\1498 = NAND(\998, \1463)
\1499 = NOT(\1440)
\1500 = NAND(\965, \1468)
\1501 = NAND(\973, \1470)
\1504 = NAND(\994, \1475)
\1510 = NOT(\1464)
\1513 = NAND(\1443, \1487)
\1514 = NAND(\1445, \1488)
\1517 = NAND(\1447, \1489)
\1520 = NAND(\1451, \1492)
\1521 = NAND(\1453, \1493)
\1522 = NAND(\1455, \1494)
\1526 = NAND(\1457, \1495)
\1527 = NAND(\1459, \1496)
\1528 = NOT(\1472)
\1529 = NAND(\1462, \1498)
\1530 = NOT(\1478)
\1531 = NOT(\1481)
\1532 = NOT(\1484)
\1534 = NAND(\1471, \1501)
\1537 = NAND(\1469, \1500)
\1540 = NAND(\1476, \1504)
\1546 = NOT(\1513)
\1554 = NOT(\1521)
\1557 = NOT(\1526)
\1561 = NOT(\1520)
\1567 = NAND(\1484, \1531)
\1568 = NAND(\1481, \1532)
\1569 = NOT(\1510)
\1571 = NOT(\1527)
\1576 = NOT(\1529)
\1588 = BUFF(\1522)
\1591 = NOT(\1534)
\1593 = NOT(\1537)
\1594 = NAND(\1540, \1530)
\1595 = NOT(\1540)
\1596 = NAND(\1567, \1568)
\1600 = BUFF(\1517)
\1603 = BUFF(\1517)
\1606 = BUFF(\1522)
\1609 = BUFF(\1522)
\1612 = BUFF(\1514)
\1615 = BUFF(\1514)
\1620 = BUFF(\1557)
\1623 = BUFF(\1554)
\1635 = NOT(\1571)
\1636 = NAND(\1478, \1595)
\1638 = NAND(\1576, \1569)
\1639 = NOT(\1576)
\1640 = BUFF(\1561)
\1643 = BUFF(\1561)
\1647 = BUFF(\1546)
\1651 = BUFF(\1546)
\1658 = BUFF(\1554)
\1661 = BUFF(\1557)
\1664 = BUFF(\1557)
\1671 = NAND(\1596, \893)
\1672 = NOT(\1596)
\1675 = NOT(\1600)
\1677 = NOT(\1603)
\1678 = NAND(\1606, \1217)
\1679 = NOT(\1606)
\1680 = NAND(\1609, \1219)
\1681 = NOT(\1609)
\1682 = NOT(\1612)
\1683 = NOT(\1615)
\1685 = NAND(\1594, \1636)
\1688 = NAND(\1510, \1639)
\1697 = BUFF(\1588)
\1701 = BUFF(\1588)
\1706 = NAND(\643, \1672)
\1707 = NOT(\1643)
\1708 = NAND(\1647, \1675)
\1709 = NOT(\1647)
\1710 = NAND(\1651, \1677)
\1711 = NOT(\1651)
\1712 = NAND(\1028, \1679)
\1713 = NAND(\1031, \1681)
\1714 = BUFF(\1620)
\1717 = BUFF(\1620)
\1720 = NAND(\1658, \1593)
\1721 = NOT(\1658)
\1723 = NAND(\1638, \1688)
\1727 = NOT(\1661)
\1728 = NOT(\1640)
\1730 = NOT(\1664)
\1731 = BUFF(\1623)
\1734 = BUFF(\1623)
\1740 = NAND(\1685, \1528)
\1741 = NOT(\1685)
\1742 = NAND(\1671, \1706)
\1746 = NAND(\1600, \1709)
\1747 = NAND(\1603, \1711)
\1748 = NAND(\1678, \1712)
\1751 = NAND(\1680, \1713)
\1759 = NAND(\1537, \1721)
\1761 = NOT(\1697)
\1762 = NAND(\1697, \1727)
\1763 = NOT(\1701)
\1764 = NAND(\1701, \1730)
\1768 = NOT(\1717)
\1769 = NAND(\1472, \1741)
\1772 = NAND(\1723, \1413)
\1773 = NOT(\1723)
\1774 = NAND(\1708, \1746)
\1777 = NAND(\1710, \1747)
\1783 = NOT(\1731)
\1784 = NAND(\1731, \1682)
\1785 = NOT(\1714)
\1786 = NOT(\1734)
\1787 = NAND(\1734, \1683)
\1788 = NAND(\1720, \1759)
\1791 = NAND(\1661, \1761)
\1792 = NAND(\1664, \1763)
\1795 = NAND(\1751, \1155)
\1796 = NOT(\1751)
\1798 = NAND(\1740, \1769)
\1801 = NAND(\1334, \1773)
\1802 = NAND(\1742, \290)
\1807 = NOT(\1748)
\1808 = NAND(\1748, \1218)
\1809 = NAND(\1612, \1783)
\1810 = NAND(\1615, \1786)
\1812 = NAND(\1791, \1762)
\1815 = NAND(\1792, \1764)
\1818 = BUFF(\1742)
\1821 = NAND(\1777, \1490)
\1822 = NOT(\1777)
\1823 = NAND(\1774, \1491)
\1824 = NOT(\1774)
\1825 = NAND(\962, \1796)
\1826 = NAND(\1788, \1409)
\1827 = NOT(\1788)
\1830 = NAND(\1772, \1801)
\1837 = NAND(\959, \1807)
\1838 = NAND(\1809, \1784)
\1841 = NAND(\1810, \1787)
\1848 = NAND(\1419, \1822)
\1849 = NAND(\1416, \1824)
\1850 = NAND(\1795, \1825)
\1852 = NAND(\1319, \1827)
\1855 = NAND(\1815, \1707)
\1856 = NOT(\1815)
\1857 = NOT(\1818)
\1858 = NAND(\1798, \290)
\1864 = NOT(\1812)
\1865 = NAND(\1812, \1728)
\1866 = BUFF(\1798)
\1869 = BUFF(\1802)
\1872 = BUFF(\1802)
\1875 = NAND(\1808, \1837)
\1878 = NAND(\1821, \1848)
\1879 = NAND(\1823, \1849)
\1882 = NAND(\1841, \1768)
\1883 = NOT(\1841)
\1884 = NAND(\1826, \1852)
\1885 = NAND(\1643, \1856)
\1889 = NAND(\1830, \290)
\1895 = NOT(\1838)
\1896 = NAND(\1838, \1785)
\1897 = NAND(\1640, \1864)
\1898 = NOT(\1850)
\1902 = BUFF(\1830)
\1910 = NOT(\1878)
\1911 = NAND(\1717, \1883)
\1912 = NOT(\1884)
\1913 = NAND(\1855, \1885)
\1915 = NOT(\1866)
\1919 = NAND(\1872, \919)
\1920 = NOT(\1872)
\1921 = NAND(\1869, \920)
\1922 = NOT(\1869)
\1923 = NOT(\1875)
\1924 = NAND(\1714, \1895)
\1927 = BUFF(\1858)
\1930 = BUFF(\1858)
\1933 = NAND(\1865, \1897)
\1936 = NAND(\1882, \1911)
\1937 = NOT(\1898)
\1938 = NOT(\1902)
\1941 = NAND(\679, \1920)
\1942 = NAND(\676, \1922)
\1944 = BUFF(\1879)
\1947 = NOT(\1913)
\1950 = BUFF(\1889)
\1953 = BUFF(\1889)
\1958 = BUFF(\1879)
\1961 = NAND(\1896, \1924)
\1965 = AND(\1910, \601)
\1968 = AND(\602, \1912)
\1975 = NAND(\1930, \917)
\1976 = NOT(\1930)
\1977 = NAND(\1927, \918)
\1978 = NOT(\1927)
\1979 = NAND(\1919, \1941)
\1980 = NAND(\1921, \1942)
\1985 = NOT(\1933)
\1987 = NOT(\1936)
\1999 = NOT(\1944)
\2000 = NAND(\1944, \1937)
\2002 = NOT(\1947)
\2003 = NAND(\1947, \1499)
\2004 = NAND(\1953, \1350)
\2005 = NOT(\1953)
\2006 = NAND(\1950, \1351)
\2007 = NOT(\1950)
\2008 = NAND(\673, \1976)
\2009 = NAND(\670, \1978)
\2012 = NOT(\1979)
\2013 = NOT(\1958)
\2014 = NAND(\1958, \1923)
\2015 = NOT(\1961)
\2016 = NAND(\1961, \1635)
\2018 = NOT(\1965)
\2019 = NOT(\1968)
\2020 = NAND(\1898, \1999)
\2021 = NOT(\1987)
\2022 = NAND(\1987, \1591)
\2023 = NAND(\1440, \2002)
\2024 = NAND(\1261, \2005)
\2025 = NAND(\1258, \2007)
\2026 = NAND(\1975, \2008)
\2027 = NAND(\1977, \2009)
\2030 = NOT(\1980)
\2033 = BUFF(\1980)
\2036 = NAND(\1875, \2013)
\2037 = NAND(\1571, \2015)
\2038 = NAND(\2020, \2000)
\2039 = NAND(\1534, \2021)
\2040 = NAND(\2023, \2003)
\2041 = NAND(\2004, \2024)
\2042 = NAND(\2006, \2025)
\2047 = NOT(\2026)
\2052 = NAND(\2036, \2014)
\2055 = NAND(\2037, \2016)
\2060 = NOT(\2038)
\2061 = NAND(\2039, \2022)
\2062 = NAND(\2040, \290)
\2067 = NOT(\2041)
\2068 = NOT(\2027)
\2071 = BUFF(\2027)
\2076 = NOT(\2052)
\2077 = NOT(\2055)
\2078 = NAND(\2060, \290)
\2081 = NAND(\2061, \290)
\2086 = NOT(\2042)
\2089 = BUFF(\2042)
\2104 = AND(\2030, \2068)
\2119 = AND(\2033, \2068)
\2129 = AND(\2030, \2071)
\2143 = AND(\2033, \2071)
\2148 = BUFF(\2062)
\2151 = BUFF(\2062)
\2196 = BUFF(\2078)
\2199 = BUFF(\2078)
\2202 = BUFF(\2081)
\2205 = BUFF(\2081)
\2214 = NAND(\2151, \915)
\2215 = NOT(\2151)
\2216 = NAND(\2148, \916)
\2217 = NOT(\2148)
\2222 = NAND(\2199, \1348)
\2223 = NOT(\2199)
\2224 = NAND(\2196, \1349)
\2225 = NOT(\2196)
\2226 = NAND(\2205, \913)
\2227 = NOT(\2205)
\2228 = NAND(\2202, \914)
\2229 = NOT(\2202)
\2230 = NAND(\667, \2215)
\2231 = NAND(\664, \2217)
\2232 = NAND(\1255, \2223)
\2233 = NAND(\1252, \2225)
\2234 = NAND(\661, \2227)
\2235 = NAND(\658, \2229)
\2236 = NAND(\2214, \2230)
\2237 = NAND(\2216, \2231)
\2240 = NAND(\2222, \2232)
\2241 = NAND(\2224, \2233)
\2244 = NAND(\2226, \2234)
\2245 = NAND(\2228, \2235)
\2250 = NOT(\2236)
\2253 = NOT(\2240)
\2256 = NOT(\2244)
\2257 = NOT(\2237)
\2260 = BUFF(\2237)
\2263 = NOT(\2241)
\2266 = AND(\1164, \2241)
\2269 = NOT(\2245)
\2272 = AND(\1168, \2245)
\2279 = NAND(\2067, \2012, \2047, \2250, \899, \2256, \2253, \903)
\2286 = BUFF(\2266)
\2297 = BUFF(\2266)
\2315 = BUFF(\2272)
\2326 = BUFF(\2272)
\2340 = AND(\2086, \2257)
\2353 = AND(\2089, \2257)
\2361 = AND(\2086, \2260)
\2375 = AND(\2089, \2260)
\2384 = AND(\338, \2279, \313, \313)
\2385 = AND(\1163, \2263)
\2386 = AND(\1164, \2263)
\2426 = AND(\1167, \2269)
\2427 = AND(\1168, \2269)
\2537 = NAND(\2286, \2315, \2361, \2104, \1171)
\2540 = NAND(\2286, \2315, \2340, \2129, \1171)
\2543 = NAND(\2286, \2315, \2340, \2119, \1171)
\2546 = NAND(\2286, \2315, \2353, \2104, \1171)
\2549 = NAND(\2297, \2315, \2375, \2119, \1188)
\2552 = NAND(\2297, \2326, \2361, \2143, \1188)
\2555 = NAND(\2297, \2326, \2375, \2129, \1188)
\2558 = AND(\2286, \2315, \2361, \2104, \1171)
\2561 = AND(\2286, \2315, \2340, \2129, \1171)
\2564 = AND(\2286, \2315, \2340, \2119, \1171)
\2567 = AND(\2286, \2315, \2353, \2104, \1171)
\2570 = AND(\2297, \2315, \2375, \2119, \1188)
\2573 = AND(\2297, \2326, \2361, \2143, \1188)
\2576 = AND(\2297, \2326, \2375, \2129, \1188)
\2594 = NAND(\2286, \2427, \2361, \2129, \1171)
\2597 = NAND(\2297, \2427, \2361, \2119, \1171)
\2600 = NAND(\2297, \2427, \2375, \2104, \1171)
\2603 = NAND(\2297, \2427, \2340, \2143, \1171)
\2606 = NAND(\2297, \2427, \2353, \2129, \1188)
\2611 = NAND(\2386, \2326, \2361, \2129, \1188)
\2614 = NAND(\2386, \2326, \2361, \2119, \1188)
\2617 = NAND(\2386, \2326, \2375, \2104, \1188)
\2620 = NAND(\2386, \2326, \2353, \2129, \1188)
\2627 = NAND(\2297, \2427, \2340, \2104, \926)
\2628 = NAND(\2386, \2326, \2340, \2104, \926)
\2629 = NAND(\2386, \2427, \2361, \2104, \926)
\2630 = NAND(\2386, \2427, \2340, \2129, \926)
\2631 = NAND(\2386, \2427, \2340, \2119, \926)
\2632 = NAND(\2386, \2427, \2353, \2104, \926)
\2633 = NAND(\2386, \2426, \2340, \2104, \926)
\2634 = NAND(\2385, \2427, \2340, \2104, \926)
\2639 = AND(\2286, \2427, \2361, \2129, \1171)
\2642 = AND(\2297, \2427, \2361, \2119, \1171)
\2645 = AND(\2297, \2427, \2375, \2104, \1171)
\2648 = AND(\2297, \2427, \2340, \2143, \1171)
\2651 = AND(\2297, \2427, \2353, \2129, \1188)
\2655 = AND(\2386, \2326, \2361, \2129, \1188)
\2658 = AND(\2386, \2326, \2361, \2119, \1188)
\2661 = AND(\2386, \2326, \2375, \2104, \1188)
\2664 = AND(\2386, \2326, \2353, \2129, \1188)
\2669 = NAND(\2558, \534)
\2670 = NOT(\2558)
\2671 = NAND(\2561, \535)
\2672 = NOT(\2561)
\2673 = NAND(\2564, \536)
\2674 = NOT(\2564)
\2675 = NAND(\2567, \537)
\2676 = NOT(\2567)
\2682 = NAND(\2570, \543)
\2683 = NOT(\2570)
\2688 = NAND(\2573, \548)
\2689 = NOT(\2573)
\2690 = NAND(\2576, \549)
\2691 = NOT(\2576)
\2710 = AND(\2627, \2628, \2629, \2630, \2631, \2632, \2633, \2634)
\2720 = NAND(\343, \2670)
\2721 = NAND(\346, \2672)
\2722 = NAND(\349, \2674)
\2723 = NAND(\352, \2676)
\2724 = NAND(\2639, \538)
\2725 = NOT(\2639)
\2726 = NAND(\2642, \539)
\2727 = NOT(\2642)
\2728 = NAND(\2645, \540)
\2729 = NOT(\2645)
\2730 = NAND(\2648, \541)
\2731 = NOT(\2648)
\2732 = NAND(\2651, \542)
\2733 = NOT(\2651)
\2734 = NAND(\370, \2683)
\2735 = NAND(\2655, \544)
\2736 = NOT(\2655)
\2737 = NAND(\2658, \545)
\2738 = NOT(\2658)
\2739 = NAND(\2661, \546)
\2740 = NOT(\2661)
\2741 = NAND(\2664, \547)
\2742 = NOT(\2664)
\2743 = NAND(\385, \2689)
\2744 = NAND(\388, \2691)
\2745 = NAND(\2537, \2540, \2543, \2546, \2594, \2597, \2600, \2603)
\2746 = NAND(\2606, \2549, \2611, \2614, \2617, \2620, \2552, \2555)
\2747 = AND(\2537, \2540, \2543, \2546, \2594, \2597, \2600, \2603)
\2750 = AND(\2606, \2549, \2611, \2614, \2617, \2620, \2552, \2555)
\2753 = NAND(\2669, \2720)
\2754 = NAND(\2671, \2721)
\2755 = NAND(\2673, \2722)
\2756 = NAND(\2675, \2723)
\2757 = NAND(\355, \2725)
\2758 = NAND(\358, \2727)
\2759 = NAND(\361, \2729)
\2760 = NAND(\364, \2731)
\2761 = NAND(\367, \2733)
\2762 = NAND(\2682, \2734)
\2763 = NAND(\373, \2736)
\2764 = NAND(\376, \2738)
\2765 = NAND(\379, \2740)
\2766 = NAND(\382, \2742)
\2767 = NAND(\2688, \2743)
\2768 = NAND(\2690, \2744)
\2773 = AND(\2745, \275)
\2776 = AND(\2746, \276)
\2779 = NAND(\2724, \2757)
\2780 = NAND(\2726, \2758)
\2781 = NAND(\2728, \2759)
\2782 = NAND(\2730, \2760)
\2783 = NAND(\2732, \2761)
\2784 = NAND(\2735, \2763)
\2785 = NAND(\2737, \2764)
\2786 = NAND(\2739, \2765)
\2787 = NAND(\2741, \2766)
\2788 = AND(\2747, \2750, \2710)
\2789 = NAND(\2747, \2750)
\2800 = AND(\338, \2279, \99, \2788)
\2807 = NAND(\2773, \2018)
\2808 = NOT(\2773)
\2809 = NAND(\2776, \2019)
\2810 = NOT(\2776)
\2811 = NOR(\2384, \2800)
\2812 = AND(\897, \283, \2789)
\2815 = AND(\76, \283, \2789)
\2818 = AND(\82, \283, \2789)
\2821 = AND(\85, \283, \2789)
\2824 = AND(\898, \283, \2789)
\2827 = NAND(\1965, \2808)
\2828 = NAND(\1968, \2810)
\2829 = AND(\79, \283, \2789)
\2843 = NAND(\2807, \2827)
\2846 = NAND(\2809, \2828)
\2850 = NAND(\2812, \2076)
\2851 = NAND(\2815, \2077)
\2852 = NAND(\2818, \1915)
\2853 = NAND(\2821, \1857)
\2854 = NAND(\2824, \1938)
\2857 = NOT(\2812)
\2858 = NOT(\2815)
\2859 = NOT(\2818)
\2860 = NOT(\2821)
\2861 = NOT(\2824)
\2862 = NOT(\2829)
\2863 = NAND(\2829, \1985)
\2866 = NAND(\2052, \2857)
\2867 = NAND(\2055, \2858)
\2868 = NAND(\1866, \2859)
\2869 = NAND(\1818, \2860)
\2870 = NAND(\1902, \2861)
\2871 = NAND(\2843, \886)
\2872 = NOT(\2843)
\2873 = NAND(\2846, \887)
\2874 = NOT(\2846)
\2875 = NAND(\1933, \2862)
\2876 = NAND(\2866, \2850)
\2877 = NAND(\2867, \2851)
\2878 = NAND(\2868, \2852)
\2879 = NAND(\2869, \2853)
\2880 = NAND(\2870, \2854)
\2881 = NAND(\682, \2872)
\2882 = NAND(\685, \2874)
\2883 = NAND(\2875, \2863)
\2886 = AND(\2876, \550)
\2887 = AND(\551, \2877)
\2888 = AND(\553, \2878)
\2889 = AND(\2879, \554)
\2890 = AND(\555, \2880)
\2891 = NAND(\2871, \2881)
\2892 = NAND(\2873, \2882)
\2895 = NAND(\2883, \1461)
\2896 = NOT(\2883)
\2897 = NAND(\1383, \2896)
\2898 = NAND(\2895, \2897)
\2899 = AND(\2898, \552)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,207 +0,0 @@
# c\432
INPUT(\1)
INPUT(\4)
INPUT(\8)
INPUT(\11)
INPUT(\14)
INPUT(\17)
INPUT(\21)
INPUT(\24)
INPUT(\27)
INPUT(\30)
INPUT(\34)
INPUT(\37)
INPUT(\40)
INPUT(\43)
INPUT(\47)
INPUT(\50)
INPUT(\53)
INPUT(\56)
INPUT(\60)
INPUT(\63)
INPUT(\66)
INPUT(\69)
INPUT(\73)
INPUT(\76)
INPUT(\79)
INPUT(\82)
INPUT(\86)
INPUT(\89)
INPUT(\92)
INPUT(\95)
INPUT(\99)
INPUT(\102)
INPUT(\105)
INPUT(\108)
INPUT(\112)
INPUT(\115)
OUTPUT(\223)
OUTPUT(\329)
OUTPUT(\370)
OUTPUT(\421)
OUTPUT(\430)
OUTPUT(\431)
OUTPUT(\432)
\118 = NOT(\1)
\119 = NOT(\4)
\122 = NOT(\11)
\123 = NOT(\17)
\126 = NOT(\24)
\127 = NOT(\30)
\130 = NOT(\37)
\131 = NOT(\43)
\134 = NOT(\50)
\135 = NOT(\56)
\138 = NOT(\63)
\139 = NOT(\69)
\142 = NOT(\76)
\143 = NOT(\82)
\146 = NOT(\89)
\147 = NOT(\95)
\150 = NOT(\102)
\151 = NOT(\108)
\154 = NAND(\118, \4)
\157 = NOR(\8, \119)
\158 = NOR(\14, \119)
\159 = NAND(\122, \17)
\162 = NAND(\126, \30)
\165 = NAND(\130, \43)
\168 = NAND(\134, \56)
\171 = NAND(\138, \69)
\174 = NAND(\142, \82)
\177 = NAND(\146, \95)
\180 = NAND(\150, \108)
\183 = NOR(\21, \123)
\184 = NOR(\27, \123)
\185 = NOR(\34, \127)
\186 = NOR(\40, \127)
\187 = NOR(\47, \131)
\188 = NOR(\53, \131)
\189 = NOR(\60, \135)
\190 = NOR(\66, \135)
\191 = NOR(\73, \139)
\192 = NOR(\79, \139)
\193 = NOR(\86, \143)
\194 = NOR(\92, \143)
\195 = NOR(\99, \147)
\196 = NOR(\105, \147)
\197 = NOR(\112, \151)
\198 = NOR(\115, \151)
\199 = AND(\154, \159, \162, \165, \168, \171, \174, \177, \180)
\203 = NOT(\199)
\213 = NOT(\199)
\223 = NOT(\199)
\224 = XOR(\203, \154)
\227 = XOR(\203, \159)
\230 = XOR(\203, \162)
\233 = XOR(\203, \165)
\236 = XOR(\203, \168)
\239 = XOR(\203, \171)
\242 = NAND(\1, \213)
\243 = XOR(\203, \174)
\246 = NAND(\213, \11)
\247 = XOR(\203, \177)
\250 = NAND(\213, \24)
\251 = XOR(\203, \180)
\254 = NAND(\213, \37)
\255 = NAND(\213, \50)
\256 = NAND(\213, \63)
\257 = NAND(\213, \76)
\258 = NAND(\213, \89)
\259 = NAND(\213, \102)
\260 = NAND(\224, \157)
\263 = NAND(\224, \158)
\264 = NAND(\227, \183)
\267 = NAND(\230, \185)
\270 = NAND(\233, \187)
\273 = NAND(\236, \189)
\276 = NAND(\239, \191)
\279 = NAND(\243, \193)
\282 = NAND(\247, \195)
\285 = NAND(\251, \197)
\288 = NAND(\227, \184)
\289 = NAND(\230, \186)
\290 = NAND(\233, \188)
\291 = NAND(\236, \190)
\292 = NAND(\239, \192)
\293 = NAND(\243, \194)
\294 = NAND(\247, \196)
\295 = NAND(\251, \198)
\296 = AND(\260, \264, \267, \270, \273, \276, \279, \282, \285)
\300 = NOT(\263)
\301 = NOT(\288)
\302 = NOT(\289)
\303 = NOT(\290)
\304 = NOT(\291)
\305 = NOT(\292)
\306 = NOT(\293)
\307 = NOT(\294)
\308 = NOT(\295)
\309 = NOT(\296)
\319 = NOT(\296)
\329 = NOT(\296)
\330 = XOR(\309, \260)
\331 = XOR(\309, \264)
\332 = XOR(\309, \267)
\333 = XOR(\309, \270)
\334 = NAND(\8, \319)
\335 = XOR(\309, \273)
\336 = NAND(\319, \21)
\337 = XOR(\309, \276)
\338 = NAND(\319, \34)
\339 = XOR(\309, \279)
\340 = NAND(\319, \47)
\341 = XOR(\309, \282)
\342 = NAND(\319, \60)
\343 = XOR(\309, \285)
\344 = NAND(\319, \73)
\345 = NAND(\319, \86)
\346 = NAND(\319, \99)
\347 = NAND(\319, \112)
\348 = NAND(\330, \300)
\349 = NAND(\331, \301)
\350 = NAND(\332, \302)
\351 = NAND(\333, \303)
\352 = NAND(\335, \304)
\353 = NAND(\337, \305)
\354 = NAND(\339, \306)
\355 = NAND(\341, \307)
\356 = NAND(\343, \308)
\357 = AND(\348, \349, \350, \351, \352, \353, \354, \355, \356)
\360 = NOT(\357)
\370 = NOT(\357)
\371 = NAND(\14, \360)
\372 = NAND(\360, \27)
\373 = NAND(\360, \40)
\374 = NAND(\360, \53)
\375 = NAND(\360, \66)
\376 = NAND(\360, \79)
\377 = NAND(\360, \92)
\378 = NAND(\360, \105)
\379 = NAND(\360, \115)
\380 = NAND(\4, \242, \334, \371)
\381 = NAND(\246, \336, \372, \17)
\386 = NAND(\250, \338, \373, \30)
\393 = NAND(\254, \340, \374, \43)
\399 = NAND(\255, \342, \375, \56)
\404 = NAND(\256, \344, \376, \69)
\407 = NAND(\257, \345, \377, \82)
\411 = NAND(\258, \346, \378, \95)
\414 = NAND(\259, \347, \379, \108)
\415 = NOT(\380)
\416 = AND(\381, \386, \393, \399, \404, \407, \411, \414)
\417 = NOT(\393)
\418 = NOT(\404)
\419 = NOT(\407)
\420 = NOT(\411)
\421 = NOR(\415, \416)
\422 = NAND(\386, \417)
\425 = NAND(\386, \393, \418, \399)
\428 = NAND(\399, \393, \419)
\429 = NAND(\386, \393, \407, \420)
\430 = NAND(\381, \386, \422, \399)
\431 = NAND(\381, \386, \425, \428)
\432 = NAND(\381, \422, \425, \429)

View File

@ -1,279 +0,0 @@
# c\499
INPUT(\1)
INPUT(\5)
INPUT(\9)
INPUT(\13)
INPUT(\17)
INPUT(\21)
INPUT(\25)
INPUT(\29)
INPUT(\33)
INPUT(\37)
INPUT(\41)
INPUT(\45)
INPUT(\49)
INPUT(\53)
INPUT(\57)
INPUT(\61)
INPUT(\65)
INPUT(\69)
INPUT(\73)
INPUT(\77)
INPUT(\81)
INPUT(\85)
INPUT(\89)
INPUT(\93)
INPUT(\97)
INPUT(\101)
INPUT(\105)
INPUT(\109)
INPUT(\113)
INPUT(\117)
INPUT(\121)
INPUT(\125)
INPUT(\129)
INPUT(\130)
INPUT(\131)
INPUT(\132)
INPUT(\133)
INPUT(\134)
INPUT(\135)
INPUT(\136)
INPUT(\137)
OUTPUT(\724)
OUTPUT(\725)
OUTPUT(\726)
OUTPUT(\727)
OUTPUT(\728)
OUTPUT(\729)
OUTPUT(\730)
OUTPUT(\731)
OUTPUT(\732)
OUTPUT(\733)
OUTPUT(\734)
OUTPUT(\735)
OUTPUT(\736)
OUTPUT(\737)
OUTPUT(\738)
OUTPUT(\739)
OUTPUT(\740)
OUTPUT(\741)
OUTPUT(\742)
OUTPUT(\743)
OUTPUT(\744)
OUTPUT(\745)
OUTPUT(\746)
OUTPUT(\747)
OUTPUT(\748)
OUTPUT(\749)
OUTPUT(\750)
OUTPUT(\751)
OUTPUT(\752)
OUTPUT(\753)
OUTPUT(\754)
OUTPUT(\755)
\250 = XOR(\1, \5)
\251 = XOR(\9, \13)
\252 = XOR(\17, \21)
\253 = XOR(\25, \29)
\254 = XOR(\33, \37)
\255 = XOR(\41, \45)
\256 = XOR(\49, \53)
\257 = XOR(\57, \61)
\258 = XOR(\65, \69)
\259 = XOR(\73, \77)
\260 = XOR(\81, \85)
\261 = XOR(\89, \93)
\262 = XOR(\97, \101)
\263 = XOR(\105, \109)
\264 = XOR(\113, \117)
\265 = XOR(\121, \125)
\266 = AND(\129, \137)
\267 = AND(\130, \137)
\268 = AND(\131, \137)
\269 = AND(\132, \137)
\270 = AND(\133, \137)
\271 = AND(\134, \137)
\272 = AND(\135, \137)
\273 = AND(\136, \137)
\274 = XOR(\1, \17)
\275 = XOR(\33, \49)
\276 = XOR(\5, \21)
\277 = XOR(\37, \53)
\278 = XOR(\9, \25)
\279 = XOR(\41, \57)
\280 = XOR(\13, \29)
\281 = XOR(\45, \61)
\282 = XOR(\65, \81)
\283 = XOR(\97, \113)
\284 = XOR(\69, \85)
\285 = XOR(\101, \117)
\286 = XOR(\73, \89)
\287 = XOR(\105, \121)
\288 = XOR(\77, \93)
\289 = XOR(\109, \125)
\290 = XOR(\250, \251)
\293 = XOR(\252, \253)
\296 = XOR(\254, \255)
\299 = XOR(\256, \257)
\302 = XOR(\258, \259)
\305 = XOR(\260, \261)
\308 = XOR(\262, \263)
\311 = XOR(\264, \265)
\314 = XOR(\274, \275)
\315 = XOR(\276, \277)
\316 = XOR(\278, \279)
\317 = XOR(\280, \281)
\318 = XOR(\282, \283)
\319 = XOR(\284, \285)
\320 = XOR(\286, \287)
\321 = XOR(\288, \289)
\338 = XOR(\290, \293)
\339 = XOR(\296, \299)
\340 = XOR(\290, \296)
\341 = XOR(\293, \299)
\342 = XOR(\302, \305)
\343 = XOR(\308, \311)
\344 = XOR(\302, \308)
\345 = XOR(\305, \311)
\346 = XOR(\266, \342)
\347 = XOR(\267, \343)
\348 = XOR(\268, \344)
\349 = XOR(\269, \345)
\350 = XOR(\270, \338)
\351 = XOR(\271, \339)
\352 = XOR(\272, \340)
\353 = XOR(\273, \341)
\354 = XOR(\314, \346)
\367 = XOR(\315, \347)
\380 = XOR(\316, \348)
\393 = XOR(\317, \349)
\406 = XOR(\318, \350)
\419 = XOR(\319, \351)
\432 = XOR(\320, \352)
\445 = XOR(\321, \353)
\554 = NOT(\354)
\555 = NOT(\367)
\556 = NOT(\380)
\557 = NOT(\354)
\558 = NOT(\367)
\559 = NOT(\393)
\560 = NOT(\354)
\561 = NOT(\380)
\562 = NOT(\393)
\563 = NOT(\367)
\564 = NOT(\380)
\565 = NOT(\393)
\566 = NOT(\419)
\567 = NOT(\445)
\568 = NOT(\419)
\569 = NOT(\432)
\570 = NOT(\406)
\571 = NOT(\445)
\572 = NOT(\406)
\573 = NOT(\432)
\574 = NOT(\406)
\575 = NOT(\419)
\576 = NOT(\432)
\577 = NOT(\406)
\578 = NOT(\419)
\579 = NOT(\445)
\580 = NOT(\406)
\581 = NOT(\432)
\582 = NOT(\445)
\583 = NOT(\419)
\584 = NOT(\432)
\585 = NOT(\445)
\586 = NOT(\367)
\587 = NOT(\393)
\588 = NOT(\367)
\589 = NOT(\380)
\590 = NOT(\354)
\591 = NOT(\393)
\592 = NOT(\354)
\593 = NOT(\380)
\594 = AND(\554, \555, \556, \393)
\595 = AND(\557, \558, \380, \559)
\596 = AND(\560, \367, \561, \562)
\597 = AND(\354, \563, \564, \565)
\598 = AND(\574, \575, \576, \445)
\599 = AND(\577, \578, \432, \579)
\600 = AND(\580, \419, \581, \582)
\601 = AND(\406, \583, \584, \585)
\602 = OR(\594, \595, \596, \597)
\607 = OR(\598, \599, \600, \601)
\620 = AND(\406, \566, \432, \567, \602)
\625 = AND(\406, \568, \569, \445, \602)
\630 = AND(\570, \419, \432, \571, \602)
\635 = AND(\572, \419, \573, \445, \602)
\640 = AND(\354, \586, \380, \587, \607)
\645 = AND(\354, \588, \589, \393, \607)
\650 = AND(\590, \367, \380, \591, \607)
\655 = AND(\592, \367, \593, \393, \607)
\692 = AND(\354, \620)
\693 = AND(\367, \620)
\694 = AND(\380, \620)
\695 = AND(\393, \620)
\696 = AND(\354, \625)
\697 = AND(\367, \625)
\698 = AND(\380, \625)
\699 = AND(\393, \625)
\700 = AND(\354, \630)
\701 = AND(\367, \630)
\702 = AND(\380, \630)
\703 = AND(\393, \630)
\704 = AND(\354, \635)
\705 = AND(\367, \635)
\706 = AND(\380, \635)
\707 = AND(\393, \635)
\708 = AND(\406, \640)
\709 = AND(\419, \640)
\710 = AND(\432, \640)
\711 = AND(\445, \640)
\712 = AND(\406, \645)
\713 = AND(\419, \645)
\714 = AND(\432, \645)
\715 = AND(\445, \645)
\716 = AND(\406, \650)
\717 = AND(\419, \650)
\718 = AND(\432, \650)
\719 = AND(\445, \650)
\720 = AND(\406, \655)
\721 = AND(\419, \655)
\722 = AND(\432, \655)
\723 = AND(\445, \655)
\724 = XOR(\1, \692)
\725 = XOR(\5, \693)
\726 = XOR(\9, \694)
\727 = XOR(\13, \695)
\728 = XOR(\17, \696)
\729 = XOR(\21, \697)
\730 = XOR(\25, \698)
\731 = XOR(\29, \699)
\732 = XOR(\33, \700)
\733 = XOR(\37, \701)
\734 = XOR(\41, \702)
\735 = XOR(\45, \703)
\736 = XOR(\49, \704)
\737 = XOR(\53, \705)
\738 = XOR(\57, \706)
\739 = XOR(\61, \707)
\740 = XOR(\65, \708)
\741 = XOR(\69, \709)
\742 = XOR(\73, \710)
\743 = XOR(\77, \711)
\744 = XOR(\81, \712)
\745 = XOR(\85, \713)
\746 = XOR(\89, \714)
\747 = XOR(\93, \715)
\748 = XOR(\97, \716)
\749 = XOR(\101, \717)
\750 = XOR(\105, \718)
\751 = XOR(\109, \719)
\752 = XOR(\113, \720)
\753 = XOR(\117, \721)
\754 = XOR(\121, \722)
\755 = XOR(\125, \723)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,473 +0,0 @@
# c\880
INPUT(\1)
INPUT(\8)
INPUT(\13)
INPUT(\17)
INPUT(\26)
INPUT(\29)
INPUT(\36)
INPUT(\42)
INPUT(\51)
INPUT(\55)
INPUT(\59)
INPUT(\68)
INPUT(\72)
INPUT(\73)
INPUT(\74)
INPUT(\75)
INPUT(\80)
INPUT(\85)
INPUT(\86)
INPUT(\87)
INPUT(\88)
INPUT(\89)
INPUT(\90)
INPUT(\91)
INPUT(\96)
INPUT(\101)
INPUT(\106)
INPUT(\111)
INPUT(\116)
INPUT(\121)
INPUT(\126)
INPUT(\130)
INPUT(\135)
INPUT(\138)
INPUT(\143)
INPUT(\146)
INPUT(\149)
INPUT(\152)
INPUT(\153)
INPUT(\156)
INPUT(\159)
INPUT(\165)
INPUT(\171)
INPUT(\177)
INPUT(\183)
INPUT(\189)
INPUT(\195)
INPUT(\201)
INPUT(\207)
INPUT(\210)
INPUT(\219)
INPUT(\228)
INPUT(\237)
INPUT(\246)
INPUT(\255)
INPUT(\259)
INPUT(\260)
INPUT(\261)
INPUT(\267)
INPUT(\268)
OUTPUT(\388)
OUTPUT(\389)
OUTPUT(\390)
OUTPUT(\391)
OUTPUT(\418)
OUTPUT(\419)
OUTPUT(\420)
OUTPUT(\421)
OUTPUT(\422)
OUTPUT(\423)
OUTPUT(\446)
OUTPUT(\447)
OUTPUT(\448)
OUTPUT(\449)
OUTPUT(\450)
OUTPUT(\767)
OUTPUT(\768)
OUTPUT(\850)
OUTPUT(\863)
OUTPUT(\864)
OUTPUT(\865)
OUTPUT(\866)
OUTPUT(\874)
OUTPUT(\878)
OUTPUT(\879)
OUTPUT(\880)
\269 = NAND(\1, \8, \13, \17)
\270 = NAND(\1, \26, \13, \17)
\273 = AND(\29, \36, \42)
\276 = AND(\1, \26, \51)
\279 = NAND(\1, \8, \51, \17)
\280 = NAND(\1, \8, \13, \55)
\284 = NAND(\59, \42, \68, \72)
\285 = NAND(\29, \68)
\286 = NAND(\59, \68, \74)
\287 = AND(\29, \75, \80)
\290 = AND(\29, \75, \42)
\291 = AND(\29, \36, \80)
\292 = AND(\29, \36, \42)
\293 = AND(\59, \75, \80)
\294 = AND(\59, \75, \42)
\295 = AND(\59, \36, \80)
\296 = AND(\59, \36, \42)
\297 = AND(\85, \86)
\298 = OR(\87, \88)
\301 = NAND(\91, \96)
\302 = OR(\91, \96)
\303 = NAND(\101, \106)
\304 = OR(\101, \106)
\305 = NAND(\111, \116)
\306 = OR(\111, \116)
\307 = NAND(\121, \126)
\308 = OR(\121, \126)
\309 = AND(\8, \138)
\310 = NOT(\268)
\316 = AND(\51, \138)
\317 = AND(\17, \138)
\318 = AND(\152, \138)
\319 = NAND(\59, \156)
\322 = NOR(\17, \42)
\323 = AND(\17, \42)
\324 = NAND(\159, \165)
\325 = OR(\159, \165)
\326 = NAND(\171, \177)
\327 = OR(\171, \177)
\328 = NAND(\183, \189)
\329 = OR(\183, \189)
\330 = NAND(\195, \201)
\331 = OR(\195, \201)
\332 = AND(\210, \91)
\333 = AND(\210, \96)
\334 = AND(\210, \101)
\335 = AND(\210, \106)
\336 = AND(\210, \111)
\337 = AND(\255, \259)
\338 = AND(\210, \116)
\339 = AND(\255, \260)
\340 = AND(\210, \121)
\341 = AND(\255, \267)
\342 = NOT(\269)
\343 = NOT(\273)
\344 = OR(\270, \273)
\345 = NOT(\276)
\346 = NOT(\276)
\347 = NOT(\279)
\348 = NOR(\280, \284)
\349 = OR(\280, \285)
\350 = OR(\280, \286)
\351 = NOT(\293)
\352 = NOT(\294)
\353 = NOT(\295)
\354 = NOT(\296)
\355 = NAND(\89, \298)
\356 = AND(\90, \298)
\357 = NAND(\301, \302)
\360 = NAND(\303, \304)
\363 = NAND(\305, \306)
\366 = NAND(\307, \308)
\369 = NOT(\310)
\375 = NOR(\322, \323)
\376 = NAND(\324, \325)
\379 = NAND(\326, \327)
\382 = NAND(\328, \329)
\385 = NAND(\330, \331)
\388 = BUFF(\290)
\389 = BUFF(\291)
\390 = BUFF(\292)
\391 = BUFF(\297)
\392 = OR(\270, \343)
\393 = NOT(\345)
\399 = NOT(\346)
\400 = AND(\348, \73)
\401 = NOT(\349)
\402 = NOT(\350)
\403 = NOT(\355)
\404 = NOT(\357)
\405 = NOT(\360)
\406 = AND(\357, \360)
\407 = NOT(\363)
\408 = NOT(\366)
\409 = AND(\363, \366)
\410 = NAND(\347, \352)
\411 = NOT(\376)
\412 = NOT(\379)
\413 = AND(\376, \379)
\414 = NOT(\382)
\415 = NOT(\385)
\416 = AND(\382, \385)
\417 = AND(\210, \369)
\418 = BUFF(\342)
\419 = BUFF(\344)
\420 = BUFF(\351)
\421 = BUFF(\353)
\422 = BUFF(\354)
\423 = BUFF(\356)
\424 = NOT(\400)
\425 = AND(\404, \405)
\426 = AND(\407, \408)
\427 = AND(\319, \393, \55)
\432 = AND(\393, \17, \287)
\437 = NAND(\393, \287, \55)
\442 = NAND(\375, \59, \156, \393)
\443 = NAND(\393, \319, \17)
\444 = AND(\411, \412)
\445 = AND(\414, \415)
\446 = BUFF(\392)
\447 = BUFF(\399)
\448 = BUFF(\401)
\449 = BUFF(\402)
\450 = BUFF(\403)
\451 = NOT(\424)
\460 = NOR(\406, \425)
\463 = NOR(\409, \426)
\466 = NAND(\442, \410)
\475 = AND(\143, \427)
\476 = AND(\310, \432)
\477 = AND(\146, \427)
\478 = AND(\310, \432)
\479 = AND(\149, \427)
\480 = AND(\310, \432)
\481 = AND(\153, \427)
\482 = AND(\310, \432)
\483 = NAND(\443, \1)
\488 = OR(\369, \437)
\489 = OR(\369, \437)
\490 = OR(\369, \437)
\491 = OR(\369, \437)
\492 = NOR(\413, \444)
\495 = NOR(\416, \445)
\498 = NAND(\130, \460)
\499 = OR(\130, \460)
\500 = NAND(\463, \135)
\501 = OR(\463, \135)
\502 = AND(\91, \466)
\503 = NOR(\475, \476)
\504 = AND(\96, \466)
\505 = NOR(\477, \478)
\506 = AND(\101, \466)
\507 = NOR(\479, \480)
\508 = AND(\106, \466)
\509 = NOR(\481, \482)
\510 = AND(\143, \483)
\511 = AND(\111, \466)
\512 = AND(\146, \483)
\513 = AND(\116, \466)
\514 = AND(\149, \483)
\515 = AND(\121, \466)
\516 = AND(\153, \483)
\517 = AND(\126, \466)
\518 = NAND(\130, \492)
\519 = OR(\130, \492)
\520 = NAND(\495, \207)
\521 = OR(\495, \207)
\522 = AND(\451, \159)
\523 = AND(\451, \165)
\524 = AND(\451, \171)
\525 = AND(\451, \177)
\526 = AND(\451, \183)
\527 = NAND(\451, \189)
\528 = NAND(\451, \195)
\529 = NAND(\451, \201)
\530 = NAND(\498, \499)
\533 = NAND(\500, \501)
\536 = NOR(\309, \502)
\537 = NOR(\316, \504)
\538 = NOR(\317, \506)
\539 = NOR(\318, \508)
\540 = NOR(\510, \511)
\541 = NOR(\512, \513)
\542 = NOR(\514, \515)
\543 = NOR(\516, \517)
\544 = NAND(\518, \519)
\547 = NAND(\520, \521)
\550 = NOT(\530)
\551 = NOT(\533)
\552 = AND(\530, \533)
\553 = NAND(\536, \503)
\557 = NAND(\537, \505)
\561 = NAND(\538, \507)
\565 = NAND(\539, \509)
\569 = NAND(\488, \540)
\573 = NAND(\489, \541)
\577 = NAND(\490, \542)
\581 = NAND(\491, \543)
\585 = NOT(\544)
\586 = NOT(\547)
\587 = AND(\544, \547)
\588 = AND(\550, \551)
\589 = AND(\585, \586)
\590 = NAND(\553, \159)
\593 = OR(\553, \159)
\596 = AND(\246, \553)
\597 = NAND(\557, \165)
\600 = OR(\557, \165)
\605 = AND(\246, \557)
\606 = NAND(\561, \171)
\609 = OR(\561, \171)
\615 = AND(\246, \561)
\616 = NAND(\565, \177)
\619 = OR(\565, \177)
\624 = AND(\246, \565)
\625 = NAND(\569, \183)
\628 = OR(\569, \183)
\631 = AND(\246, \569)
\632 = NAND(\573, \189)
\635 = OR(\573, \189)
\640 = AND(\246, \573)
\641 = NAND(\577, \195)
\644 = OR(\577, \195)
\650 = AND(\246, \577)
\651 = NAND(\581, \201)
\654 = OR(\581, \201)
\659 = AND(\246, \581)
\660 = NOR(\552, \588)
\661 = NOR(\587, \589)
\662 = NOT(\590)
\665 = AND(\593, \590)
\669 = NOR(\596, \522)
\670 = NOT(\597)
\673 = AND(\600, \597)
\677 = NOR(\605, \523)
\678 = NOT(\606)
\682 = AND(\609, \606)
\686 = NOR(\615, \524)
\687 = NOT(\616)
\692 = AND(\619, \616)
\696 = NOR(\624, \525)
\697 = NOT(\625)
\700 = AND(\628, \625)
\704 = NOR(\631, \526)
\705 = NOT(\632)
\708 = AND(\635, \632)
\712 = NOR(\337, \640)
\713 = NOT(\641)
\717 = AND(\644, \641)
\721 = NOR(\339, \650)
\722 = NOT(\651)
\727 = AND(\654, \651)
\731 = NOR(\341, \659)
\732 = NAND(\654, \261)
\733 = NAND(\644, \654, \261)
\734 = NAND(\635, \644, \654, \261)
\735 = NOT(\662)
\736 = AND(\228, \665)
\737 = AND(\237, \662)
\738 = NOT(\670)
\739 = AND(\228, \673)
\740 = AND(\237, \670)
\741 = NOT(\678)
\742 = AND(\228, \682)
\743 = AND(\237, \678)
\744 = NOT(\687)
\745 = AND(\228, \692)
\746 = AND(\237, \687)
\747 = NOT(\697)
\748 = AND(\228, \700)
\749 = AND(\237, \697)
\750 = NOT(\705)
\751 = AND(\228, \708)
\752 = AND(\237, \705)
\753 = NOT(\713)
\754 = AND(\228, \717)
\755 = AND(\237, \713)
\756 = NOT(\722)
\757 = NOR(\727, \261)
\758 = AND(\727, \261)
\759 = AND(\228, \727)
\760 = AND(\237, \722)
\761 = NAND(\644, \722)
\762 = NAND(\635, \713)
\763 = NAND(\635, \644, \722)
\764 = NAND(\609, \687)
\765 = NAND(\600, \678)
\766 = NAND(\600, \609, \687)
\767 = BUFF(\660)
\768 = BUFF(\661)
\769 = NOR(\736, \737)
\770 = NOR(\739, \740)
\771 = NOR(\742, \743)
\772 = NOR(\745, \746)
\773 = NAND(\750, \762, \763, \734)
\777 = NOR(\748, \749)
\778 = NAND(\753, \761, \733)
\781 = NOR(\751, \752)
\782 = NAND(\756, \732)
\785 = NOR(\754, \755)
\786 = NOR(\757, \758)
\787 = NOR(\759, \760)
\788 = NOR(\700, \773)
\789 = AND(\700, \773)
\790 = NOR(\708, \778)
\791 = AND(\708, \778)
\792 = NOR(\717, \782)
\793 = AND(\717, \782)
\794 = AND(\219, \786)
\795 = NAND(\628, \773)
\796 = NAND(\795, \747)
\802 = NOR(\788, \789)
\803 = NOR(\790, \791)
\804 = NOR(\792, \793)
\805 = NOR(\340, \794)
\806 = NOR(\692, \796)
\807 = AND(\692, \796)
\808 = AND(\219, \802)
\809 = AND(\219, \803)
\810 = AND(\219, \804)
\811 = NAND(\805, \787, \731, \529)
\812 = NAND(\619, \796)
\813 = NAND(\609, \619, \796)
\814 = NAND(\600, \609, \619, \796)
\815 = NAND(\738, \765, \766, \814)
\819 = NAND(\741, \764, \813)
\822 = NAND(\744, \812)
\825 = NOR(\806, \807)
\826 = NOR(\335, \808)
\827 = NOR(\336, \809)
\828 = NOR(\338, \810)
\829 = NOT(\811)
\830 = NOR(\665, \815)
\831 = AND(\665, \815)
\832 = NOR(\673, \819)
\833 = AND(\673, \819)
\834 = NOR(\682, \822)
\835 = AND(\682, \822)
\836 = AND(\219, \825)
\837 = NAND(\826, \777, \704)
\838 = NAND(\827, \781, \712, \527)
\839 = NAND(\828, \785, \721, \528)
\840 = NOT(\829)
\841 = NAND(\815, \593)
\842 = NOR(\830, \831)
\843 = NOR(\832, \833)
\844 = NOR(\834, \835)
\845 = NOR(\334, \836)
\846 = NOT(\837)
\847 = NOT(\838)
\848 = NOT(\839)
\849 = AND(\735, \841)
\850 = BUFF(\840)
\851 = AND(\219, \842)
\852 = AND(\219, \843)
\853 = AND(\219, \844)
\854 = NAND(\845, \772, \696)
\855 = NOT(\846)
\856 = NOT(\847)
\857 = NOT(\848)
\858 = NOT(\849)
\859 = NOR(\417, \851)
\860 = NOR(\332, \852)
\861 = NOR(\333, \853)
\862 = NOT(\854)
\863 = BUFF(\855)
\864 = BUFF(\856)
\865 = BUFF(\857)
\866 = BUFF(\858)
\867 = NAND(\859, \769, \669)
\868 = NAND(\860, \770, \677)
\869 = NAND(\861, \771, \686)
\870 = NOT(\862)
\871 = NOT(\867)
\872 = NOT(\868)
\873 = NOT(\869)
\874 = BUFF(\870)
\875 = NOT(\871)
\876 = NOT(\872)
\877 = NOT(\873)
\878 = BUFF(\875)
\879 = BUFF(\876)
\880 = BUFF(\877)

View File

@ -1,604 +0,0 @@
// Benchmark "c2670" written by ABC on Sun Jan 8 23:46:44 2023
module c2670 (
\1 , \2 , \3 , \4 , \5 , \6 , \7 , \8 , \11 , \14 , \15 , \16 , \19 ,
\20 , \21 , \22 , \23 , \24 , \25 , \26 , \27 , \28 , \29 , \32 , \33 ,
\34 , \35 , \36 , \37 , \40 , \43 , \44 , \47 , \48 , \49 , \50 , \51 ,
\52 , \53 , \54 , \55 , \56 , \57 , \60 , \61 , \62 , \63 , \64 , \65 ,
\66 , \67 , \68 , \69 , \72 , \73 , \74 , \75 , \76 , \77 , \78 , \79 ,
\80 , \81 , \82 , \85 , \86 , \87 , \88 , \89 , \90 , \91 , \92 , \93 ,
\94 , \95 , \96 , \99 , \100 , \101 , \102 , \103 , \104 , \105 ,
\106 , \107 , \108 , \111 , \112 , \113 , \114 , \115 , \116 , \117 ,
\118 , \119 , \120 , \123 , \124 , \125 , \126 , \127 , \128 , \129 ,
\130 , \131 , \132 , \135 , \136 , \137 , \138 , \139 , \140 , \141 ,
\142 , \143 , \144 , \145 , \146 , \147 , \148 , \149 , \150 , \151 ,
\152 , \153 , \154 , \155 , \156 , \157 , \158 , \159 , \160 , \161 ,
\162 , \163 , \164 , \165 , \166 , \167 , \168 , \169 , \170 , \171 ,
\172 , \173 , \174 , \175 , \176 , \177 , \178 , \179 , \180 , \181 ,
\182 , \183 , \184 , \185 , \186 , \187 , \188 , \189 , \190 , \191 ,
\192 , \193 , \194 , \195 , \196 , \197 , \198 , \199 , \200 , \201 ,
\202 , \203 , \204 , \205 , \206 , \207 , \208 , \209 , \210 , \211 ,
\212 , \213 , \214 , \215 , \216 , \217 , \218 , \219 , \224 , \227 ,
\230 , \231 , \234 , \237 , \241 , \246 , \253 , \256 , \259 , \262 ,
\263 , \266 , \269 , \272 , \275 , \278 , \281 , \284 , \287 , \290 ,
\294 , \297 , \301 , \305 , \309 , \313 , \316 , \319 , \322 , \325 ,
\328 , \331 , \334 , \337 , \340 , \343 , \346 , \349 , \352 , \355 ,
\398 , \400 , \401 , \419 , \420 , \456 , \457 , \458 , \487 , \488 ,
\489 , \490 , \491 , \492 , \493 , \494 , \792 , \799 , \805 , \1026 ,
\1028 , \1029 , \1269 , \1277 , \1448 , \1726 , \1816 , \1817 , \1818 ,
\1819 , \1820 , \1821 , \1969 , \1970 , \1971 , \2010 , \2012 , \2014 ,
\2016 , \2018 , \2020 , \2022 , \2387 , \2388 , \2389 , \2390 , \2496 ,
\2643 , \2644 , \2891 , \2925 , \2970 , \2971 , \3038 , \3079 , \3546 ,
\3671 , \3803 , \3804 , \3809 , \3851 , \3875 , \3881 , \3882 );
input \1 , \2 , \3 , \4 , \5 , \6 , \7 , \8 , \11 , \14 , \15 , \16 ,
\19 , \20 , \21 , \22 , \23 , \24 , \25 , \26 , \27 , \28 , \29 , \32 ,
\33 , \34 , \35 , \36 , \37 , \40 , \43 , \44 , \47 , \48 , \49 , \50 ,
\51 , \52 , \53 , \54 , \55 , \56 , \57 , \60 , \61 , \62 , \63 , \64 ,
\65 , \66 , \67 , \68 , \69 , \72 , \73 , \74 , \75 , \76 , \77 , \78 ,
\79 , \80 , \81 , \82 , \85 , \86 , \87 , \88 , \89 , \90 , \91 , \92 ,
\93 , \94 , \95 , \96 , \99 , \100 , \101 , \102 , \103 , \104 , \105 ,
\106 , \107 , \108 , \111 , \112 , \113 , \114 , \115 , \116 , \117 ,
\118 , \119 , \120 , \123 , \124 , \125 , \126 , \127 , \128 , \129 ,
\130 , \131 , \132 , \135 , \136 , \137 , \138 , \139 , \140 , \141 ,
\142 , \143 , \144 , \145 , \146 , \147 , \148 , \149 , \150 , \151 ,
\152 , \153 , \154 , \155 , \156 , \157 , \158 , \159 , \160 , \161 ,
\162 , \163 , \164 , \165 , \166 , \167 , \168 , \169 , \170 , \171 ,
\172 , \173 , \174 , \175 , \176 , \177 , \178 , \179 , \180 , \181 ,
\182 , \183 , \184 , \185 , \186 , \187 , \188 , \189 , \190 , \191 ,
\192 , \193 , \194 , \195 , \196 , \197 , \198 , \199 , \200 , \201 ,
\202 , \203 , \204 , \205 , \206 , \207 , \208 , \209 , \210 , \211 ,
\212 , \213 , \214 , \215 , \216 , \217 , \218 , \219 , \224 , \227 ,
\230 , \231 , \234 , \237 , \241 , \246 , \253 , \256 , \259 , \262 ,
\263 , \266 , \269 , \272 , \275 , \278 , \281 , \284 , \287 , \290 ,
\294 , \297 , \301 , \305 , \309 , \313 , \316 , \319 , \322 , \325 ,
\328 , \331 , \334 , \337 , \340 , \343 , \346 , \349 , \352 , \355 ;
output \398 , \400 , \401 , \419 , \420 , \456 , \457 , \458 , \487 , \488 ,
\489 , \490 , \491 , \492 , \493 , \494 , \792 , \799 , \805 , \1026 ,
\1028 , \1029 , \1269 , \1277 , \1448 , \1726 , \1816 , \1817 , \1818 ,
\1819 , \1820 , \1821 , \1969 , \1970 , \1971 , \2010 , \2012 , \2014 ,
\2016 , \2018 , \2020 , \2022 , \2387 , \2388 , \2389 , \2390 , \2496 ,
\2643 , \2644 , \2891 , \2925 , \2970 , \2971 , \3038 , \3079 , \3546 ,
\3671 , \3803 , \3804 , \3809 , \3851 , \3875 , \3881 , \3882 ;
wire new_n388_, new_n389_, new_n392_, new_n393_, new_n394_, new_n396_,
new_n397_, new_n398_, new_n399_, new_n400_, new_n401_, new_n403_,
new_n404_, new_n405_, new_n406_, new_n407_, new_n409_, new_n410_,
new_n411_, new_n412_, new_n413_, new_n415_, new_n416_, new_n417_,
new_n418_, new_n419_, new_n420_, new_n423_, new_n424_, new_n425_,
new_n426_, new_n429_, new_n430_, new_n431_, new_n432_, new_n435_,
new_n436_, new_n437_, new_n438_, new_n439_, new_n440_, new_n443_,
new_n445_, new_n446_, new_n447_, new_n448_, new_n450_, new_n451_,
new_n452_, new_n453_, new_n455_, new_n456_, new_n457_, new_n458_,
new_n460_, new_n461_, new_n462_, new_n463_, new_n465_, new_n466_,
new_n467_, new_n468_, new_n469_, new_n470_, new_n471_, new_n472_,
new_n474_, new_n475_, new_n477_, new_n478_, new_n479_, new_n481_,
new_n482_, new_n484_, new_n485_, new_n486_, new_n487_, new_n488_,
new_n489_, new_n490_, new_n491_, new_n492_, new_n493_, new_n494_,
new_n495_, new_n496_, new_n497_, new_n499_, new_n500_, new_n501_,
new_n502_, new_n503_, new_n504_, new_n505_, new_n506_, new_n507_,
new_n508_, new_n509_, new_n510_, new_n511_, new_n512_, new_n513_,
new_n514_, new_n515_, new_n517_, new_n518_, new_n519_, new_n520_,
new_n521_, new_n522_, new_n523_, new_n524_, new_n525_, new_n526_,
new_n527_, new_n528_, new_n530_, new_n531_, new_n532_, new_n533_,
new_n534_, new_n535_, new_n536_, new_n537_, new_n538_, new_n539_,
new_n540_, new_n541_, new_n542_, new_n543_, new_n545_, new_n546_,
new_n547_, new_n548_, new_n549_, new_n550_, new_n551_, new_n552_,
new_n553_, new_n554_, new_n555_, new_n556_, new_n557_, new_n558_,
new_n559_, new_n560_, new_n561_, new_n562_, new_n563_, new_n564_,
new_n565_, new_n566_, new_n567_, new_n568_, new_n569_, new_n570_,
new_n571_, new_n572_, new_n573_, new_n574_, new_n575_, new_n576_,
new_n577_, new_n578_, new_n579_, new_n580_, new_n581_, new_n582_,
new_n583_, new_n584_, new_n585_, new_n586_, new_n587_, new_n588_,
new_n589_, new_n590_, new_n591_, new_n592_, new_n593_, new_n594_,
new_n595_, new_n596_, new_n597_, new_n598_, new_n599_, new_n600_,
new_n601_, new_n602_, new_n603_, new_n604_, new_n605_, new_n606_,
new_n607_, new_n608_, new_n609_, new_n610_, new_n611_, new_n612_,
new_n613_, new_n614_, new_n615_, new_n616_, new_n617_, new_n618_,
new_n619_, new_n620_, new_n621_, new_n622_, new_n623_, new_n624_,
new_n625_, new_n626_, new_n627_, new_n628_, new_n629_, new_n630_,
new_n631_, new_n632_, new_n633_, new_n634_, new_n635_, new_n636_,
new_n637_, new_n638_, new_n639_, new_n640_, new_n641_, new_n642_,
new_n643_, new_n644_, new_n645_, new_n646_, new_n647_, new_n648_,
new_n649_, new_n650_, new_n651_, new_n652_, new_n653_, new_n654_,
new_n655_, new_n656_, new_n657_, new_n658_, new_n659_, new_n660_,
new_n661_, new_n662_, new_n663_, new_n664_, new_n665_, new_n666_,
new_n667_, new_n668_, new_n669_, new_n670_, new_n671_, new_n672_,
new_n673_, new_n674_, new_n675_, new_n676_, new_n677_, new_n678_,
new_n679_, new_n682_, new_n683_, new_n684_, new_n685_, new_n686_,
new_n687_, new_n688_, new_n689_, new_n690_, new_n691_, new_n693_,
new_n694_, new_n695_, new_n696_, new_n697_, new_n698_, new_n699_,
new_n700_, new_n701_, new_n702_, new_n703_, new_n704_, new_n705_,
new_n706_, new_n707_, new_n708_, new_n709_, new_n710_, new_n711_,
new_n712_, new_n713_, new_n714_, new_n715_, new_n717_, new_n718_,
new_n719_, new_n720_, new_n721_, new_n722_, new_n723_, new_n724_,
new_n725_, new_n726_, new_n727_, new_n728_, new_n729_, new_n730_,
new_n731_, new_n732_, new_n734_, new_n735_, new_n736_, new_n737_,
new_n738_, new_n739_, new_n740_, new_n741_, new_n742_, new_n743_,
new_n745_, new_n746_, new_n747_, new_n748_, new_n749_, new_n750_,
new_n751_, new_n752_, new_n753_, new_n754_, new_n755_, new_n756_,
new_n757_, new_n758_, new_n759_, new_n760_, new_n761_, new_n762_,
new_n763_, new_n764_, new_n765_, new_n766_, new_n767_, new_n768_,
new_n769_, new_n770_, new_n771_, new_n772_, new_n773_, new_n774_,
new_n775_, new_n776_, new_n777_, new_n778_, new_n779_, new_n780_,
new_n781_, new_n782_, new_n783_, new_n784_, new_n785_, new_n786_,
new_n787_, new_n788_, new_n789_, new_n790_, new_n791_, new_n792_,
new_n793_, new_n794_, new_n795_, new_n796_, new_n797_, new_n798_,
new_n799_, new_n800_, new_n801_, new_n802_, new_n803_, new_n804_,
new_n805_, new_n806_, new_n807_, new_n808_, new_n809_, new_n810_,
new_n811_, new_n812_, new_n813_, new_n814_, new_n815_, new_n816_,
new_n817_, new_n818_, new_n819_, new_n820_, new_n821_, new_n822_,
new_n823_, new_n824_, new_n825_, new_n826_, new_n827_, new_n830_;
NOT g000(.A(\44 ), .Y(\487 ));
NOT g001(.A(\132 ), .Y(\488 ));
NOT g002(.A(\82 ), .Y(\489 ));
NOT g003(.A(\96 ), .Y(\490 ));
NOT g004(.A(\69 ), .Y(\491 ));
NOT g005(.A(\120 ), .Y(\492 ));
NOT g006(.A(\57 ), .Y(\493 ));
NOT g007(.A(\108 ), .Y(\494 ));
NAND4 g008(.A(\309 ), .B(\305 ), .C(\301 ), .D(\297 ), .Y(\792 ));
NAND3 g009(.A(\237 ), .B(\15 ), .C(\2 ), .Y(\799 ));
AND2 g010(.A(\219 ), .B(\94 ), .Y(\1026 ));
NAND2 g011(.A(\237 ), .B(\7 ), .Y(\1028 ));
NAND3 g012(.A(\237 ), .B(\231 ), .C(\7 ), .Y(\1029 ));
NAND3 g013(.A(\325 ), .B(\237 ), .C(\7 ), .Y(\1269 ));
NAND4 g014(.A(\120 ), .B(\108 ), .C(\69 ), .D(\57 ), .Y(new_n388_));
NAND4 g015(.A(\132 ), .B(\96 ), .C(\82 ), .D(\44 ), .Y(new_n389_));
NOR2 g016(.A(new_n389_), .B(new_n388_), .Y(\1277 ));
NOT g017(.A(\1277 ), .Y(\1448 ));
NAND2 g018(.A(new_n389_), .B(\325 ), .Y(new_n392_));
NAND2 g019(.A(new_n388_), .B(\231 ), .Y(new_n393_));
NAND2 g020(.A(new_n393_), .B(new_n392_), .Y(new_n394_));
NOT g021(.A(new_n394_), .Y(\1726 ));
NAND3 g022(.A(\322 ), .B(\319 ), .C(\113 ), .Y(new_n396_));
NOT g023(.A(\319 ), .Y(new_n397_));
NAND3 g024(.A(\322 ), .B(new_n397_), .C(\125 ), .Y(new_n398_));
NOT g025(.A(\322 ), .Y(new_n399_));
NAND3 g026(.A(new_n399_), .B(new_n397_), .C(\137 ), .Y(new_n400_));
NAND3 g027(.A(new_n399_), .B(\319 ), .C(\101 ), .Y(new_n401_));
AND4 g028(.A(new_n401_), .B(new_n400_), .C(new_n398_), .D(new_n396_), .Y(\1816 ));
NAND3 g029(.A(\322 ), .B(\319 ), .C(\112 ), .Y(new_n403_));
NAND3 g030(.A(\322 ), .B(new_n397_), .C(\124 ), .Y(new_n404_));
NAND3 g031(.A(new_n399_), .B(new_n397_), .C(\136 ), .Y(new_n405_));
NAND3 g032(.A(new_n399_), .B(\319 ), .C(\100 ), .Y(new_n406_));
NAND4 g033(.A(new_n406_), .B(new_n405_), .C(new_n404_), .D(new_n403_), .Y(new_n407_));
NOT g034(.A(new_n407_), .Y(\1817 ));
NAND3 g035(.A(\322 ), .B(\319 ), .C(\114 ), .Y(new_n409_));
NAND3 g036(.A(\322 ), .B(new_n397_), .C(\126 ), .Y(new_n410_));
NAND3 g037(.A(new_n399_), .B(new_n397_), .C(\138 ), .Y(new_n411_));
NAND3 g038(.A(new_n399_), .B(\319 ), .C(\102 ), .Y(new_n412_));
NAND4 g039(.A(new_n412_), .B(new_n411_), .C(new_n410_), .D(new_n409_), .Y(new_n413_));
NOT g040(.A(new_n413_), .Y(\1818 ));
NAND3 g041(.A(\234 ), .B(\227 ), .C(\75 ), .Y(new_n415_));
NOT g042(.A(\227 ), .Y(new_n416_));
NAND3 g043(.A(\234 ), .B(new_n416_), .C(\62 ), .Y(new_n417_));
NOT g044(.A(\234 ), .Y(new_n418_));
NAND3 g045(.A(new_n418_), .B(new_n416_), .C(\88 ), .Y(new_n419_));
NAND3 g046(.A(new_n418_), .B(\227 ), .C(\50 ), .Y(new_n420_));
NAND4 g047(.A(new_n420_), .B(new_n419_), .C(new_n417_), .D(new_n415_), .Y(\2016 ));
NOT g048(.A(\2016 ), .Y(\1819 ));
NAND3 g049(.A(\234 ), .B(\227 ), .C(\76 ), .Y(new_n423_));
NAND3 g050(.A(\234 ), .B(new_n416_), .C(\63 ), .Y(new_n424_));
NAND3 g051(.A(new_n418_), .B(new_n416_), .C(\89 ), .Y(new_n425_));
NAND3 g052(.A(new_n418_), .B(\227 ), .C(\51 ), .Y(new_n426_));
NAND4 g053(.A(new_n426_), .B(new_n425_), .C(new_n424_), .D(new_n423_), .Y(\2014 ));
NOT g054(.A(\2014 ), .Y(\1820 ));
NAND3 g055(.A(\234 ), .B(\227 ), .C(\77 ), .Y(new_n429_));
NAND3 g056(.A(\234 ), .B(new_n416_), .C(\64 ), .Y(new_n430_));
NAND3 g057(.A(new_n418_), .B(new_n416_), .C(\90 ), .Y(new_n431_));
NAND3 g058(.A(new_n418_), .B(\227 ), .C(\52 ), .Y(new_n432_));
NAND4 g059(.A(new_n432_), .B(new_n431_), .C(new_n430_), .D(new_n429_), .Y(\2012 ));
NOT g060(.A(\2012 ), .Y(\1821 ));
NAND3 g061(.A(\234 ), .B(\227 ), .C(\68 ), .Y(new_n435_));
NAND3 g062(.A(\234 ), .B(new_n416_), .C(\56 ), .Y(new_n436_));
NAND3 g063(.A(new_n418_), .B(new_n416_), .C(\81 ), .Y(new_n437_));
NAND3 g064(.A(new_n418_), .B(\227 ), .C(\43 ), .Y(new_n438_));
NAND4 g065(.A(new_n438_), .B(new_n437_), .C(new_n436_), .D(new_n435_), .Y(new_n439_));
NOT g066(.A(new_n439_), .Y(new_n440_));
NAND2 g067(.A(new_n440_), .B(\241 ), .Y(\1969 ));
NAND4 g068(.A(\1726 ), .B(\237 ), .C(\224 ), .D(\36 ), .Y(\1970 ));
NAND2 g069(.A(\3 ), .B(\1 ), .Y(new_n443_));
NAND4 g070(.A(new_n443_), .B(\1726 ), .C(\237 ), .D(\224 ), .Y(\1971 ));
NAND3 g071(.A(\234 ), .B(\227 ), .C(\78 ), .Y(new_n445_));
NAND3 g072(.A(\234 ), .B(new_n416_), .C(\65 ), .Y(new_n446_));
NAND3 g073(.A(new_n418_), .B(new_n416_), .C(\91 ), .Y(new_n447_));
NAND3 g074(.A(new_n418_), .B(\227 ), .C(\53 ), .Y(new_n448_));
NAND4 g075(.A(new_n448_), .B(new_n447_), .C(new_n446_), .D(new_n445_), .Y(\2010 ));
NAND3 g076(.A(\234 ), .B(\227 ), .C(\74 ), .Y(new_n450_));
OR2 g077(.A(new_n418_), .B(\227 ), .Y(new_n451_));
NAND3 g078(.A(new_n418_), .B(new_n416_), .C(\87 ), .Y(new_n452_));
NAND3 g079(.A(new_n418_), .B(\227 ), .C(\49 ), .Y(new_n453_));
NAND4 g080(.A(new_n453_), .B(new_n452_), .C(new_n451_), .D(new_n450_), .Y(\2018 ));
NAND3 g081(.A(\234 ), .B(\227 ), .C(\73 ), .Y(new_n455_));
NAND3 g082(.A(\234 ), .B(new_n416_), .C(\61 ), .Y(new_n456_));
NAND3 g083(.A(new_n418_), .B(new_n416_), .C(\86 ), .Y(new_n457_));
NAND3 g084(.A(new_n418_), .B(\227 ), .C(\48 ), .Y(new_n458_));
NAND4 g085(.A(new_n458_), .B(new_n457_), .C(new_n456_), .D(new_n455_), .Y(\2020 ));
NAND3 g086(.A(\234 ), .B(\227 ), .C(\72 ), .Y(new_n460_));
NAND3 g087(.A(\234 ), .B(new_n416_), .C(\60 ), .Y(new_n461_));
NAND3 g088(.A(new_n418_), .B(new_n416_), .C(\85 ), .Y(new_n462_));
NAND3 g089(.A(new_n418_), .B(\227 ), .C(\47 ), .Y(new_n463_));
NAND4 g090(.A(new_n463_), .B(new_n462_), .C(new_n461_), .D(new_n460_), .Y(\2022 ));
NOT g091(.A(\246 ), .Y(new_n465_));
NAND3 g092(.A(\234 ), .B(\227 ), .C(\79 ), .Y(new_n466_));
NAND3 g093(.A(\234 ), .B(new_n416_), .C(\66 ), .Y(new_n467_));
NAND3 g094(.A(new_n418_), .B(new_n416_), .C(\92 ), .Y(new_n468_));
NAND3 g095(.A(new_n418_), .B(\227 ), .C(\54 ), .Y(new_n469_));
NAND4 g096(.A(new_n469_), .B(new_n468_), .C(new_n467_), .D(new_n466_), .Y(new_n470_));
NAND2 g097(.A(new_n470_), .B(new_n465_), .Y(new_n471_));
NAND2 g098(.A(\2012 ), .B(\246 ), .Y(new_n472_));
NAND2 g099(.A(new_n472_), .B(new_n471_), .Y(\2387 ));
NAND2 g100(.A(\2010 ), .B(new_n465_), .Y(new_n474_));
NAND2 g101(.A(\2014 ), .B(\246 ), .Y(new_n475_));
NAND2 g102(.A(new_n475_), .B(new_n474_), .Y(\2389 ));
NOR2 g103(.A(new_n470_), .B(\230 ), .Y(new_n477_));
OR2 g104(.A(new_n477_), .B(\241 ), .Y(new_n478_));
NAND2 g105(.A(new_n470_), .B(\241 ), .Y(new_n479_));
NAND2 g106(.A(new_n479_), .B(new_n478_), .Y(\2496 ));
NAND2 g107(.A(new_n439_), .B(new_n465_), .Y(new_n481_));
OR2 g108(.A(new_n477_), .B(new_n465_), .Y(new_n482_));
NAND2 g109(.A(new_n482_), .B(new_n481_), .Y(\2643 ));
NAND3 g110(.A(\322 ), .B(\319 ), .C(\111 ), .Y(new_n484_));
NAND3 g111(.A(\322 ), .B(new_n397_), .C(\123 ), .Y(new_n485_));
NAND3 g112(.A(new_n399_), .B(new_n397_), .C(\135 ), .Y(new_n486_));
NAND3 g113(.A(new_n399_), .B(\319 ), .C(\99 ), .Y(new_n487_));
NAND4 g114(.A(new_n487_), .B(new_n486_), .C(new_n485_), .D(new_n484_), .Y(new_n488_));
NAND2 g115(.A(new_n488_), .B(\313 ), .Y(new_n489_));
OR2 g116(.A(new_n488_), .B(\313 ), .Y(new_n490_));
NAND2 g117(.A(\322 ), .B(\319 ), .Y(new_n491_));
OR2 g118(.A(new_n399_), .B(\319 ), .Y(new_n492_));
OR2 g119(.A(\322 ), .B(\319 ), .Y(new_n493_));
OR2 g120(.A(\322 ), .B(new_n397_), .Y(new_n494_));
NAND4 g121(.A(new_n494_), .B(new_n493_), .C(new_n492_), .D(new_n491_), .Y(new_n495_));
OR2 g122(.A(new_n495_), .B(\316 ), .Y(new_n496_));
NAND2 g123(.A(new_n495_), .B(\316 ), .Y(new_n497_));
NAND4 g124(.A(new_n497_), .B(new_n496_), .C(new_n490_), .D(new_n489_), .Y(\2891 ));
XOR2 g125(.A(\349 ), .B(\346 ), .Y(new_n499_));
XNOR2 g126(.A(\259 ), .B(\256 ), .Y(new_n500_));
XOR2 g127(.A(new_n500_), .B(new_n499_), .Y(new_n501_));
XNOR2 g128(.A(\337 ), .B(\334 ), .Y(new_n502_));
XNOR2 g129(.A(\343 ), .B(\340 ), .Y(new_n503_));
XNOR2 g130(.A(\331 ), .B(\328 ), .Y(new_n504_));
NOT g131(.A(new_n504_), .Y(new_n505_));
NAND3 g132(.A(new_n505_), .B(new_n503_), .C(new_n502_), .Y(new_n506_));
NOT g133(.A(new_n503_), .Y(new_n507_));
NAND3 g134(.A(new_n504_), .B(new_n507_), .C(new_n502_), .Y(new_n508_));
NOT g135(.A(new_n502_), .Y(new_n509_));
NAND3 g136(.A(new_n504_), .B(new_n503_), .C(new_n509_), .Y(new_n510_));
NAND3 g137(.A(new_n505_), .B(new_n507_), .C(new_n509_), .Y(new_n511_));
NAND4 g138(.A(new_n511_), .B(new_n510_), .C(new_n508_), .D(new_n506_), .Y(new_n512_));
NAND2 g139(.A(new_n512_), .B(new_n501_), .Y(new_n513_));
OR2 g140(.A(new_n512_), .B(new_n501_), .Y(new_n514_));
NAND3 g141(.A(new_n514_), .B(new_n513_), .C(\14 ), .Y(new_n515_));
NOT g142(.A(new_n515_), .Y(\2925 ));
XNOR2 g143(.A(\316 ), .B(\313 ), .Y(new_n517_));
XNOR2 g144(.A(\301 ), .B(\297 ), .Y(new_n518_));
XNOR2 g145(.A(\309 ), .B(\305 ), .Y(new_n519_));
XNOR2 g146(.A(\355 ), .B(\294 ), .Y(new_n520_));
NOT g147(.A(new_n520_), .Y(new_n521_));
NAND3 g148(.A(new_n521_), .B(new_n519_), .C(new_n518_), .Y(new_n522_));
NOT g149(.A(new_n519_), .Y(new_n523_));
NAND3 g150(.A(new_n520_), .B(new_n523_), .C(new_n518_), .Y(new_n524_));
NOT g151(.A(new_n518_), .Y(new_n525_));
NAND3 g152(.A(new_n520_), .B(new_n519_), .C(new_n525_), .Y(new_n526_));
NAND3 g153(.A(new_n521_), .B(new_n523_), .C(new_n525_), .Y(new_n527_));
NAND4 g154(.A(new_n527_), .B(new_n526_), .C(new_n524_), .D(new_n522_), .Y(new_n528_));
XOR2 g155(.A(new_n528_), .B(new_n517_), .Y(\2970 ));
XOR2 g156(.A(\281 ), .B(\278 ), .Y(new_n530_));
XNOR2 g157(.A(\287 ), .B(\284 ), .Y(new_n531_));
XOR2 g158(.A(new_n531_), .B(new_n530_), .Y(new_n532_));
XNOR2 g159(.A(\269 ), .B(\266 ), .Y(new_n533_));
XNOR2 g160(.A(\275 ), .B(\272 ), .Y(new_n534_));
XNOR2 g161(.A(\352 ), .B(\263 ), .Y(new_n535_));
NOT g162(.A(new_n535_), .Y(new_n536_));
NAND3 g163(.A(new_n536_), .B(new_n534_), .C(new_n533_), .Y(new_n537_));
NOT g164(.A(new_n534_), .Y(new_n538_));
NAND3 g165(.A(new_n535_), .B(new_n538_), .C(new_n533_), .Y(new_n539_));
NOT g166(.A(new_n533_), .Y(new_n540_));
NAND3 g167(.A(new_n535_), .B(new_n534_), .C(new_n540_), .Y(new_n541_));
NAND3 g168(.A(new_n536_), .B(new_n538_), .C(new_n540_), .Y(new_n542_));
NAND4 g169(.A(new_n542_), .B(new_n541_), .C(new_n539_), .D(new_n537_), .Y(new_n543_));
XOR2 g170(.A(new_n543_), .B(new_n532_), .Y(\2971 ));
NOT g171(.A(\27 ), .Y(new_n545_));
OR2 g172(.A(\29 ), .B(new_n545_), .Y(new_n546_));
NAND2 g173(.A(new_n413_), .B(\29 ), .Y(new_n547_));
NAND2 g174(.A(new_n547_), .B(new_n546_), .Y(new_n548_));
OR2 g175(.A(new_n548_), .B(\301 ), .Y(new_n549_));
NOT g176(.A(\34 ), .Y(new_n550_));
OR2 g177(.A(new_n550_), .B(\29 ), .Y(new_n551_));
NAND4 g178(.A(new_n401_), .B(new_n400_), .C(new_n398_), .D(new_n396_), .Y(new_n552_));
NAND2 g179(.A(new_n552_), .B(\29 ), .Y(new_n553_));
NAND2 g180(.A(new_n553_), .B(new_n551_), .Y(new_n554_));
OR2 g181(.A(new_n554_), .B(\305 ), .Y(new_n555_));
NAND2 g182(.A(new_n548_), .B(\301 ), .Y(new_n556_));
NOT g183(.A(\26 ), .Y(new_n557_));
OR2 g184(.A(\29 ), .B(new_n557_), .Y(new_n558_));
NAND3 g185(.A(\322 ), .B(\319 ), .C(\116 ), .Y(new_n559_));
NAND3 g186(.A(\322 ), .B(new_n397_), .C(\128 ), .Y(new_n560_));
NAND3 g187(.A(new_n399_), .B(new_n397_), .C(\140 ), .Y(new_n561_));
NAND3 g188(.A(new_n399_), .B(\319 ), .C(\104 ), .Y(new_n562_));
NAND4 g189(.A(new_n562_), .B(new_n561_), .C(new_n560_), .D(new_n559_), .Y(new_n563_));
NAND2 g190(.A(new_n563_), .B(\29 ), .Y(new_n564_));
NAND2 g191(.A(new_n564_), .B(new_n558_), .Y(new_n565_));
OR2 g192(.A(new_n565_), .B(\294 ), .Y(new_n566_));
NOT g193(.A(\33 ), .Y(new_n567_));
OR2 g194(.A(new_n567_), .B(\29 ), .Y(new_n568_));
NAND3 g195(.A(\322 ), .B(\319 ), .C(\115 ), .Y(new_n569_));
NAND3 g196(.A(\322 ), .B(new_n397_), .C(\127 ), .Y(new_n570_));
NAND3 g197(.A(new_n399_), .B(new_n397_), .C(\139 ), .Y(new_n571_));
NAND3 g198(.A(new_n399_), .B(\319 ), .C(\103 ), .Y(new_n572_));
NAND4 g199(.A(new_n572_), .B(new_n571_), .C(new_n570_), .D(new_n569_), .Y(new_n573_));
NAND2 g200(.A(new_n573_), .B(\29 ), .Y(new_n574_));
NAND2 g201(.A(new_n574_), .B(new_n568_), .Y(new_n575_));
NAND2 g202(.A(new_n575_), .B(\297 ), .Y(new_n576_));
OR2 g203(.A(new_n575_), .B(\297 ), .Y(new_n577_));
NAND2 g204(.A(new_n554_), .B(\305 ), .Y(new_n578_));
NAND4 g205(.A(new_n578_), .B(new_n577_), .C(new_n576_), .D(new_n566_), .Y(new_n579_));
NOT g206(.A(\35 ), .Y(new_n580_));
OR2 g207(.A(new_n580_), .B(\29 ), .Y(new_n581_));
NAND2 g208(.A(new_n407_), .B(\29 ), .Y(new_n582_));
NAND2 g209(.A(new_n582_), .B(new_n581_), .Y(new_n583_));
OR2 g210(.A(new_n583_), .B(\309 ), .Y(new_n584_));
NOT g211(.A(\32 ), .Y(new_n585_));
OR2 g212(.A(new_n585_), .B(\29 ), .Y(new_n586_));
NAND3 g213(.A(\322 ), .B(\319 ), .C(\117 ), .Y(new_n587_));
NAND3 g214(.A(\322 ), .B(new_n397_), .C(\129 ), .Y(new_n588_));
NAND3 g215(.A(new_n399_), .B(new_n397_), .C(\141 ), .Y(new_n589_));
NAND3 g216(.A(new_n399_), .B(\319 ), .C(\105 ), .Y(new_n590_));
NAND4 g217(.A(new_n590_), .B(new_n589_), .C(new_n588_), .D(new_n587_), .Y(new_n591_));
NAND2 g218(.A(new_n591_), .B(\29 ), .Y(new_n592_));
NAND2 g219(.A(new_n592_), .B(new_n586_), .Y(new_n593_));
NAND2 g220(.A(new_n593_), .B(\287 ), .Y(new_n594_));
OR2 g221(.A(new_n593_), .B(\287 ), .Y(new_n595_));
NAND2 g222(.A(new_n565_), .B(\294 ), .Y(new_n596_));
NAND4 g223(.A(new_n596_), .B(new_n595_), .C(new_n594_), .D(new_n584_), .Y(new_n597_));
NOR2 g224(.A(new_n597_), .B(new_n579_), .Y(new_n598_));
NAND4 g225(.A(new_n598_), .B(new_n556_), .C(new_n555_), .D(new_n549_), .Y(new_n599_));
NOT g226(.A(\22 ), .Y(new_n600_));
OR2 g227(.A(new_n600_), .B(\16 ), .Y(new_n601_));
NAND2 g228(.A(\2016 ), .B(\16 ), .Y(new_n602_));
NAND2 g229(.A(new_n602_), .B(new_n601_), .Y(new_n603_));
NAND2 g230(.A(new_n603_), .B(\272 ), .Y(new_n604_));
NAND2 g231(.A(new_n465_), .B(\11 ), .Y(new_n605_));
NAND2 g232(.A(\246 ), .B(\11 ), .Y(new_n606_));
NAND2 g233(.A(new_n606_), .B(new_n605_), .Y(new_n607_));
NOT g234(.A(\28 ), .Y(new_n608_));
OR2 g235(.A(\29 ), .B(new_n608_), .Y(new_n609_));
NAND2 g236(.A(new_n488_), .B(\29 ), .Y(new_n610_));
NAND2 g237(.A(new_n610_), .B(new_n609_), .Y(new_n611_));
NAND3 g238(.A(new_n611_), .B(new_n607_), .C(new_n604_), .Y(new_n612_));
OR2 g239(.A(new_n603_), .B(\272 ), .Y(new_n613_));
NOT g240(.A(\23 ), .Y(new_n614_));
OR2 g241(.A(new_n614_), .B(\16 ), .Y(new_n615_));
NAND2 g242(.A(\2018 ), .B(\16 ), .Y(new_n616_));
NAND2 g243(.A(new_n616_), .B(new_n615_), .Y(new_n617_));
NAND2 g244(.A(new_n617_), .B(\275 ), .Y(new_n618_));
OR2 g245(.A(new_n617_), .B(\275 ), .Y(new_n619_));
NOT g246(.A(\6 ), .Y(new_n620_));
OR2 g247(.A(\16 ), .B(new_n620_), .Y(new_n621_));
NAND2 g248(.A(\2020 ), .B(\16 ), .Y(new_n622_));
NAND2 g249(.A(new_n622_), .B(new_n621_), .Y(new_n623_));
NAND2 g250(.A(new_n623_), .B(\278 ), .Y(new_n624_));
NAND4 g251(.A(new_n624_), .B(new_n619_), .C(new_n618_), .D(new_n613_), .Y(new_n625_));
NOT g252(.A(\24 ), .Y(new_n626_));
OR2 g253(.A(new_n626_), .B(\16 ), .Y(new_n627_));
NAND2 g254(.A(\2022 ), .B(\16 ), .Y(new_n628_));
NAND2 g255(.A(new_n628_), .B(new_n627_), .Y(new_n629_));
OR2 g256(.A(new_n629_), .B(\281 ), .Y(new_n630_));
NOT g257(.A(\19 ), .Y(new_n631_));
OR2 g258(.A(new_n631_), .B(\16 ), .Y(new_n632_));
NAND2 g259(.A(new_n439_), .B(\16 ), .Y(new_n633_));
NAND2 g260(.A(new_n633_), .B(new_n632_), .Y(new_n634_));
NAND2 g261(.A(new_n634_), .B(\256 ), .Y(new_n635_));
OR2 g262(.A(new_n634_), .B(\256 ), .Y(new_n636_));
NOT g263(.A(\4 ), .Y(new_n637_));
OR2 g264(.A(\16 ), .B(new_n637_), .Y(new_n638_));
NAND2 g265(.A(new_n470_), .B(\16 ), .Y(new_n639_));
NAND2 g266(.A(new_n639_), .B(new_n638_), .Y(new_n640_));
NAND2 g267(.A(new_n640_), .B(\259 ), .Y(new_n641_));
NAND4 g268(.A(new_n641_), .B(new_n636_), .C(new_n635_), .D(new_n630_), .Y(new_n642_));
OR2 g269(.A(new_n623_), .B(\278 ), .Y(new_n643_));
NOT g270(.A(\25 ), .Y(new_n644_));
OR2 g271(.A(\29 ), .B(new_n644_), .Y(new_n645_));
NAND3 g272(.A(\322 ), .B(\319 ), .C(\107 ), .Y(new_n646_));
NAND3 g273(.A(\322 ), .B(new_n397_), .C(\119 ), .Y(new_n647_));
NAND3 g274(.A(new_n399_), .B(new_n397_), .C(\131 ), .Y(new_n648_));
NAND3 g275(.A(new_n399_), .B(\319 ), .C(\95 ), .Y(new_n649_));
NAND4 g276(.A(new_n649_), .B(new_n648_), .C(new_n647_), .D(new_n646_), .Y(new_n650_));
NAND2 g277(.A(new_n650_), .B(\29 ), .Y(new_n651_));
NAND2 g278(.A(new_n651_), .B(new_n645_), .Y(new_n652_));
NAND2 g279(.A(new_n652_), .B(\284 ), .Y(new_n653_));
OR2 g280(.A(new_n652_), .B(\284 ), .Y(new_n654_));
NAND2 g281(.A(new_n629_), .B(\281 ), .Y(new_n655_));
NAND4 g282(.A(new_n655_), .B(new_n654_), .C(new_n653_), .D(new_n643_), .Y(new_n656_));
NOT g283(.A(\21 ), .Y(new_n657_));
OR2 g284(.A(new_n657_), .B(\16 ), .Y(new_n658_));
NAND2 g285(.A(\2014 ), .B(\16 ), .Y(new_n659_));
NAND2 g286(.A(new_n659_), .B(new_n658_), .Y(new_n660_));
OR2 g287(.A(new_n660_), .B(\269 ), .Y(new_n661_));
NOT g288(.A(\5 ), .Y(new_n662_));
OR2 g289(.A(\16 ), .B(new_n662_), .Y(new_n663_));
NAND2 g290(.A(\2012 ), .B(\16 ), .Y(new_n664_));
NAND2 g291(.A(new_n664_), .B(new_n663_), .Y(new_n665_));
NAND2 g292(.A(new_n665_), .B(\266 ), .Y(new_n666_));
OR2 g293(.A(new_n665_), .B(\266 ), .Y(new_n667_));
NAND2 g294(.A(new_n583_), .B(\309 ), .Y(new_n668_));
NAND4 g295(.A(new_n668_), .B(new_n667_), .C(new_n666_), .D(new_n661_), .Y(new_n669_));
OR2 g296(.A(new_n640_), .B(\259 ), .Y(new_n670_));
NOT g297(.A(\20 ), .Y(new_n671_));
OR2 g298(.A(new_n671_), .B(\16 ), .Y(new_n672_));
NAND2 g299(.A(\2010 ), .B(\16 ), .Y(new_n673_));
NAND2 g300(.A(new_n673_), .B(new_n672_), .Y(new_n674_));
NAND2 g301(.A(new_n674_), .B(\263 ), .Y(new_n675_));
OR2 g302(.A(new_n674_), .B(\263 ), .Y(new_n676_));
NAND2 g303(.A(new_n660_), .B(\269 ), .Y(new_n677_));
NAND4 g304(.A(new_n677_), .B(new_n676_), .C(new_n675_), .D(new_n670_), .Y(new_n678_));
OR4 g305(.A(new_n678_), .B(new_n669_), .C(new_n656_), .D(new_n642_), .Y(new_n679_));
NOR4 g306(.A(new_n679_), .B(new_n625_), .C(new_n612_), .D(new_n599_), .Y(\3038 ));
NOT g307(.A(\3038 ), .Y(\3079 ));
XNOR2 g308(.A(new_n470_), .B(new_n439_), .Y(new_n682_));
XOR2 g309(.A(new_n682_), .B(new_n477_), .Y(new_n683_));
NAND3 g310(.A(\234 ), .B(\227 ), .C(\80 ), .Y(new_n684_));
NAND3 g311(.A(\234 ), .B(new_n416_), .C(\67 ), .Y(new_n685_));
NAND3 g312(.A(new_n418_), .B(new_n416_), .C(\93 ), .Y(new_n686_));
NAND3 g313(.A(new_n418_), .B(\227 ), .C(\55 ), .Y(new_n687_));
NAND4 g314(.A(new_n687_), .B(new_n686_), .C(new_n685_), .D(new_n684_), .Y(new_n688_));
XOR2 g315(.A(new_n688_), .B(new_n683_), .Y(new_n689_));
OR2 g316(.A(new_n689_), .B(\241 ), .Y(new_n690_));
NAND2 g317(.A(new_n688_), .B(\241 ), .Y(new_n691_));
NAND2 g318(.A(new_n691_), .B(new_n690_), .Y(\3546 ));
NOT g319(.A(\37 ), .Y(new_n693_));
XOR2 g320(.A(new_n407_), .B(new_n552_), .Y(new_n694_));
XNOR2 g321(.A(new_n495_), .B(new_n488_), .Y(new_n695_));
XOR2 g322(.A(new_n695_), .B(new_n694_), .Y(new_n696_));
XNOR2 g323(.A(new_n591_), .B(new_n563_), .Y(new_n697_));
XNOR2 g324(.A(new_n573_), .B(new_n413_), .Y(new_n698_));
NAND3 g325(.A(\322 ), .B(\319 ), .C(\118 ), .Y(new_n699_));
NAND3 g326(.A(\322 ), .B(new_n397_), .C(\130 ), .Y(new_n700_));
NAND3 g327(.A(new_n399_), .B(new_n397_), .C(\142 ), .Y(new_n701_));
NAND3 g328(.A(new_n399_), .B(\319 ), .C(\106 ), .Y(new_n702_));
NAND4 g329(.A(new_n702_), .B(new_n701_), .C(new_n700_), .D(new_n699_), .Y(new_n703_));
XNOR2 g330(.A(new_n703_), .B(new_n650_), .Y(new_n704_));
NOT g331(.A(new_n704_), .Y(new_n705_));
NAND3 g332(.A(new_n705_), .B(new_n698_), .C(new_n697_), .Y(new_n706_));
NOT g333(.A(new_n698_), .Y(new_n707_));
NAND3 g334(.A(new_n704_), .B(new_n707_), .C(new_n697_), .Y(new_n708_));
NOT g335(.A(new_n697_), .Y(new_n709_));
NAND3 g336(.A(new_n704_), .B(new_n698_), .C(new_n709_), .Y(new_n710_));
NAND3 g337(.A(new_n705_), .B(new_n707_), .C(new_n709_), .Y(new_n711_));
NAND4 g338(.A(new_n711_), .B(new_n710_), .C(new_n708_), .D(new_n706_), .Y(new_n712_));
NAND2 g339(.A(new_n712_), .B(new_n696_), .Y(new_n713_));
OR2 g340(.A(new_n712_), .B(new_n696_), .Y(new_n714_));
NAND3 g341(.A(new_n714_), .B(new_n713_), .C(new_n693_), .Y(new_n715_));
NOT g342(.A(new_n715_), .Y(\3671 ));
NAND2 g343(.A(new_n688_), .B(new_n465_), .Y(new_n717_));
XOR2 g344(.A(\2018 ), .B(\2016 ), .Y(new_n718_));
XNOR2 g345(.A(\2022 ), .B(\2020 ), .Y(new_n719_));
XOR2 g346(.A(new_n719_), .B(new_n718_), .Y(new_n720_));
NOT g347(.A(new_n477_), .Y(new_n721_));
XNOR2 g348(.A(new_n688_), .B(new_n439_), .Y(new_n722_));
XNOR2 g349(.A(new_n470_), .B(\2010 ), .Y(new_n723_));
NAND3 g350(.A(new_n723_), .B(new_n722_), .C(new_n721_), .Y(new_n724_));
NOT g351(.A(new_n723_), .Y(new_n725_));
NAND3 g352(.A(new_n725_), .B(new_n722_), .C(new_n477_), .Y(new_n726_));
NOT g353(.A(new_n722_), .Y(new_n727_));
NAND3 g354(.A(new_n723_), .B(new_n727_), .C(new_n477_), .Y(new_n728_));
NAND3 g355(.A(new_n725_), .B(new_n727_), .C(new_n721_), .Y(new_n729_));
NAND4 g356(.A(new_n729_), .B(new_n728_), .C(new_n726_), .D(new_n724_), .Y(new_n730_));
XOR2 g357(.A(new_n730_), .B(new_n720_), .Y(new_n731_));
OR2 g358(.A(new_n731_), .B(new_n465_), .Y(new_n732_));
NAND2 g359(.A(new_n732_), .B(new_n717_), .Y(\3803 ));
XNOR2 g360(.A(\2012 ), .B(\2014 ), .Y(new_n734_));
NAND3 g361(.A(new_n734_), .B(new_n723_), .C(new_n727_), .Y(new_n735_));
NOT g362(.A(new_n734_), .Y(new_n736_));
NAND3 g363(.A(new_n736_), .B(new_n723_), .C(new_n722_), .Y(new_n737_));
NAND3 g364(.A(new_n734_), .B(new_n725_), .C(new_n722_), .Y(new_n738_));
NAND3 g365(.A(new_n736_), .B(new_n725_), .C(new_n727_), .Y(new_n739_));
NAND4 g366(.A(new_n739_), .B(new_n738_), .C(new_n737_), .D(new_n735_), .Y(new_n740_));
NAND2 g367(.A(new_n740_), .B(new_n720_), .Y(new_n741_));
OR2 g368(.A(new_n740_), .B(new_n720_), .Y(new_n742_));
NAND3 g369(.A(new_n742_), .B(new_n741_), .C(new_n693_), .Y(new_n743_));
NOT g370(.A(new_n743_), .Y(\3809 ));
NOT g371(.A(\40 ), .Y(new_n745_));
NOT g372(.A(\262 ), .Y(new_n746_));
NAND2 g373(.A(new_n413_), .B(new_n746_), .Y(new_n747_));
NOR3 g374(.A(new_n747_), .B(new_n552_), .C(new_n745_), .Y(new_n748_));
NOR2 g375(.A(new_n552_), .B(new_n745_), .Y(new_n749_));
NAND2 g376(.A(new_n749_), .B(new_n747_), .Y(new_n750_));
NOR3 g377(.A(new_n750_), .B(new_n748_), .C(\294 ), .Y(new_n751_));
NAND3 g378(.A(new_n749_), .B(new_n747_), .C(new_n563_), .Y(new_n752_));
XOR2 g379(.A(new_n752_), .B(new_n751_), .Y(new_n753_));
NOR3 g380(.A(new_n750_), .B(new_n748_), .C(\287 ), .Y(new_n754_));
NAND3 g381(.A(new_n749_), .B(new_n747_), .C(new_n591_), .Y(new_n755_));
XOR2 g382(.A(new_n755_), .B(new_n754_), .Y(new_n756_));
NOR3 g383(.A(new_n750_), .B(new_n748_), .C(\284 ), .Y(new_n757_));
NAND3 g384(.A(new_n749_), .B(new_n747_), .C(new_n650_), .Y(new_n758_));
NAND4 g385(.A(new_n758_), .B(new_n757_), .C(new_n756_), .D(new_n753_), .Y(new_n759_));
NOR4 g386(.A(new_n750_), .B(new_n748_), .C(\2022 ), .D(\281 ), .Y(new_n760_));
XOR2 g387(.A(new_n758_), .B(new_n757_), .Y(new_n761_));
NAND4 g388(.A(new_n761_), .B(new_n760_), .C(new_n756_), .D(new_n753_), .Y(new_n762_));
NAND2 g389(.A(new_n752_), .B(new_n751_), .Y(new_n763_));
NAND3 g390(.A(new_n755_), .B(new_n754_), .C(new_n753_), .Y(new_n764_));
AND4 g391(.A(new_n764_), .B(new_n763_), .C(new_n762_), .D(new_n759_), .Y(new_n765_));
NAND4 g392(.A(new_n413_), .B(\1816 ), .C(new_n746_), .D(\40 ), .Y(new_n766_));
OR2 g393(.A(new_n766_), .B(\294 ), .Y(new_n767_));
NOT g394(.A(\259 ), .Y(new_n768_));
NAND2 g395(.A(new_n766_), .B(new_n768_), .Y(new_n769_));
NAND2 g396(.A(new_n769_), .B(new_n767_), .Y(new_n770_));
XNOR2 g397(.A(new_n770_), .B(new_n470_), .Y(new_n771_));
OR2 g398(.A(new_n766_), .B(\297 ), .Y(new_n772_));
NOT g399(.A(\263 ), .Y(new_n773_));
NAND2 g400(.A(new_n766_), .B(new_n773_), .Y(new_n774_));
AND2 g401(.A(new_n774_), .B(new_n772_), .Y(new_n775_));
XOR2 g402(.A(new_n775_), .B(\2010 ), .Y(new_n776_));
OR2 g403(.A(new_n766_), .B(\287 ), .Y(new_n777_));
OR2 g404(.A(new_n748_), .B(\256 ), .Y(new_n778_));
NAND2 g405(.A(new_n778_), .B(new_n777_), .Y(new_n779_));
NAND4 g406(.A(new_n779_), .B(new_n776_), .C(new_n771_), .D(new_n440_), .Y(new_n780_));
OR2 g407(.A(new_n775_), .B(\2010 ), .Y(new_n781_));
NOT g408(.A(new_n470_), .Y(new_n782_));
NAND3 g409(.A(new_n776_), .B(new_n770_), .C(new_n782_), .Y(new_n783_));
NAND3 g410(.A(new_n783_), .B(new_n781_), .C(new_n780_), .Y(new_n784_));
NOT g411(.A(\8 ), .Y(new_n785_));
NOR2 g412(.A(new_n766_), .B(\305 ), .Y(new_n786_));
NOR2 g413(.A(new_n748_), .B(\269 ), .Y(new_n787_));
NOR2 g414(.A(new_n787_), .B(new_n786_), .Y(new_n788_));
NOR2 g415(.A(new_n788_), .B(new_n785_), .Y(new_n789_));
NAND2 g416(.A(\2014 ), .B(\8 ), .Y(new_n790_));
XOR2 g417(.A(new_n790_), .B(new_n789_), .Y(new_n791_));
NOR2 g418(.A(new_n766_), .B(\309 ), .Y(new_n792_));
NOR2 g419(.A(new_n748_), .B(\272 ), .Y(new_n793_));
NOR2 g420(.A(new_n793_), .B(new_n792_), .Y(new_n794_));
NOR2 g421(.A(new_n794_), .B(new_n785_), .Y(new_n795_));
NAND2 g422(.A(\2016 ), .B(\8 ), .Y(new_n796_));
XOR2 g423(.A(new_n796_), .B(new_n795_), .Y(new_n797_));
NOR3 g424(.A(new_n748_), .B(\275 ), .C(new_n785_), .Y(new_n798_));
NAND3 g425(.A(new_n766_), .B(\2018 ), .C(\8 ), .Y(new_n799_));
XNOR2 g426(.A(new_n799_), .B(new_n798_), .Y(new_n800_));
NOT g427(.A(\278 ), .Y(new_n801_));
NAND3 g428(.A(new_n766_), .B(new_n801_), .C(\8 ), .Y(new_n802_));
NAND3 g429(.A(new_n766_), .B(\2020 ), .C(\8 ), .Y(new_n803_));
XOR2 g430(.A(new_n803_), .B(new_n802_), .Y(new_n804_));
NOR2 g431(.A(new_n804_), .B(new_n800_), .Y(new_n805_));
NOR2 g432(.A(new_n766_), .B(\301 ), .Y(new_n806_));
NOR2 g433(.A(new_n748_), .B(\266 ), .Y(new_n807_));
NOR2 g434(.A(new_n807_), .B(new_n806_), .Y(new_n808_));
XOR2 g435(.A(new_n808_), .B(\2012 ), .Y(new_n809_));
AND2 g436(.A(new_n809_), .B(new_n805_), .Y(new_n810_));
NAND4 g437(.A(new_n810_), .B(new_n797_), .C(new_n791_), .D(new_n784_), .Y(new_n811_));
NOT g438(.A(new_n804_), .Y(new_n812_));
NOR3 g439(.A(new_n808_), .B(new_n800_), .C(\2012 ), .Y(new_n813_));
NAND4 g440(.A(new_n813_), .B(new_n812_), .C(new_n797_), .D(new_n791_), .Y(new_n814_));
NAND4 g441(.A(new_n805_), .B(new_n797_), .C(new_n790_), .D(new_n789_), .Y(new_n815_));
NAND3 g442(.A(new_n805_), .B(new_n796_), .C(new_n795_), .Y(new_n816_));
NAND4 g443(.A(new_n803_), .B(new_n766_), .C(new_n801_), .D(\8 ), .Y(new_n817_));
NAND3 g444(.A(new_n812_), .B(new_n799_), .C(new_n798_), .Y(new_n818_));
AND3 g445(.A(new_n818_), .B(new_n817_), .C(new_n816_), .Y(new_n819_));
NAND4 g446(.A(new_n819_), .B(new_n815_), .C(new_n814_), .D(new_n811_), .Y(new_n820_));
OR2 g447(.A(new_n820_), .B(new_n765_), .Y(new_n821_));
NAND3 g448(.A(new_n749_), .B(new_n747_), .C(\2022 ), .Y(new_n822_));
OR3 g449(.A(new_n750_), .B(new_n748_), .C(\281 ), .Y(new_n823_));
XNOR2 g450(.A(new_n823_), .B(new_n822_), .Y(new_n824_));
NAND4 g451(.A(new_n824_), .B(new_n761_), .C(new_n756_), .D(new_n753_), .Y(new_n825_));
NAND2 g452(.A(new_n825_), .B(new_n765_), .Y(new_n826_));
NAND2 g453(.A(new_n826_), .B(new_n820_), .Y(new_n827_));
NAND2 g454(.A(new_n827_), .B(new_n821_), .Y(\3851 ));
NOR3 g455(.A(\2971 ), .B(\2970 ), .C(new_n394_), .Y(new_n830_));
NAND4 g456(.A(new_n830_), .B(new_n743_), .C(new_n715_), .D(new_n515_), .Y(\3882 ));
NOT g457(.A(\3882 ), .Y(\3881 ));
assign \3875 = 1'b0;
BUF g458(.A(\219 ), .Y(\398 ));
BUF g459(.A(\219 ), .Y(\400 ));
BUF g460(.A(\219 ), .Y(\401 ));
BUF g461(.A(\253 ), .Y(\419 ));
BUF g462(.A(\253 ), .Y(\420 ));
BUF g463(.A(\290 ), .Y(\456 ));
BUF g464(.A(\290 ), .Y(\457 ));
BUF g465(.A(\290 ), .Y(\458 ));
BUF g466(.A(\219 ), .Y(\805 ));
NAND2 g467(.A(new_n472_), .B(new_n471_), .Y(\2388 ));
NAND2 g468(.A(new_n475_), .B(new_n474_), .Y(\2390 ));
NAND2 g469(.A(new_n482_), .B(new_n481_), .Y(\2644 ));
NAND2 g470(.A(new_n732_), .B(new_n717_), .Y(\3804 ));
endmodule

View File

@ -1,35 +0,0 @@
# generated by verilog2bench.py https://gitea.yuhangq.com/YuhangQ/any2bench
INPUT(NET_1)
INPUT(NET_2)
INPUT(NET_3)
INPUT(NET_4)
INPUT(NET_5)
OUTPUT(NET_12)
OUTPUT(NET_23)
OUTPUT(NET_27)
OUTPUT(NET_28)
OUTPUT(NET_6)
new_n11_ = NOT ( NET_3 )
new_n12_ = NOT ( NET_4 )
NET_12 = AND ( new_n12_, new_n11_, NET_2 )
new_n14_ = NOR ( new_n11_, NET_2 )
new_n15_ = NAND ( new_n14_, new_n12_ )
new_n16_ = NOR ( NET_3, NET_1 )
new_n17_ = NOR ( new_n16_, NET_2 )
new_n18_ = OR ( new_n17_, new_n12_ )
NET_23 = NAND ( new_n18_, new_n15_ )
new_n20_ = NOR ( new_n11_, NET_1 )
new_n21_ = OR ( new_n20_, NET_4 )
new_n22_ = NAND ( new_n21_, NET_2 )
new_n23_ = NOT ( NET_1 )
new_n24_ = NOR ( new_n14_, NET_4 )
new_n25_ = OR ( new_n24_, new_n23_ )
new_n26_ = NAND ( NET_4, NET_3 )
NET_27 = NAND ( new_n26_, new_n25_, new_n22_ )
new_n28_ = NOR ( NET_4, NET_2, NET_1 )
new_n29_ = NOR ( NET_2, new_n23_ )
new_n30_ = NOR ( new_n29_, new_n12_ )
new_n31_ = NOR ( new_n30_, NET_3 )
NET_28 = OR ( new_n31_, new_n28_ )
NET_6 = BUF ( NET_5 )
NET_2313123 = DFF ( NET_5 )

8829
_c6288.txt

File diff suppressed because it is too large Load Diff

BIN
atpg

Binary file not shown.

View File

@ -1,207 +0,0 @@
# c432
INPUT(1)
INPUT(4)
INPUT(8)
INPUT(11)
INPUT(14)
INPUT(17)
INPUT(21)
INPUT(24)
INPUT(27)
INPUT(30)
INPUT(34)
INPUT(37)
INPUT(40)
INPUT(43)
INPUT(47)
INPUT(50)
INPUT(53)
INPUT(56)
INPUT(60)
INPUT(63)
INPUT(66)
INPUT(69)
INPUT(73)
INPUT(76)
INPUT(79)
INPUT(82)
INPUT(86)
INPUT(89)
INPUT(92)
INPUT(95)
INPUT(99)
INPUT(102)
INPUT(105)
INPUT(108)
INPUT(112)
INPUT(115)
OUTPUT(223)
OUTPUT(329)
OUTPUT(370)
OUTPUT(421)
OUTPUT(430)
OUTPUT(431)
OUTPUT(432)
118 = NOT(1)
119 = NOT(4)
122 = NOT(11)
123 = NOT(17)
126 = NOT(24)
127 = NOT(30)
130 = NOT(37)
131 = NOT(43)
134 = NOT(50)
135 = NOT(56)
138 = NOT(63)
139 = NOT(69)
142 = NOT(76)
143 = NOT(82)
146 = NOT(89)
147 = NOT(95)
150 = NOT(102)
151 = NOT(108)
154 = NAND(118, 4)
157 = NOR(8, 119)
158 = NOR(14, 119)
159 = NAND(122, 17)
162 = NAND(126, 30)
165 = NAND(130, 43)
168 = NAND(134, 56)
171 = NAND(138, 69)
174 = NAND(142, 82)
177 = NAND(146, 95)
180 = NAND(150, 108)
183 = NOR(21, 123)
184 = NOR(27, 123)
185 = NOR(34, 127)
186 = NOR(40, 127)
187 = NOR(47, 131)
188 = NOR(53, 131)
189 = NOR(60, 135)
190 = NOR(66, 135)
191 = NOR(73, 139)
192 = NOR(79, 139)
193 = NOR(86, 143)
194 = NOR(92, 143)
195 = NOR(99, 147)
196 = NOR(105, 147)
197 = NOR(112, 151)
198 = NOR(115, 151)
199 = AND(154, 159, 162, 165, 168, 171, 174, 177, 180)
203 = NOT(199)
213 = NOT(199)
223 = NOT(199)
224 = XOR(203, 154)
227 = XOR(203, 159)
230 = XOR(203, 162)
233 = XOR(203, 165)
236 = XOR(203, 168)
239 = XOR(203, 171)
242 = NAND(1, 213)
243 = XOR(203, 174)
246 = NAND(213, 11)
247 = XOR(203, 177)
250 = NAND(213, 24)
251 = XOR(203, 180)
254 = NAND(213, 37)
255 = NAND(213, 50)
256 = NAND(213, 63)
257 = NAND(213, 76)
258 = NAND(213, 89)
259 = NAND(213, 102)
260 = NAND(224, 157)
263 = NAND(224, 158)
264 = NAND(227, 183)
267 = NAND(230, 185)
270 = NAND(233, 187)
273 = NAND(236, 189)
276 = NAND(239, 191)
279 = NAND(243, 193)
282 = NAND(247, 195)
285 = NAND(251, 197)
288 = NAND(227, 184)
289 = NAND(230, 186)
290 = NAND(233, 188)
291 = NAND(236, 190)
292 = NAND(239, 192)
293 = NAND(243, 194)
294 = NAND(247, 196)
295 = NAND(251, 198)
296 = AND(260, 264, 267, 270, 273, 276, 279, 282, 285)
300 = NOT(263)
301 = NOT(288)
302 = NOT(289)
303 = NOT(290)
304 = NOT(291)
305 = NOT(292)
306 = NOT(293)
307 = NOT(294)
308 = NOT(295)
309 = NOT(296)
319 = NOT(296)
329 = NOT(296)
330 = XOR(309, 260)
331 = XOR(309, 264)
332 = XOR(309, 267)
333 = XOR(309, 270)
334 = NAND(8, 319)
335 = XOR(309, 273)
336 = NAND(319, 21)
337 = XOR(309, 276)
338 = NAND(319, 34)
339 = XOR(309, 279)
340 = NAND(319, 47)
341 = XOR(309, 282)
342 = NAND(319, 60)
343 = XOR(309, 285)
344 = NAND(319, 73)
345 = NAND(319, 86)
346 = NAND(319, 99)
347 = NAND(319, 112)
348 = NAND(330, 300)
349 = NAND(331, 301)
350 = NAND(332, 302)
351 = NAND(333, 303)
352 = NAND(335, 304)
353 = NAND(337, 305)
354 = NAND(339, 306)
355 = NAND(341, 307)
356 = NAND(343, 308)
357 = AND(348, 349, 350, 351, 352, 353, 354, 355, 356)
360 = NOT(357)
370 = NOT(357)
371 = NAND(14, 360)
372 = NAND(360, 27)
373 = NAND(360, 40)
374 = NAND(360, 53)
375 = NAND(360, 66)
376 = NAND(360, 79)
377 = NAND(360, 92)
378 = NAND(360, 105)
379 = NAND(360, 115)
380 = NAND(4, 242, 334, 371)
381 = NAND(246, 336, 372, 17)
386 = NAND(250, 338, 373, 30)
393 = NAND(254, 340, 374, 43)
399 = NAND(255, 342, 375, 56)
404 = NAND(256, 344, 376, 69)
407 = NAND(257, 345, 377, 82)
411 = NAND(258, 346, 378, 95)
414 = NAND(259, 347, 379, 108)
415 = NOT(380)
416 = AND(381, 386, 393, 399, 404, 407, 411, 414)
417 = NOT(393)
418 = NOT(404)
419 = NOT(407)
420 = NOT(411)
421 = NOR(415, 416)
422 = NAND(386, 417)
425 = NAND(386, 393, 418, 399)
428 = NAND(399, 393, 419)
429 = NAND(386, 393, 407, 420)
430 = NAND(381, 386, 422, 399)
431 = NAND(381, 386, 425, 428)
432 = NAND(381, 422, 425, 429)

File diff suppressed because it is too large Load Diff

View File

@ -1,196 +0,0 @@
#include "circuit.h"
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include "assert.h"
void Circuit::init_stems() {
for(auto& gate: gates) {
if(gate->outputs.size() >= 2) {
gate->stem = true;
}
gate->stem = true;
if(gate->stem) {
stems.push_back(gate);
}
}
for(Gate *g : gates) {
if(g->isPI) continue;
std::queue<Gate*> q;
std::unordered_map<Gate*, bool> used;
q.push(g);
while(!q.empty()) {
Gate* now = q.front();
q.pop();
for(Gate* in : now->inputs) {
if(in->stem) {
g->pre_stems.push_back(in);
} else if(!used[in]) {
used[in] = true;
q.push(in);
}
}
}
//printf("pre: %s %d\n", g->name.c_str(), g->pre_stems.size());
}
for(Gate *g : gates) {
if(g->isPO) continue;
std::queue<Gate*> q;
std::unordered_map<Gate*, bool> used;
q.push(g);
while(!q.empty()) {
Gate* now = q.front();
q.pop();
for(Gate* out : now->outputs) {
if(out->stem) {
g->suc_stems.push_back(out);
} else if(!used[out]) {
used[out] = true;
q.push(out);
}
}
}
//printf("pre: %s %d\n", g->name.c_str(), g->pre_stems.size());
}
}
void Circuit::init_topo_index() {
int topo = 1;
std::queue<Gate*> q;
std::unordered_map<Gate*, int> ins;
for(Gate* gate : gates) {
ins[gate] = gate->inputs.size();
}
for(auto in : PIs) {
in->id = topo++;
q.push(in);
}
while(!q.empty()) {
Gate* g = q.front(); q.pop();
for(Gate* out : g->outputs) {
ins[out]--;
if(ins[out] == 0) {
out->id = topo++;
q.push(out);
}
}
}
}
void Circuit::print_gates() {
static const char* type2name[9] = {"AND", "NAND", "OR", "NOR", "XOR", "XNOR", "NOT", "BUF", "IN"};
for(Gate* gate : gates) {
printf("Gate: %3s (t:%4s v:%d pi:%d po:%d s:%d p:%d s0:%d s1:%d) Inputs:", gate->name.c_str(), type2name[gate->type], gate->value, gate->isPI, gate->isPO, gate->stem, gate->is_propagated(), gate->sa[0], gate->sa[1]);
for(Gate* in : gate->inputs) {
printf(" %s", in->name.c_str());
}
printf("\n");
}
}
bool Circuit::is_valid_circuit() {
ll flip_total_weight = 0;
ll stem_total_weight = 0;
ll fault_total_weight = 0;
int flip_total_cnt = 0;
int stem_total_cnt = 0;
int fault_total_cnt = 0;
//printf("flip: %d, stem: %d, fault:%d\n", flip_total_weight, stem_total_weight, fault_total_weight);
for(Gate* g : gates) {
if(flip_need_update[g->id]) {
flip_total_weight += flip_weight[g->id];
flip_total_cnt++;
}
if(g->stem && g->cal_value() != g->value) {
stem_total_weight += stem_weight[g->id];
}
if(g->stem && g->cal_value() == g->value) {
stem_total_cnt++;
}
if(g->sa[0]) {
fault_total_weight += fault_weight[g->id][0];
fault_total_cnt += 1;
}
if(g->sa[1]) {
fault_total_weight += fault_weight[g->id][1];
fault_total_cnt += 1;
}
// 检查门的赋值情况
if(g->cal_value() != g->value) {
printf("WRONG-ASSGIN: %s \n", g->name.c_str());
return false;
}
// 检查 PO 的传播设定是否正确
if(g->isPO) {
if(g->sa[g->value] != 0 || g->sa[!g->value] == 0 ) {
printf("WRONG-PO: %s \n", g->name.c_str());
}
continue;
}
// 非 PO 情况下检查故障传播是否正确
bool sa0 = false;
bool sa1 = false;
for(Gate* out : g->outputs) {
if(out->cal_value() != out->value) {
assert(out->stem);
continue;
}
g->value = !g->value;
if(out->cal_value() != out->value) {
sa0 |= out->is_propagated() && !g->value;
sa1 |= out->is_propagated() && g->value;
}
g->value = !g->value;
}
if(sa0 != g->sa[0] || sa1 != g->sa[1]) {
printf("WRONG-SA: %s \n", g->name.c_str());
return false;
}
}
if(this->flip_total_weight != flip_total_weight || this->stem_total_weight != stem_total_weight || this->fault_total_weight != fault_total_weight) {
printf("CIRCUIT CHECK FAILED!\n");
printf("[wrong] flip: %d, stem: %d, fault:%d\n", this->flip_total_weight, this->stem_total_weight, this->fault_total_weight);
printf("[right] flip: %d, stem: %d, fault:%d\n", flip_total_weight, stem_total_weight, fault_total_weight);
return false;
}
if(this->flip_total_cnt != flip_total_cnt || this->stem_total_cnt != stem_total_cnt || this->fault_total_cnt != fault_total_cnt) {
printf("CIRCUIT CHECK FAILED!\n");
printf("[wrong] flip_cnt: %d, stem_cnt: %d, fault_cnt:%d\n", this->flip_total_cnt, this->stem_total_cnt, this->fault_total_cnt);
printf("[right] flip_cnt: %d, stem_cnt: %d, fault_cnt:%d\n", flip_total_cnt, stem_total_cnt, fault_total_weight);
return false;
}
return true;
}

107
circuit.h
View File

@ -1,107 +0,0 @@
#pragma once
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
using ll = long long;
class Gate {
public:
int id;
std::string name;
enum Type { AND, NAND, OR, NOR, XOR, XNOR, NOT, BUF, INPUT } type;
int value;
bool sa[2];
bool stem;
bool isPI;
bool isPO;
std::unordered_map<Gate*, std::pair<int, int>> sa_by_out;
std::vector<Gate*> pre_stems;
std::vector<Gate*> suc_stems;
std::vector<Gate*> outputs;
std::vector<Gate*> inputs;
bool is_propagated();
int cal_value();
};
class Fault {
public:
Gate* gate;
enum Type { SA0, SA1 } type;
Fault(Gate* gate, Type type):gate(gate),type(type) {}
};
class Circuit {
public:
std::vector<Gate*> PIs;
std::vector<Gate*> POs;
std::vector<Gate*> gates;
std::vector<Gate*> stems; // PI + stems
std::unordered_map<std::string, Gate*> name2gate;
std::queue<Gate*> tmp;
std::unordered_map<Gate*, bool> tmp_used;
void parse_from_file(const char *filename);
void print_gates();
bool is_valid_circuit();
void init_topo_index();
void init_stems();
// local search
bool local_search(std::unordered_set<Fault*> &faults);
// incremental flip struct
const double SP = 0.01;
const int FLIP_INC = 1;
const int FLIP_WEIGHT_MAX = 1e9;
int* CC;
ll flip_total_weight;
int flip_total_cnt;
int* flip_weight;
int* flip_need_update;
std::vector<Gate*> flip_update_queue;
// incremental stem struct
const int STEM_INC = 10;
const int STEM_WEIGHT_MAX = 1e9;
ll stem_total_weight;
int stem_total_cnt;
int* stem_weight;
int* stem_satisfied;
const int FAULT_INC = 1;
const int FAULT_WEIGHT_MAX = 20;
ll fault_total_weight;
int fault_total_cnt;
int** fault_weight;
int** fault_detected;
void ls_init_circuit();
void ls_init_weight(const std::unordered_set<Fault*> &faults);
void ls_update_weight();
void ls_init_data_structs();
void ls_block_recal(Gate* stem);
void ls_flip(Gate* stem);
void ls_update(Gate* stem);
ll ls_pick_score(Gate* stem);
ll ls_score();
};

9
crun
View File

@ -2,12 +2,17 @@
clear
make -j 16
mkdir -p build
cd build
cmake .. && make -j
if [ $? -ne 0 ]; then
echo "compile failed."
else
cd ..
clear
echo "========================"
time ./atpg $1
time ./build/src/atpg -i $1 --lut=12 --seed=19260817
fi

View File

@ -1,66 +0,0 @@
#include "circuit.h"
#include "assert.h"
bool Gate::is_propagated() {
return sa[0] || sa[1];
}
int Gate::cal_value() {
int res;
switch(type) {
case NOT:
res = !inputs[0]->value;
break;
case BUF:
res = inputs[0]->value;
break;
case AND:
res = inputs[0]->value;
for(int i=1; i<inputs.size(); i++) {
res &= inputs[i]->value;
}
break;
case NAND:
res = inputs[0]->value;
for(int i=1; i<inputs.size(); i++) {
res &= inputs[i]->value;
}
res = !res;
break;
case OR:
res = inputs[0]->value;
for(int i=1; i<inputs.size(); i++) {
res |= inputs[i]->value;
}
break;
case NOR:
res = inputs[0]->value;
for(int i=1; i<inputs.size(); i++) {
res |= inputs[i]->value;
}
res = !res;
break;
case XOR:
res = inputs[0]->value;
for(int i=1; i<inputs.size(); i++) {
res ^= inputs[i]->value;
}
break;
case XNOR:
res = inputs[0]->value;
for(int i=1; i<inputs.size(); i++) {
res ^= inputs[i]->value;
}
res = !res;
break;
case INPUT:
res = value;
break;
default:
assert(false);
break;
}
return res;
}

481
ls.cpp
View File

@ -1,481 +0,0 @@
#include "circuit.h"
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include "assert.h"
bool Circuit::local_search(std::unordered_set<Fault*> &faults) {
//STEM_INC = 0;
// 初始化并重置所有 ls 数据结构
ls_init_data_structs();
// 赋值初始权重
ls_init_weight(faults);
// 随机生成初始电路
ls_init_circuit();
printf("local search!\n");
while(true) {
Gate* stem = nullptr;
ll max_score = 0;
std::vector<Gate*> stems_random;
std::vector<Gate*> candidates;
for(int i=0; i<stems.size(); i++) {
if(CC[stems[i]->id]) {
stems_random.push_back(stems[i]);
}
}
for(int i=0; i<stems_random.size(); i++) {
std::swap(stems_random[i], stems_random[rand()%stems_random.size()]);
}
const int T = 100;
int t = 0;
for(int i=0; i<stems_random.size(); i++) {
Gate* t_stem = stems_random[i];
ll t_score = ls_pick_score(t_stem);
if(t_score > max_score) {
max_score = t_score;
stem = t_stem;
}
if(t_score > 0) t++;
if(i >= T) break;
}
if(max_score > 0) {
// printf("FLIP: %s (+%lld)\n", stem->name.c_str(), max_score);
// printf("[LS] flip: %lld, stem: %lld, fault:%lld. flip_cnt: %d, stem_cnt: %d, fault_cnt:%d\n", flip_total_weight, stem_total_weight, fault_total_weight, flip_total_cnt, stem_total_cnt, fault_total_cnt);
ls_flip(stem);
CC[stem->id] = 0;
for(Gate* pre : stem->pre_stems) {
CC[pre->id] = 1;
}
for(Gate* suc : stem->suc_stems) {
CC[suc->id] = 1;
}
} else {
ls_update_weight();
while(!flip_update_queue.empty()) {
Gate* g = flip_update_queue.back();
flip_update_queue.pop_back();
if(!flip_need_update[g->id]) continue;
flip_need_update[g->id] = false;
flip_total_weight -= flip_weight[g->id];
flip_total_cnt -= 1;
ls_update(g);
}
if(stem_total_cnt == stems.size() && flip_total_cnt == 0) {
printf("FIND SOLUTION!\n");
printf("[SOL] flip: %lld, stem: %lld, fault:%lld. flip_cnt: %d, stem_cnt: %d, fault_cnt:%d\n", flip_total_weight, stem_total_weight, fault_total_weight, flip_total_cnt, stem_total_cnt, fault_total_cnt);
break;
}
std::vector<Gate*> candidates;
for(Gate *g : stems) {
if(g->isPO) continue;
if(stem_satisfied[g->id]) continue;
candidates.push_back(g);
}
if(candidates.size() == 0) {
candidates.push_back(stems[rand()%stems.size()]);
}
Gate* pick = candidates[rand()%candidates.size()];
ls_flip(pick);
CC[pick->id] = 0;
for(Gate* pre : pick->pre_stems) {
CC[pre->id] = 1;
}
for(Gate* suc : pick->suc_stems) {
CC[suc->id] = 1;
}
printf("[UP] flip: %lld, stem: %lld, fault:%lld. flip_cnt: %lld, stem_cnt: %lld, fault_cnt:%lld\n", flip_total_weight, stem_total_weight, fault_total_weight, flip_total_cnt, stem_total_cnt, fault_total_cnt);
}
}
static int original_faults = -1;
if(original_faults == - 1) {
original_faults = faults.size();
}
static int pattern = 0;
std::unordered_set<Fault*> tmp = faults;
for(Fault* f : tmp) {
if(f->gate->sa[f->type]) {
faults.erase(f);
}
}
if(tmp.size() == faults.size()) pattern--;
printf("coverage: %.4f\tpattern: %d\tbefore: %d\tnow: %d\n", (double)(original_faults - faults.size()) / (original_faults), ++pattern, tmp.size(), faults.size());
//if(tmp.size() == faults.size()) return false;
return true;
}
void Circuit::ls_update_weight() {
//STEM_INC += 5;
if(rand() % 10000 <= SP * 10000) {
for(Gate* g : gates) {
if(g->stem && stem_satisfied[g->id] && (stem_weight[g->id] - STEM_INC >= 1)) {
stem_weight[g->id] -= STEM_INC;
for(Gate* suc : g->suc_stems) {
if(stem_weight[suc->id] + STEM_INC <= STEM_WEIGHT_MAX) {
stem_weight[suc->id] += STEM_INC;
if(!stem_satisfied[suc->id]) {
stem_total_weight += STEM_INC;
}
}
}
}
}
} else {
for(Gate* g : gates) {
if(flip_need_update[g->id] && (flip_weight[g->id] + FLIP_INC < FLIP_WEIGHT_MAX)) {
flip_weight[g->id] += FLIP_INC;
flip_total_weight += FLIP_INC;
}
if(g->stem && !stem_satisfied[g->id] && (stem_weight[g->id] + STEM_INC < STEM_WEIGHT_MAX)) {
stem_weight[g->id] += STEM_INC;
stem_total_weight += STEM_INC;
for(Gate* suc : g->suc_stems) {
if(stem_weight[suc->id] - STEM_INC > 1) {
stem_weight[suc->id] -= STEM_INC;
if(!stem_satisfied[suc->id]) {
stem_total_weight -= STEM_INC;
}
}
}
}
for(int i=0; i<=1; i++) {
for(Gate* pre : g->suc_stems) {
// int inc = 0.2 * fault_weight[pre->id][i];
// inc = std::max(1, inc);
// if(g->type == Gate::NAND || g->type == Gate::NOR || g->type == Gate::NOT || g->type == Gate::XNOR) {
// if(fault_weight[g->id][!pre->value] + inc <= FAULT_WEIGHT_MAX) {
// fault_weight[g->id][!pre->value] += inc;
// if(g->sa[!pre->value]) fault_total_weight += inc;
// }
// } else {
// if(fault_weight[g->id][pre->value] + inc <= FAULT_WEIGHT_MAX) {
// fault_weight[g->id][pre->value] += inc;
// if(g->sa[pre->value]) fault_total_weight += inc;
// }
// }
// if(fault_weight[suc->id][1] + inc <= FAULT_WEIGHT_MAX) {
// fault_weight[suc->id][1] += inc;
// if(suc->sa[1]) fault_total_weight += inc;
// }
}
}
if(!g->sa[0] && fault_weight[g->id][0] > 0 && (fault_weight[g->id][0] + FAULT_INC < FAULT_WEIGHT_MAX)) {
fault_weight[g->id][0] += FAULT_INC;
}
if(!g->sa[1] && fault_weight[g->id][1] > 0 && (fault_weight[g->id][1] + FAULT_INC < FAULT_WEIGHT_MAX)) {
fault_weight[g->id][1] += FAULT_INC;
}
}
}
}
bool cmp(Gate* a, Gate *b) {
return a->id > b->id;
}
void Circuit::ls_flip(Gate* stem) {
stem->value = !stem->value;
ls_block_recal(stem);
}
void Circuit::ls_update(Gate* stem) {
ls_block_recal(stem);
}
ll Circuit::ls_pick_score(Gate* stem) {
ll old_score = ls_score();
ls_flip(stem);
ll new_score = ls_score();
ls_flip(stem);
old_score = std::max(old_score, ls_score());
return new_score - old_score;
}
ll Circuit::ls_score() {
//ll score = -flip_total_weight -stem_total_weight + fault_total_weight;
ll score = -flip_total_weight -stem_total_weight + fault_total_weight;
return score;
}
void Circuit::ls_init_weight(const std::unordered_set<Fault*> &faults) {
for(Gate* s : stems) {
stem_weight[s->id] = 1;
stem_total_weight += stem_weight[s->id];
}
for(Fault* f : faults) {
fault_weight[f->gate->id][f->type] = 1;
}
for(Gate* s: stems) {
flip_weight[s->id] = 1;
}
}
void Circuit::ls_init_circuit() {
for(Gate* g : gates) {
g->sa[0] = 0;
g->sa[1] = 0;
}
for(Gate* s : stems) {
s->value = rand() % 2;
}
for(int i=stems.size()-1; i>=0; i--) {
ls_update(stems[i]);
}
while(!flip_update_queue.empty()) {
Gate* g = flip_update_queue.back();
flip_update_queue.pop_back();
if(!flip_need_update[g->id]) continue;
flip_need_update[g->id] = false;
flip_total_weight -= flip_weight[g->id];
flip_total_cnt -= 1;
ls_update(g);
}
}
void Circuit::ls_init_data_structs() {
const int MAX_LEN = gates.size() + 1;
if(flip_weight == nullptr) {
CC = new int[MAX_LEN];
flip_weight = new int[MAX_LEN];
flip_need_update = new int[MAX_LEN];
stem_weight = new int[MAX_LEN];
stem_satisfied = new int[MAX_LEN];
fault_weight = new int*[MAX_LEN];
for(int i=0; i<MAX_LEN; i++) {
fault_weight[i] = new int[2];
}
fault_detected = new int*[MAX_LEN];
for(int i=0; i<MAX_LEN; i++) {
fault_detected[i] = new int[2];
}
}
flip_total_weight = 0;
flip_total_cnt = 0;
stem_total_weight = 0;
stem_total_cnt = 0;
fault_total_weight = 0;
fault_total_cnt = 0;
for(int i=0; i<MAX_LEN; i++) {
CC[i] = 1;
flip_weight[i] = 0;
flip_need_update[i] = 0;
stem_weight[i] = 0;
stem_satisfied[i] = 0;
fault_weight[i][0] = 0;
fault_weight[i][1] = 0;
fault_detected[i][0] = 0;
fault_detected[i][1] = 0;
}
}
void Circuit::ls_block_recal(Gate* stem) {
if(flip_need_update[stem->id]) {
flip_need_update[stem->id] = false;
flip_total_weight -= flip_weight[stem->id];
flip_total_cnt -= 1;
}
if(stem->cal_value() == stem->value && !stem_satisfied[stem->id]){
stem_satisfied[stem->id] = true;
stem_total_weight -= stem_weight[stem->id];
stem_total_cnt += 1;
}
if(stem->cal_value() != stem->value && stem_satisfied[stem->id]) {
stem_satisfied[stem->id] = false;
stem_total_weight += stem_weight[stem->id];
stem_total_cnt -= 1;
}
//printf("flip: %s\n", stem->name.c_str());
//stem->value = !stem->value;
if(stem->isPO) {
if(stem->sa[!stem->value] == false) {
fault_total_weight += fault_weight[stem->id][!stem->value];
fault_total_cnt += 1;
stem->sa[!stem->value] = true;
}
if(stem->sa[stem->value] == true) {
fault_total_weight -= fault_weight[stem->id][stem->value];
fault_total_cnt -= 1;
stem->sa[stem->value] = false;
}
}
std::queue<Gate*> q;
std::unordered_map<Gate*, int> used;
std::vector<Gate*> suc_stems;
q.push(stem);
while(!q.empty()) {
Gate* g = q.front();
q.pop();
used[g] = false;
for(Gate* out : g->outputs) {
if(out->stem) {
suc_stems.push_back(out);
continue;
}
out->value = out->cal_value();
if(!used[out]) {
used[out] = true;
q.push(out);
}
}
}
assert(q.empty());
used.clear();
for(Gate* stem : suc_stems) {
q.push(stem);
if(stem->cal_value() == stem->value && !stem_satisfied[stem->id]){
stem_satisfied[stem->id] = true;
stem_total_weight -= stem_weight[stem->id];
stem_total_cnt += 1;
}
if(stem->cal_value() != stem->value && stem_satisfied[stem->id]) {
stem_satisfied[stem->id] = false;
stem_total_weight += stem_weight[stem->id];
stem_total_cnt -= 1;
}
}
while(!q.empty()) {
Gate *g = q.front();
q.pop();
used[g] = false;
bool right_value = (g->cal_value() == g->value);
for(Gate* in : g->inputs) {
in->value = !in->value;
bool input_detected = (g->cal_value() != g->value);
in->value = !in->value;
bool sa0 = right_value && input_detected && g->sa[!g->value] && in->value;
bool sa1 = right_value && input_detected && g->sa[!g->value] && !in->value;
in->sa_by_out[g] = std::make_pair(sa0, sa1);
bool old_sa[2];
old_sa[0] = in->sa[0];
old_sa[1] = in->sa[1];
in->sa[0] = in->sa[1] = 0;
for(Gate* out : in->outputs) {
auto &p = in->sa_by_out[out];
in->sa[0] |= p.first;
in->sa[1] |= p.second;
}
if(in->stem && !in->isPI && (in->sa[0] != old_sa[0] || in->sa[1] != old_sa[1])) {
for(Gate* pre : in->pre_stems) {
if(flip_need_update[pre->id]) continue;
flip_need_update[pre->id] = true;
flip_update_queue.push_back(pre);
flip_total_weight += flip_weight[pre->id];
flip_total_cnt += 1;
}
}
if(old_sa[0] != in->sa[0]) {
if(in->sa[0]) {
fault_total_weight += fault_weight[in->id][0];
fault_total_cnt += 1;
} else {
fault_total_weight -= fault_weight[in->id][0];
fault_total_cnt -= 1;
}
}
if(old_sa[1] != in->sa[1]) {
if(in->sa[1]) {
fault_total_weight += fault_weight[in->id][1];
fault_total_cnt += 1;
} else {
fault_total_weight -= fault_weight[in->id][1];
fault_total_cnt -= 1;
}
}
if(!in->stem && !used[in]) {
used[in] = true;
q.push(in);
}
}
}
}

View File

@ -1,52 +0,0 @@
#include <cstdio>
#include <cstdlib>
#include <assert.h>
#include "circuit.h"
int main(int args, char* argv[]) {
if(args != 2) {
printf("usage: ./atpg <XXX.bench>\n");
exit(1);
}
srand(19260817);
Circuit* circuit = new Circuit();
printf("parsing file %s ...", argv[1]);
circuit->parse_from_file(argv[1]);
circuit->init_stems();
circuit->init_topo_index();
printf(" Done.\n");
printf("====== Circuit Statistics ====== \n");
printf("PI:\t%ld\n", circuit->PIs.size());
printf("PO:\t%ld\n", circuit->POs.size());
printf("Gate:\t%ld\n", circuit->name2gate.size());
printf("Stem:\t%ld\n", circuit->stems.size());
printf("================================ \n");
std::unordered_set<Fault*> faults;
// init faults
for(auto g : circuit->gates) {
faults.insert(new Fault(g, Fault::SA0));
faults.insert(new Fault(g, Fault::SA1));
}
while(true) {
bool ls = circuit->local_search(faults);
bool is_valid = circuit->is_valid_circuit();
printf("checking valid circuit ...");
printf(" result: %d.\n", is_valid);
if(!ls) break;
if(!is_valid) break;
if(faults.size() == 0) break;
}
//printf("[final] flip: %d, stem: %d, fault:%d\n", circuit->flip_total_weight, circuit->stem_total_weight, circuit->fault_total_weight);
return 0;
}

View File

@ -1,72 +0,0 @@
#一个实用的makefile能自动编译当前目录下所有.c/.cpp源文件支持二者混合编译
#并且当某个.c/.cpp、.h或依赖的源文件被修改后仅重编涉及到的源文件未涉及的不编译
#详解文档http://blog.csdn.net/huyansoft/article/details/8924624
#author胡彦 2013-5-21
#----------------------------------------------------------
#编译工具用g++以同时支持C和C++程序,以及二者的混合编译
CC=g++
CPPFLAGS=-O3 -std=c++17
#使用$(winldcard *.c)来获取工作目录下的所有.c文件的列表
#sources:=main.cpp command.c
#变量sources得到当前目录下待编译的.c/.cpp文件的列表两次调用winldcard、结果连在一起即可
sources:=$(wildcard *.c) $(wildcard *.cpp)
#变量objects得到待生成的.o文件的列表把sources中每个文件的扩展名换成.o即可。这里两次调用patsubst函数第1次把sources中所有.cpp换成.o第2次把第1次结果里所有.c换成.o
objects:=$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(sources)))
#变量dependence得到待生成的.d文件的列表把objects中每个扩展名.o换成.d即可。也可写成$(patsubst %.o,%.d,$(objects))
dependence:=$(objects:.o=.d)
#----------------------------------------------------------
#当$(objects)列表里所有文件都生成后,便可调用这里的 $(CC) $^ -o $@ 命令生成最终目标all了
#把all定义成第1个规则使得可以把make all命令简写成make
atpg: $(objects)
$(CC) $(CPPFLAGS) $^ -o $@
# @./$@ #编译后立即执行
#这段使用make的模式规则指示如何由.c文件生成.o即对每个.c文件调用gcc -c XX.c -o XX.o命令生成对应的.o文件
#如果不写这段也可以因为make的隐含规则可以起到同样的效果
%.o: %.c
$(CC) $(CPPFLAGS) -c $< -o $@
#同上,指示如何由.cpp生成.o可省略
%.o: %.cpp
$(CC) $(CPPFLAGS) -c $< -o $@
#----------------------------------------------------------
include $(dependence) #注意该句要放在终极目标all的规则之后否则.d文件里的规则会被误当作终极规则了
#因为这4行命令要多次凋用定义成命令包以简化书写
define gen_dep
set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
endef
#指示如何由.c生成其依赖规则文件.d
#这段使用make的模式规则指示对每个.c文件如何生成其依赖规则文件.d调用上面的命令包即可
%.d: %.c
$(gen_dep)
#同上,指示对每个.cpp如何生成其依赖规则文件.d
%.d: %.cpp
$(gen_dep)
#----------------------------------------------------------
#清除所有临时文件(所有.o和.d。之所以把clean定义成伪目标是因为这个目标并不对应实际的文件
.PHONY: clean
clean: #.$$已在每次使用后立即删除。-f参数表示被删文件不存在时不报错
rm -f all $(objects) $(dependence)
echo: #调试时显示一些变量的值
@echo sources=$(sources)
@echo objects=$(objects)
@echo dependence=$(dependence)
@echo CPPFLAGS=$(CPPFLAGS)
#提醒:当混合编译.c/.cpp时为了能够在C++程序里调用C函数必须把每一个要调用的C函数其声明都包括在extern "C"{}块里面这样C++链接时才能成功链接它们。

16104
output.txt

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
---------------------------------------------------------------------------------------------------------------
| data | fault coverage(ATPG-LS) | time(ATPG-LS) | cube(ATPG-LS) | pattern(ATPG-LS) |
| ----------------------- | ----------------------- | -------------------- | ------------- | ---------------- |
| ./benchmark/c17.bench | 100.000 | 0.035004615783691406 | 5 | 5 |
| ./benchmark/b06.bench | 100.000 | 0.07079482078552246 | 11 | 11 |
| ./benchmark/b01.bench | 100.000 | 0.09065485000610352 | 14 | 14 |
| ./benchmark/b03.bench | 100.000 | 2.3637137413024902 | 14 | 14 |
| ./benchmark/b09.bench | 100.000 | 3.8993797302246094 | 18 | 18 |
| ./benchmark/b10.bench | 100.000 | 6.369290351867676 | 29 | 29 |
| ./benchmark/b08.bench | 100.000 | 7.467808723449707 | 35 | 35 |
| ./benchmark/c880.bench | 100.000 | 50.42959809303284 | 22 | 22 |
| ./benchmark/c499.bench | 100.000 | 65.37915563583374 | 49 | 49 |
| ./benchmark/c1355.bench | 100.000 | 363.1095223426819 | 82 | 82 |
| ./benchmark/b17.bench | ERROR | 2000.0039329528809 | ERROR | ERROR |
| ./benchmark/c7552.bench | 25.531 | 2000.0044975280762 | 1 | 1 |
| ./benchmark/b20.bench | ERROR | 2000.0045347213745 | ERROR | ERROR |
| ./benchmark/b11.bench | 98.951 | 2000.0055797100067 | 47 | 47 |
| ./benchmark/c3540.bench | 93.543 | 2000.006273508072 | 63 | 63 |
| ./benchmark/c1908.bench | 95.893 | 2000.0061783790588 | 39 | 39 |
| ./benchmark/b22.bench | ERROR | 2000.0057337284088 | ERROR | ERROR |
| ./benchmark/c2670.bench | 82.328 | 2000.0055947303772 | 31 | 31 |
| ./benchmark/b21.bench | ERROR | 2000.0054640769958 | ERROR | ERROR |
| ./benchmark/c6288.bench | 92.116 | 2000.0076813697815 | 5 | 5 |
| ./benchmark/c5315.bench | 33.139 | 2000.0081040859222 | 2 | 2 |
| ./benchmark/b04.bench | 99.744 | 2000.0090584754944 | 45 | 45 |
| ./benchmark/b12.bench | 91.771 | 2000.0079457759857 | 81 | 81 |
| ./benchmark/b07.bench | 98.568 | 2000.00936460495 | 29 | 29 |
| ./benchmark/c432.bench | 99.235 | 2000.0103182792664 | 19 | 19 |
| ./benchmark/b13.bench | 98.602 | 2000.009345293045 | 32 | 32 |
---------------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,30 @@
--------------------------------------------------------------------------------------------------------------
| data | fault coverage(ATPG-LS) | time(ATPG-LS) | cube(ATPG-LS) | pattern(ATPG-LS) |
| ----------------------- | ----------------------- | ------------------- | ------------- | ---------------- |
| ./benchmark/c17.bench | 100.000 | 0.11560654640197754 | 4 | 4 |
| ./benchmark/b06.bench | 100.000 | 0.11869049072265625 | 10 | 10 |
| ./benchmark/b01.bench | 100.000 | 0.3559579849243164 | 13 | 13 |
| ./benchmark/b03.bench | 100.000 | 0.8975160121917725 | 13 | 13 |
| ./benchmark/b09.bench | 100.000 | 6.73541784286499 | 20 | 20 |
| ./benchmark/c880.bench | 100.000 | 13.738963603973389 | 38 | 38 |
| ./benchmark/b10.bench | 100.000 | 13.915901899337769 | 31 | 31 |
| ./benchmark/b08.bench | 100.000 | 44.885215282440186 | 36 | 36 |
| ./benchmark/c499.bench | 100.000 | 72.9014344215393 | 59 | 59 |
| ./benchmark/c1355.bench | 100.000 | 354.89149928092957 | 93 | 93 |
| ./benchmark/c3540.bench | 92.932 | 2000.0045857429504 | 126 | 126 |
| ./benchmark/c1908.bench | 99.452 | 2000.0044167041779 | 85 | 85 |
| ./benchmark/b11.bench | 98.485 | 2000.0039746761322 | 59 | 59 |
| ./benchmark/c6288.bench | 99.653 | 2000.005141735077 | 37 | 37 |
| ./benchmark/c2670.bench | 94.881 | 2000.0041010379791 | 75 | 75 |
| ./benchmark/b21.bench | 45.309 | 2000.031025648117 | 21 | 21 |
| ./benchmark/b13.bench | 98.602 | 2000.030693769455 | 30 | 30 |
| ./benchmark/b22.bench | 30.701 | 2000.1147837638855 | 4 | 4 |
| ./benchmark/b17.bench | ERROR | 2000.1162934303284 | ERROR | ERROR |
| ./benchmark/b20.bench | 48.958 | 2000.1155791282654 | 19 | 19 |
| ./benchmark/c7552.bench | 95.832 | 2000.1170272827148 | 134 | 134 |
| ./benchmark/b12.bench | 94.418 | 2000.1147434711456 | 123 | 123 |
| ./benchmark/c5315.bench | 99.175 | 2000.1144452095032 | 139 | 139 |
| ./benchmark/b04.bench | 99.659 | 2000.1151909828186 | 50 | 50 |
| ./benchmark/b07.bench | 98.687 | 2000.1153008937836 | 34 | 34 |
| ./benchmark/c432.bench | 99.235 | 2000.1161303520203 | 28 | 28 |
--------------------------------------------------------------------------------------------------------------

30
report/atpg-ls.txt Normal file
View File

@ -0,0 +1,30 @@
--------------------------------------------------------------------------------------------------------
| data | fault coverage(ATPG-LS) | time(ATPG-LS) | cube(ATPG-LS) | pattern(ATPG-LS) |
| ----------------------- | ----------------------- | ------------- | ------------- | ---------------- |
| ./benchmark/c6288.bench | 99.653 | -*- | 27 | 27 |
| ./benchmark/c17.bench | 100.000 | -*- | 4 | 4 |
| ./benchmark/b17.bench | ERROR | -*- | ERROR | ERROR |
| ./benchmark/b22.bench | ERROR | -*- | ERROR | ERROR |
| ./benchmark/b13.bench | 95.652 | -*- | 35 | 35 |
| ./benchmark/c880.bench | 100.000 | -*- | 45 | 45 |
| ./benchmark/b07.bench | 90.453 | -*- | 26 | 26 |
| ./benchmark/c432.bench | 99.235 | -*- | 29 | 29 |
| ./benchmark/c5315.bench | ERROR | -*- | ERROR | ERROR |
| ./benchmark/b20.bench | ERROR | -*- | ERROR | ERROR |
| ./benchmark/c1355.bench | 99.744 | -*- | 103 | 103 |
| ./benchmark/b01.bench | 100.000 | -*- | 15 | 15 |
| ./benchmark/b10.bench | 100.000 | -*- | 33 | 33 |
| ./benchmark/b03.bench | 100.000 | -*- | 18 | 18 |
| ./benchmark/b11.bench | 95.688 | -*- | 44 | 44 |
| ./benchmark/b08.bench | 100.000 | -*- | 34 | 34 |
| ./benchmark/c3540.bench | 90.169 | -*- | 96 | 96 |
| ./benchmark/c2670.bench | 82.609 | -*- | 53 | 53 |
| ./benchmark/b09.bench | 100.000 | -*- | 20 | 20 |
| ./benchmark/c7552.bench | 95.133 | -*- | 103 | 103 |
| ./benchmark/b04.bench | 73.424 | -*- | 15 | 15 |
| ./benchmark/b12.bench | ERROR | -*- | ERROR | ERROR |
| ./benchmark/b21.bench | ERROR | -*- | ERROR | ERROR |
| ./benchmark/b06.bench | 100.000 | -*- | 13 | 13 |
| ./benchmark/c499.bench | 100.000 | -*- | 55 | 55 |
| ./benchmark/c1908.bench | 99.179 | -*- | 91 | 91 |
--------------------------------------------------------------------------------------------------------

90
res.txt
View File

@ -1,90 +0,0 @@
parsing file c432.bench...
INPUT(1)
tokens: $INPUT$ $($ $1$ $)$
INPUT(4)
tokens: $INPUT$ $($ $4$ $)$
INPUT(8)
tokens: $INPUT$ $($ $8$ $)$
INPUT(11)
tokens: $INPUT$ $($ $11$ $)$
INPUT(14)
tokens: $INPUT$ $($ $14$ $)$
INPUT(17)
tokens: $INPUT$ $($ $17$ $)$
INPUT(21)
tokens: $INPUT$ $($ $21$ $)$
INPUT(24)
tokens: $INPUT$ $($ $24$ $)$
INPUT(27)
tokens: $INPUT$ $($ $27$ $)$
INPUT(30)
tokens: $INPUT$ $($ $30$ $)$
INPUT(34)
tokens: $INPUT$ $($ $34$ $)$
INPUT(37)
tokens: $INPUT$ $($ $37$ $)$
INPUT(40)
tokens: $INPUT$ $($ $40$ $)$
INPUT(43)
tokens: $INPUT$ $($ $43$ $)$
INPUT(47)
tokens: $INPUT$ $($ $47$ $)$
INPUT(50)
tokens: $INPUT$ $($ $50$ $)$
INPUT(53)
tokens: $INPUT$ $($ $53$ $)$
INPUT(56)
tokens: $INPUT$ $($ $56$ $)$
INPUT(60)
tokens: $INPUT$ $($ $60$ $)$
INPUT(63)
tokens: $INPUT$ $($ $63$ $)$
INPUT(66)
tokens: $INPUT$ $($ $66$ $)$
INPUT(69)
tokens: $INPUT$ $($ $69$ $)$
INPUT(73)
tokens: $INPUT$ $($ $73$ $)$
INPUT(76)
tokens: $INPUT$ $($ $76$ $)$
INPUT(79)
tokens: $INPUT$ $($ $79$ $)$
INPUT(82)
tokens: $INPUT$ $($ $82$ $)$
INPUT(86)
tokens: $INPUT$ $($ $86$ $)$
INPUT(89)
tokens: $INPUT$ $($ $89$ $)$
INPUT(92)
tokens: $INPUT$ $($ $92$ $)$
INPUT(95)
tokens: $INPUT$ $($ $95$ $)$
INPUT(99)
tokens: $INPUT$ $($ $99$ $)$
INPUT(102)
tokens: $INPUT$ $($ $102$ $)$
INPUT(105)
tokens: $INPUT$ $($ $105$ $)$
INPUT(108)
tokens: $INPUT$ $($ $108$ $)$
INPUT(112)
tokens: $INPUT$ $($ $112$ $)$
INPUT(115)
tokens: $INPUT$ $($ $115$ $)$
OUTPUT(223)
tokens: $OUTPUT$ $($ $223$ $)$
OUTPUT(329)
tokens: $OUTPUT$ $($ $329$ $)$
OUTPUT(370)
tokens: $OUTPUT$ $($ $370$ $)$
OUTPUT(421)
tokens: $OUTPUT$ $($ $421$ $)$
OUTPUT(430)
tokens: $OUTPUT$ $($ $430$ $)$
OUTPUT(431)
tokens: $OUTPUT$ $($ $431$ $)$
OUTPUT(432)
tokens: $OUTPUT$ $($ $432$ $)$
118 = NOT(1)
tokens: $118$ $=$ $NOT$ $($ $1$ $)$
Error while reading line: 118 = NOT(1)

19
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.20)
project(atpg)
set(CMAKE_CXX_STANDARD 17)
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -march=native -flto -static")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -static")
#
aux_source_directory(${PROJECT_SOURCE_DIR} SOURCES)
set(INCLUDES ${PROJECT_SOURCE_DIR})
#
include_directories(${INCLUDES}, ${PROJECT_SOURCE_DIR}/../tg-pro/src)
#
add_executable(${PROJECT_NAME} ${SOURCES})

79
src/checker.cpp Normal file
View File

@ -0,0 +1,79 @@
#include <unordered_set>
#include "circuit.h"
using namespace atpg_ls;
double LUTCircuit::check() {
// static bool init = 0;
// static std::unordered_set<Gate*> dt;
printf("checking circuit ...\n");
double score_value_unsatisfied_cost = 0;
double score_fault_detected_weight = 0;
double score_fault_propagated_weight = 0;
double score_fault_update_cost = 0;
int unsatisfied_lut = 0;
for(LUT* lut : luts) {
assert(lut->vsat == (lut->value == lut->cal_value()));
if(!lut->vsat) {
score_value_unsatisfied_cost += lut->vunat_cost;
unsatisfied_lut++;
// printf("vunsat: %s\n", lut->name);
}
if(lut->uptag) {
score_fault_update_cost += lut->up_cost;
} else {
int t_fd[2], t_fpl[2];
lut->cal_fault_info(t_fd, t_fpl);
assert(t_fd[0] == lut->fd[0]);
assert(t_fd[1] == lut->fd[1]);
assert(t_fpl[0] == lut->fpl[0]);
assert(t_fpl[1] == lut->fpl[1]);
}
int input = 0;
for(int i=0; i<lut->fanins.size(); i++) {
input |= (lut->fanins[i]->value << i);
}
input <<= 1;
input |= lut->value;
for(int i=lut->fanins.size(); i<lut->fanins.size()+lut->inner_gates.size(); i++) {
LUT::FaultInfo &info = lut->fault_table[i][input];
Gate* g = lut->inner_gates[i-lut->fanins.size()];
int t_fd[2], t_fpl[2];
t_fd[0] = info.fd[0] && lut->fd[!lut->value];
t_fd[1] = info.fd[1] && lut->fd[!lut->value];
t_fpl[0] = info.fpl[0] + info.fd[0] * lut->fpl[!lut->value];
t_fpl[1] = info.fpl[1] + info.fd[1] * lut->fpl[!lut->value];
score_fault_detected_weight += t_fd[0] * g->fault_detected_weight[0];
score_fault_detected_weight += t_fd[1] * g->fault_detected_weight[1];
if(!g->isPO) {
score_fault_propagated_weight += (double)t_fpl[0] / g->avg_dist * g->fault_detected_weight[0];
score_fault_propagated_weight += (double)t_fpl[1] / g->avg_dist * g->fault_detected_weight[1];
}
}
}
printf("=====================================\n");
printf("unsat_lut: %d\n", unsatisfied_lut);
printf("score_value_unsatisfied_cost: %.2f\n", score_value_unsatisfied_cost);
printf("score_fault_detected_weight: %.2f\n", score_fault_detected_weight);
printf("score_fault_propagated_weight: %.2f\n", score_fault_propagated_weight);
printf("score_fault_update_cost: %.2f\n", score_fault_update_cost);
double score = - score_value_unsatisfied_cost + score_fault_detected_weight + score_fault_propagated_weight - score_fault_update_cost;
printf("score: %d\n", score);
return score;
}

378
src/circuit.cpp Normal file
View File

@ -0,0 +1,378 @@
#include <set>
#include <assert.h>
#include "circuit.h"
#include "paras.h"
using namespace atpg_ls;
void LUTCircuit::print() {
std::set<Gate*> st;
int total_gate = 0;
printf("PIs: ( ");
for(LUT* lut : PIs) {
printf("%s ", lut->gate->name.c_str());
}
printf(")\n");
printf("POs: ( ");
for(LUT* lut : POs) {
printf("%s ", lut->gate->name.c_str());
}
printf(")\n");
for(LUT* lut : luts) {
printf("[v:%d vs:%d fd0:%d fd1:%d] ", lut->value, lut->vsat, lut->fd[0], lut->fd[1]);
printf("lut: %s inputs: ( ", lut->gate->name.c_str());
total_gate += lut->inner_gates.size();
for(LUT* in : lut->fanins) {
printf("%s ", in->gate->name.c_str());
}
printf(")\n");
}
printf("total gate: %d\n", total_gate);
}
LUTCircuit* Circuit::build_lut_circuit() {
LUTCircuit* C = new LUTCircuit();
C->C = this;
std::unordered_map<Gate*, LUT*> gate2LUT;
std::queue<Gate*> q;
std::set<Gate*> done;
for(Gate* gate : gates) {
// assert fanouts >= 2
if(gate->fanouts.size() >= 2 || gate->isPI || (gate->isPO && gate->fanouts.size() == 0)) {
q.push(gate);
done.insert(gate);
}
}
while(!q.empty()) {
Gate* gate = q.front();
q.pop();
LUT* lut = new LUT(gate, C);
gate2LUT[gate] = lut;
// printf("size: %d lut: %s inputs: ( ", lut->inner_gates.size(), lut->gate->name.c_str());
// for(Gate* in : lut->__gate_fanins) {
// printf("%s ", in->name.c_str());
// }
// printf(") [");
// for(Gate* inner : lut->inner_gates) {
// printf("%s ", inner->name.c_str());
// }
// printf("]\n");
for(Gate* in : lut->__gate_fanins) {
if(in->fanouts.size() < 2 && !in->isPI && done.count(in) == 0) {
done.insert(in);
q.push(in);
}
}
C->luts.push_back(lut);
}
for(LUT* lut : C->luts) {
lut->name = lut->gate->name.c_str();
std::sort(lut->inner_gates.begin(), lut->inner_gates.end(), [](Gate* a, Gate* b) {
return a->id < b->id;
});
for(Gate* in : lut->__gate_fanins) {
assert(gate2LUT.count(in) > 0);
lut->fanins.push_back(gate2LUT[in]);
gate2LUT[in]->fanouts.push_back(lut);
}
if(lut->isPI) {
C->PIs.push_back(lut);
lut->isPI = 1;
}
if(lut->isPO) {
C->POs.push_back(lut);
lut->isPO = 1;
}
}
for(LUT* lut : C->luts) {
C->rtopo_luts.push_back(lut);
}
std::sort(C->luts.begin(), C->luts.end(), [](LUT* a, LUT* b) {
return a->gate->id < b->gate->id;
});
std::sort(C->rtopo_luts.begin(), C->rtopo_luts.end(), [](LUT* a, LUT* b) {
return a->gate->rtopo < b->gate->rtopo;
});
for(LUT* lut : C->luts) {
for(int i=0; i<lut->inner_gates.size(); i++) {
Gate *g = lut->inner_gates[i];
g->parent_lut = lut;
g->id_in_lut = lut->fanins.size() + i;
}
}
for(LUT* lut : C->luts) {
for(int i=0; i<lut->fanins.size(); i++) {
LUT* in = lut->fanins[i];
in->fanouts_with_id.push_back(std::make_pair(lut, i));
}
}
for(LUT* lut : C->luts) {
assert(lut->fanouts.size() == lut->fanouts_with_id.size());
}
return C;
}
void Circuit::insert_lines_for_stem() {
for(int j=0; j<gates.size(); j++) {
Gate* g = gates[j];
if(g->type == Gate::LINE) break;
g->is_stem = g->isPO ? g->fanouts.size() >= 1 : g->fanouts.size() >= 2;
if(!g->is_stem) continue;
if(g->isPO) {
Gate* line = new Gate();
line->name = g->name + "_line_PO";
line->type = Gate::LINE;
line->isPI = false;
line->isPO = true;
line->is_stem = false;
line->fanins.push_back(g);
g->fanouts.push_back(line);
g->isPO = false;
POs.erase(std::find(POs.begin(), POs.end(), g));
POs.push_back(line);
gates.push_back(line);
name2gate.insert(std::make_pair(line->name, line));
}
printf(">>>> now: %s\n", g->name.c_str());
printf("outs: [ ");
for(Gate* out :g->fanouts){
printf("%s ", out->name.c_str());
}
printf("]\n");
for(int i=0; i<g->fanouts.size(); i++) {
Gate* out = g->fanouts[i];
if(out->type == Gate::LINE) break;
printf(" g_name: %s outname: %s\n", g->name.c_str(), out->name.c_str());
Gate* line = new Gate();
line->name = g->name + "_line_" + out->name;
line->type = Gate::LINE;
line->isPI = false;
line->isPO = false;
line->fanins.push_back(g);
line->fanouts.push_back(out);
out->fanins.erase(std::find(out->fanins.begin(), out->fanins.end(), g));
out->fanins.push_back(line);
g->fanouts.erase(std::find(g->fanouts.begin(), g->fanouts.end(), out));
g->fanouts.push_back(line);
gates.push_back(line);
name2gate.insert(std::make_pair(line->name, line));
i--;
}
}
}
void Circuit::init_avg_dist() {
int *now_dist = new int[gates.size() + 1] { 0 };
int *total_dist = new int[gates.size() + 1] { 0 };
int *total_cnt = new int[gates.size() + 1] { 0 };
// int *topo_cnt = new int[gates.size() + 1] { 0 };
// memset(total_dist, 0, sizeof(int) * (gates.size() + 1));
for(Gate* po : POs) {
// memset(topo_cnt, 0, sizeof(int) * (gates.size() + 1));
// memset(now_dist, 0x3f, sizeof(int) * (gates.size() + 1));
for(Gate* g : gates) {
if(g->isPO) {
now_dist[g->id] = 0;
} else {
now_dist[g->id] = 0x3f3f3f3f;
}
}
// printf(">> po: %s\n", po->name.c_str());
std::queue<Gate*> q;
q.push(po);
while(!q.empty()) {
Gate* u = q.front(); q.pop();
total_dist[u->id] += now_dist[u->id];
total_cnt[u->id] ++;
// printf("now: %s\n", u->name.c_str());
for(Gate* in : u->fanins) {
if(now_dist[u->id] + 1 < now_dist[in->id]) {
now_dist[in->id] = now_dist[u->id] + 1;
q.push(in);
}
}
// printf("dist: %d\n", total_dist[name2gate["G132"]->id]);
}
}
for(Gate* g : gates) {
if(total_cnt[g->id] <= 0) {
printf("ERROR: gate: %s total: %d cnt: %d\n", g->name.c_str(), total_dist[g->id], total_cnt[g->id]);
exit(-1);
}
assert(total_cnt[g->id] > 0);
g->avg_dist = total_dist[g->id] / total_cnt[g->id];
printf("ERROR: gate: %s total: %d cnt: %d\n", g->name.c_str(), total_dist[g->id], total_cnt[g->id]);
// if(g->id)
if(!g->isPO) assert(g->avg_dist > 0);
}
delete [] now_dist;
delete [] total_dist;
delete [] total_cnt;
}
void Circuit::init_topo_index() {
int topo = 1;
std::queue<Gate*> q;
std::unordered_map<Gate*, int> ins;
for(Gate* gate : gates) {
ins[gate] = gate->fanins.size();
}
for(auto in : PIs) {
in->id = topo++;
q.push(in);
}
while(!q.empty()) {
Gate* g = q.front(); q.pop();
for(Gate* out : g->fanouts) {
ins[out]--;
if(ins[out] == 0) {
out->id = topo++;
q.push(out);
}
}
}
// 计算反向拓扑序
topo = 1;
std::unordered_map<Gate*, int> outs;
for(Gate* g : gates) {
if(g->fanouts.size() == 0) {
g->rtopo = topo++;
q.push(g);
}
}
for(Gate* gate : gates) {
outs[gate] = gate->fanouts.size();
}
std::unordered_set<Gate*> ok;
while(!q.empty()) {
Gate* g = q.front(); q.pop();
rtopo_gates.push_back(g);
ok.insert(g);
for(Gate* in : g->fanins) {
outs[in]--;
if(outs[in] == 0) {
in->rtopo = topo++;
q.push(in);
}
}
}
std::sort(gates.begin(), gates.end(), [](Gate* a, Gate* b) {
return a->id < b->id;
});
}
void Circuit::print() {
printf("PIs: ( ");
for(Gate* gate : PIs) {
printf("%s ", gate->name.c_str());
}
printf(")\n");
const char *name[10] = {"AND", "NAND", "OR", "NOR", "XOR", "XNOR", "NOT", "BUF", "INPUT", "LINE"};
for(Gate* g : gates) {
printf("[sa0: %d sa1: %d v: %d vsat: %d] %s = %s (",g->fault_detected[0], g->fault_detected[1], g->value, g->cal_value() == g->value, g->name.c_str(), name[g->type]);
for(Gate* in : g->fanins) {
printf("%s ", in->name.c_str());
}
printf(")\n");
}
printf("POs: ( ");
for(Gate* gate : POs) {
printf("%s ", gate->name.c_str());
}
printf(")\n");
}

90
src/circuit.h Normal file
View File

@ -0,0 +1,90 @@
#pragma once
#include "fault.h"
#include "lut.h"
using ll = long long;
namespace atpg_ls {
struct TMP_FAULT {
/* data */
Gate *g;
std::string name;
int stuck_at;
int is_stem;
int is_PO;
friend bool operator < (const TMP_FAULT &lhs, const TMP_FAULT &rhs) {
if(lhs.name != rhs.name) {
return lhs.name < rhs.name;
}
if(lhs.stuck_at != rhs.stuck_at) {
return lhs.stuck_at < rhs.stuck_at;
}
if(lhs.is_stem != rhs.is_stem) {
return lhs.is_stem < rhs.is_stem;
}
if(lhs.is_PO != rhs.is_PO) {
return lhs.is_PO < rhs.is_PO;
}
return false;
}
};
class Simulator;
class Circuit;
class LUTCircuit {
public:
std::vector<LUT*> PIs;
std::vector<LUT*> POs;
std::vector<LUT*> luts;
std::vector<LUT*> rtopo_luts;
int** fault_detected;
void print();
// local search
void ls_update(std::vector<LUT*> &unsat);
LUT* ls_pick();
void ls_flip(LUT *lut);
void ls_main();
void ls_init();
void ls_random_sol();
void ls_gen_sol(Gate* target, int stuck_at);
// checker
double check();
Simulator *simulator;
Circuit *C;
int step;
};
class Circuit {
public:
std::vector<Gate*> PIs;
std::vector<Gate*> POs;
std::vector<Gate*> gates;
std::vector<Gate*> rtopo_gates;
std::unordered_map<std::string, Gate*> name2gate;
void parse_from_file(const char *filename);
void insert_lines_for_stem();
void print();
LUTCircuit* build_lut_circuit();
void init_topo_index();
void init_avg_dist();
};
}

809
src/cmdline.h Normal file
View File

@ -0,0 +1,809 @@
/*
Copyright (c) 2009, Hideyuki Tanaka
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <string>
#include <stdexcept>
#include <typeinfo>
#include <cstring>
#include <algorithm>
#include <cxxabi.h>
#include <cstdlib>
namespace cmdline{
namespace detail{
template <typename Target, typename Source, bool Same>
class lexical_cast_t{
public:
static Target cast(const Source &arg){
Target ret;
std::stringstream ss;
if (!(ss<<arg && ss>>ret && ss.eof()))
throw std::bad_cast();
return ret;
}
};
template <typename Target, typename Source>
class lexical_cast_t<Target, Source, true>{
public:
static Target cast(const Source &arg){
return arg;
}
};
template <typename Source>
class lexical_cast_t<std::string, Source, false>{
public:
static std::string cast(const Source &arg){
std::ostringstream ss;
ss<<arg;
return ss.str();
}
};
template <typename Target>
class lexical_cast_t<Target, std::string, false>{
public:
static Target cast(const std::string &arg){
Target ret;
std::istringstream ss(arg);
if (!(ss>>ret && ss.eof()))
throw std::bad_cast();
return ret;
}
};
template <typename T1, typename T2>
struct is_same {
static const bool value = false;
};
template <typename T>
struct is_same<T, T>{
static const bool value = true;
};
template<typename Target, typename Source>
Target lexical_cast(const Source &arg)
{
return lexical_cast_t<Target, Source, detail::is_same<Target, Source>::value>::cast(arg);
}
static inline std::string demangle(const std::string &name)
{
int status=0;
char *p=abi::__cxa_demangle(name.c_str(), 0, 0, &status);
std::string ret(p);
free(p);
return ret;
}
template <class T>
std::string readable_typename()
{
return demangle(typeid(T).name());
}
template <class T>
std::string default_value(T def)
{
return detail::lexical_cast<std::string>(def);
}
template <>
inline std::string readable_typename<std::string>()
{
return "string";
}
} // detail
//-----
class cmdline_error : public std::exception {
public:
cmdline_error(const std::string &msg): msg(msg){}
~cmdline_error() throw() {}
const char *what() const throw() { return msg.c_str(); }
private:
std::string msg;
};
template <class T>
struct default_reader{
T operator()(const std::string &str){
return detail::lexical_cast<T>(str);
}
};
template <class T>
struct range_reader{
range_reader(const T &low, const T &high): low(low), high(high) {}
T operator()(const std::string &s) const {
T ret=default_reader<T>()(s);
if (!(ret>=low && ret<=high)) throw cmdline::cmdline_error("range_error");
return ret;
}
private:
T low, high;
};
template <class T>
range_reader<T> range(const T &low, const T &high)
{
return range_reader<T>(low, high);
}
template <class T>
struct oneof_reader{
T operator()(const std::string &s){
T ret=default_reader<T>()(s);
if (std::find(alt.begin(), alt.end(), ret)==alt.end())
throw cmdline_error("");
return ret;
}
void add(const T &v){ alt.push_back(v); }
private:
std::vector<T> alt;
};
template <class T>
oneof_reader<T> oneof(T a1)
{
oneof_reader<T> ret;
ret.add(a1);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
ret.add(a8);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
ret.add(a8);
ret.add(a9);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9, T a10)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
ret.add(a8);
ret.add(a9);
ret.add(a10);
return ret;
}
//-----
class parser{
public:
parser(){
}
~parser(){
for (std::map<std::string, option_base*>::iterator p=options.begin();
p!=options.end(); p++)
delete p->second;
}
void add(const std::string &name,
char short_name=0,
const std::string &desc=""){
if (options.count(name)) throw cmdline_error("multiple definition: "+name);
options[name]=new option_without_value(name, short_name, desc);
ordered.push_back(options[name]);
}
template <class T>
void add(const std::string &name,
char short_name=0,
const std::string &desc="",
bool need=true,
const T def=T()){
add(name, short_name, desc, need, def, default_reader<T>());
}
template <class T, class F>
void add(const std::string &name,
char short_name=0,
const std::string &desc="",
bool need=true,
const T def=T(),
F reader=F()){
if (options.count(name)) throw cmdline_error("multiple definition: "+name);
options[name]=new option_with_value_with_reader<T, F>(name, short_name, need, def, desc, reader);
ordered.push_back(options[name]);
}
void footer(const std::string &f){
ftr=f;
}
void set_program_name(const std::string &name){
prog_name=name;
}
bool exist(const std::string &name) const {
if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name);
return options.find(name)->second->has_set();
}
template <class T>
const T &get(const std::string &name) const {
if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name);
const option_with_value<T> *p=dynamic_cast<const option_with_value<T>*>(options.find(name)->second);
if (p==NULL) throw cmdline_error("type mismatch flag '"+name+"'");
return p->get();
}
const std::vector<std::string> &rest() const {
return others;
}
bool parse(const std::string &arg){
std::vector<std::string> args;
std::string buf;
bool in_quote=false;
for (std::string::size_type i=0; i<arg.length(); i++){
if (arg[i]=='\"'){
in_quote=!in_quote;
continue;
}
if (arg[i]==' ' && !in_quote){
args.push_back(buf);
buf="";
continue;
}
if (arg[i]=='\\'){
i++;
if (i>=arg.length()){
errors.push_back("unexpected occurrence of '\\' at end of string");
return false;
}
}
buf+=arg[i];
}
if (in_quote){
errors.push_back("quote is not closed");
return false;
}
if (buf.length()>0)
args.push_back(buf);
for (size_t i=0; i<args.size(); i++)
std::cout<<"\""<<args[i]<<"\""<<std::endl;
return parse(args);
}
bool parse(const std::vector<std::string> &args){
int argc=static_cast<int>(args.size());
std::vector<const char*> argv(argc);
for (int i=0; i<argc; i++)
argv[i]=args[i].c_str();
return parse(argc, &argv[0]);
}
bool parse(int argc, const char * const argv[]){
errors.clear();
others.clear();
if (argc<1){
errors.push_back("argument number must be longer than 0");
return false;
}
if (prog_name=="")
prog_name=argv[0];
std::map<char, std::string> lookup;
for (std::map<std::string, option_base*>::iterator p=options.begin();
p!=options.end(); p++){
if (p->first.length()==0) continue;
char initial=p->second->short_name();
if (initial){
if (lookup.count(initial)>0){
lookup[initial]="";
errors.push_back(std::string("short option '")+initial+"' is ambiguous");
return false;
}
else lookup[initial]=p->first;
}
}
for (int i=1; i<argc; i++){
if (strncmp(argv[i], "--", 2)==0){
const char *p=strchr(argv[i]+2, '=');
if (p){
std::string name(argv[i]+2, p);
std::string val(p+1);
set_option(name, val);
}
else{
std::string name(argv[i]+2);
if (options.count(name)==0){
errors.push_back("undefined option: --"+name);
continue;
}
if (options[name]->has_value()){
if (i+1>=argc){
errors.push_back("option needs value: --"+name);
continue;
}
else{
i++;
set_option(name, argv[i]);
}
}
else{
set_option(name);
}
}
}
else if (strncmp(argv[i], "-", 1)==0){
if (!argv[i][1]) continue;
char last=argv[i][1];
for (int j=2; argv[i][j]; j++){
last=argv[i][j];
if (lookup.count(argv[i][j-1])==0){
errors.push_back(std::string("undefined short option: -")+argv[i][j-1]);
continue;
}
if (lookup[argv[i][j-1]]==""){
errors.push_back(std::string("ambiguous short option: -")+argv[i][j-1]);
continue;
}
set_option(lookup[argv[i][j-1]]);
}
if (lookup.count(last)==0){
errors.push_back(std::string("undefined short option: -")+last);
continue;
}
if (lookup[last]==""){
errors.push_back(std::string("ambiguous short option: -")+last);
continue;
}
if (i+1<argc && options[lookup[last]]->has_value()){
set_option(lookup[last], argv[i+1]);
i++;
}
else{
set_option(lookup[last]);
}
}
else{
others.push_back(argv[i]);
}
}
for (std::map<std::string, option_base*>::iterator p=options.begin();
p!=options.end(); p++)
if (!p->second->valid())
errors.push_back("need option: --"+std::string(p->first));
return errors.size()==0;
}
void parse_check(const std::string &arg){
if (!options.count("help"))
add("help", '?', "print this message");
check(0, parse(arg));
}
void parse_check(const std::vector<std::string> &args){
if (!options.count("help"))
add("help", '?', "print this message");
check(args.size(), parse(args));
}
void parse_check(int argc, char *argv[]){
if (!options.count("help"))
add("help", '?', "print this message");
check(argc, parse(argc, argv));
}
std::string error() const{
return errors.size()>0?errors[0]:"";
}
std::string error_full() const{
std::ostringstream oss;
for (size_t i=0; i<errors.size(); i++)
oss<<errors[i]<<std::endl;
return oss.str();
}
std::string usage() const {
std::ostringstream oss;
oss<<"usage: "<<prog_name<<" ";
for (size_t i=0; i<ordered.size(); i++){
if (ordered[i]->must())
oss<<ordered[i]->short_description()<<" ";
}
oss<<"[options] ... "<<ftr<<std::endl;
oss<<"options:"<<std::endl;
size_t max_width=0;
for (size_t i=0; i<ordered.size(); i++){
max_width=std::max(max_width, ordered[i]->name().length());
}
for (size_t i=0; i<ordered.size(); i++){
if (ordered[i]->short_name()){
oss<<" -"<<ordered[i]->short_name()<<", ";
}
else{
oss<<" ";
}
oss<<"--"<<ordered[i]->name();
for (size_t j=ordered[i]->name().length(); j<max_width+4; j++)
oss<<' ';
oss<<ordered[i]->description()<<std::endl;
}
return oss.str();
}
private:
void check(int argc, bool ok){
if ((argc==1 && !ok) || exist("help")){
std::cerr<<usage();
exit(0);
}
if (!ok){
std::cerr<<error()<<std::endl<<usage();
exit(1);
}
}
void set_option(const std::string &name){
if (options.count(name)==0){
errors.push_back("undefined option: --"+name);
return;
}
if (!options[name]->set()){
errors.push_back("option needs value: --"+name);
return;
}
}
void set_option(const std::string &name, const std::string &value){
if (options.count(name)==0){
errors.push_back("undefined option: --"+name);
return;
}
if (!options[name]->set(value)){
errors.push_back("option value is invalid: --"+name+"="+value);
return;
}
}
class option_base{
public:
virtual ~option_base(){}
virtual bool has_value() const=0;
virtual bool set()=0;
virtual bool set(const std::string &value)=0;
virtual bool has_set() const=0;
virtual bool valid() const=0;
virtual bool must() const=0;
virtual const std::string &name() const=0;
virtual char short_name() const=0;
virtual const std::string &description() const=0;
virtual std::string short_description() const=0;
};
class option_without_value : public option_base {
public:
option_without_value(const std::string &name,
char short_name,
const std::string &desc)
:nam(name), snam(short_name), desc(desc), has(false){
}
~option_without_value(){}
bool has_value() const { return false; }
bool set(){
has=true;
return true;
}
bool set(const std::string &){
return false;
}
bool has_set() const {
return has;
}
bool valid() const{
return true;
}
bool must() const{
return false;
}
const std::string &name() const{
return nam;
}
char short_name() const{
return snam;
}
const std::string &description() const {
return desc;
}
std::string short_description() const{
return "--"+nam;
}
private:
std::string nam;
char snam;
std::string desc;
bool has;
};
template <class T>
class option_with_value : public option_base {
public:
option_with_value(const std::string &name,
char short_name,
bool need,
const T &def,
const std::string &desc)
: nam(name), snam(short_name), need(need), has(false)
, def(def), actual(def) {
this->desc=full_description(desc);
}
~option_with_value(){}
const T &get() const {
return actual;
}
bool has_value() const { return true; }
bool set(){
return false;
}
bool set(const std::string &value){
try{
actual=read(value);
has=true;
}
catch(const std::exception &e){
return false;
}
return true;
}
bool has_set() const{
return has;
}
bool valid() const{
if (need && !has) return false;
return true;
}
bool must() const{
return need;
}
const std::string &name() const{
return nam;
}
char short_name() const{
return snam;
}
const std::string &description() const {
return desc;
}
std::string short_description() const{
return "--"+nam+"="+detail::readable_typename<T>();
}
protected:
std::string full_description(const std::string &desc){
return
desc+" ("+detail::readable_typename<T>()+
(need?"":" [="+detail::default_value<T>(def)+"]")
+")";
}
virtual T read(const std::string &s)=0;
std::string nam;
char snam;
bool need;
std::string desc;
bool has;
T def;
T actual;
};
template <class T, class F>
class option_with_value_with_reader : public option_with_value<T> {
public:
option_with_value_with_reader(const std::string &name,
char short_name,
bool need,
const T def,
const std::string &desc,
F reader)
: option_with_value<T>(name, short_name, need, def, desc), reader(reader){
}
private:
T read(const std::string &s){
return reader(s);
}
F reader;
};
std::map<std::string, option_base*> options;
std::vector<option_base*> ordered;
std::string ftr;
std::string prog_name;
std::vector<std::string> others;
std::vector<std::string> errors;
};
} // cmdline

14
src/fault.h Normal file
View File

@ -0,0 +1,14 @@
#pragma once
#include "gate.h"
namespace atpg_ls {
class Fault {
public:
Gate* gate;
enum Type { SA0, SA1 } type;
Fault(Gate* gate, Type type):gate(gate),type(type) {}
};
}

172
src/gate.cpp Normal file
View File

@ -0,0 +1,172 @@
#include "circuit.h"
#include "assert.h"
using namespace atpg_ls;
int Gate::cal_propagate_len(bool x) {
int fpl[2];
fpl[0] = fpl[1] = 0;
if(isPO) {
fpl[!value] = 0;
fpl[value] = 0;
return fpl[x];
}
std::queue<Gate*> q;
for(Gate* out : fanouts) {
if(!out->is_detected(this)) continue;
fpl[!value] = std::max(fpl[!value], out->fault_propagated_len[!out->value] + 1);
}
return fpl[x];
}
bool Gate::is_detected(Gate* one_of_input) {
one_of_input->value = !one_of_input->value;
bool detect = (cal_value() != value);
one_of_input->value = !one_of_input->value;
return (cal_value() == value) && detect;
}
bool Gate::is_propagated() {
return fault_detected[0] || fault_detected[1];
}
bool Gate::cal_fault_detected(bool x) {
if(isPO) {
if(x == 0) return value;
else return !value;
}
bool sa0 = 0;
bool sa1 = 0;
for(Gate* out : fanouts) {
if(!out->is_propagated()) continue;
if(out->cal_value() != out->value) continue;
this->value = !this->value;
bool detect = out->cal_value() != out->value;
this->value = !this->value;
if(!detect) continue;
sa0 |= this->value;
sa1 |= !this->value;
}
if(x == 0) return sa0;
else return sa1;
}
int Gate::cal_value() {
int res;
switch(type) {
case NOT:
res = !fanins[0]->value;
break;
case LINE:
// pass through
case BUF:
res = fanins[0]->value;
break;
case AND:
res = fanins[0]->value;
for(int i=1; i<fanins.size(); i++) {
res &= fanins[i]->value;
}
break;
case NAND:
res = fanins[0]->value;
for(int i=1; i<fanins.size(); i++) {
res &= fanins[i]->value;
}
res = !res;
break;
case OR:
res = fanins[0]->value;
for(int i=1; i<fanins.size(); i++) {
res |= fanins[i]->value;
}
break;
case NOR:
res = fanins[0]->value;
for(int i=1; i<fanins.size(); i++) {
res |= fanins[i]->value;
}
res = !res;
break;
case XOR:
res = fanins[0]->value;
for(int i=1; i<fanins.size(); i++) {
res ^= fanins[i]->value;
}
break;
case XNOR:
res = fanins[0]->value;
for(int i=1; i<fanins.size(); i++) {
res ^= fanins[i]->value;
}
res = !res;
break;
case INPUT:
res = value;
break;
default:
assert(false);
break;
}
return res;
}
void Gate::cal_fault_info(int fd[2], int fpl[2]) {
if(isPO) {
fd[!value] = 1;
fd[value] = 0;
fpl[!value] = 0;
fpl[value] = 0;
return;
}
value ^= 1;
std::vector<Gate*> affectd;
std::unordered_map<Gate*, int> gate_level;
std::priority_queue<Gate*, std::vector<Gate*>,
std::function<bool(Gate*, Gate*)>> q([](Gate* p1, Gate* p2) {
return p1->id < p2->id;
});
for(Gate* out : fanouts) {
if(out->value != out->cal_value()) {
out->value ^= 1;
gate_level[out] = 1;
affectd.push_back(out);
q.push(out);
}
}
while(!q.empty()) {
Gate* cur = q.top(); q.pop();
for(Gate* out : cur->fanouts) {
if(out->value != out->cal_value()) {
out->value ^= 1;
gate_level[out] = std::max(gate_level[out], gate_level[cur] + 1);
affectd.push_back(out);
q.push(out);
}
}
}
for(Gate* gate : affectd) {
fault_detected[value] |= gate->fault_detected[gate->value];
fault_propagated_len[value] = std::max(fpl[value], gate_level[gate] + gate->fault_propagated_len[gate->value]);
gate->value ^= 1;
}
value ^= 1;
}

67
src/gate.h Normal file
View File

@ -0,0 +1,67 @@
#pragma once
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <assert.h>
namespace atpg_ls {
class LUT;
class Gate {
public:
// gate basic info
int id;
int level;
int rtopo;
std::string name;
enum Type { AND, NAND, OR, NOR, XOR, XNOR, NOT, BUF, INPUT, LINE } type;
int value;
bool isPI;
bool isPO;
std::vector<Gate*> fanouts;
std::vector<Gate*> fanins;
std::vector<Gate*> reigon;
int avg_dist;
int fault_propagated_len[2];
int fault_propagated_weight[2];
int fault_detected[2];
int fault_detected_weight[2];
bool is_propagated();
int cal_value();
bool cal_fault_detected(bool x);
bool is_detected(Gate* one_of_input);
int cal_propagate_len(bool x);
LUT* parent_lut;
int id_in_lut;
int is_stem;
void cal_fault_info(int fd[2], int fpl[2]);
// ( partical ) score
// score(x) = for y in neibor(x) { ~V_x,V_y make - ~V_x,V_y break }
// [ cal_FPL(~Vx, fanouts) - cal_FPL(Vx, fanouts) ] * FLP_WEIGHT(x)
// [ cal_FD(~Vx, fanouts) - cal_FD(Vx, fanouts) ] * FD_WEIGHT(x)
// [ cal_FPLS(~Vx, fanouts) - cal_FPLS(Vx, fanouts) ] * - FPLS_COST(x)
// [ cal_FDS(~Vx, fanouts) - cal_FDS(Vx, fanouts) ] * - FDS_COST(x)
};
}

504
src/ls.cpp Normal file
View File

@ -0,0 +1,504 @@
#include <set>
#include <chrono>
#include <iostream>
#include "circuit.h"
#include "paras.h"
#include "simulator.h"
#include "sat_atpg.h"
using namespace atpg_ls;
LUT* LUTCircuit::ls_pick() {
LUT* pick = nullptr;
// 采样
for(int i=0; i<OPT(t); i++) {
LUT* lut = luts[rand() % luts.size()];
if(!lut->CC) continue;
lut->cal_score();
if(lut->score <= 0) continue;
if(pick == nullptr || lut->score > pick->score) {
pick = lut;
}
}
if(pick != nullptr) {
return pick;
}
std::vector<LUT*> unsat;
// 动态加权
ls_update(unsat);
if(unsat.size() == 0) return nullptr;
return unsat[rand() % unsat.size()];
}
void LUTCircuit::ls_flip(LUT *lut) {
lut->CC = 0;
lut->uptag = 0;
lut->flip_value();
if(!lut->isPI) lut->vsat = !lut->vsat;
for(LUT* out : lut->fanouts) {
out->CC = 1;
out->vsat = (out->cal_value() == out->value);
}
lut->cal_fault_info(lut->fd, lut->fpl);
for(LUT* r : lut->reigon) {
r->CC = 1;
int t_fd[2], t_fpl[2];
r->cal_fault_info(t_fd, t_fpl);
if(t_fd[0] != r->fd[0] || t_fd[1] != r->fd[1] || t_fpl[0] != r->fpl[0] || t_fpl[1] != r->fpl[1]) {
r->uptag = 1;
}
}
}
void LUTCircuit::ls_update(std::vector<LUT*> &unsat) {
// printf("?????????????????ls_update\n");
// if(rand() % 10000 <= OPT(sp)) {
// } else {
for(LUT* lut : luts) {
if(!lut->vsat) {
// printf("ocost: %d add: %d\n", lut->vunat_cost);
if(lut->vunat_cost + OPT(vsat_inc) > OPT(vsat_max)) {
lut->vunat_cost = OPT(vsat_max);
} else {
lut->vunat_cost += OPT(vsat_inc);
}
// printf("cost: %d add: %d\n", lut->vunat_cost, OPT(vsat_inc));
// for(LUT* out : lut->fanouts) {
// if(out->vunat_cost -= OPT(vsat_inc) > 1) {
// out->vunat_cost -= OPT(vsat_inc);
// } else {
// out->vunat_cost = 1;
// }
// }
unsat.push_back(lut);
}
if(lut->uptag) {
if(lut->up_cost + OPT(up_inc) > OPT(up_max)) {
lut->up_cost = OPT(up_max);
} else {
lut->up_cost += OPT(up_inc);
}
}
for(int i=lut->fanins.size(); i<lut->fanins.size()+lut->inner_gates.size(); i++) {
Gate* g = lut->inner_gates[i-lut->fanins.size()];
LUT::FaultInfo &fi = lut->fault_table[i][lut->input_var];
if(!fi.fd[0] && g->fault_detected_weight[0] > 0 && g->fault_detected_weight[0] + OPT(fw_inc) <= OPT(fw_max)) {
g->fault_detected_weight[0] += OPT(fw_inc);
}
if(!fi.fd[1] && g->fault_detected_weight[1] > 0 && g->fault_detected_weight[1] + OPT(fw_inc) <= OPT(fw_max)) {
g->fault_detected_weight[1] += OPT(fw_inc);
}
if(!fi.fd[0] && g->fault_propagated_weight[0] > 0 && g->fault_propagated_weight[0] + OPT(fw_inc) <= OPT(fw_max)) {
g->fault_propagated_weight[0] += OPT(fw_inc);
}
if(!fi.fd[1] && g->fault_propagated_weight[0] > 0 && g->fault_propagated_weight[1] + OPT(fw_inc) <= OPT(fw_max)) {
g->fault_propagated_weight[1] += OPT(fw_inc);
}
}
}
// }
}
void LUTCircuit::ls_main() {
printf("====== local search start ======\n");
printf("initing lookup table ...\n");
ls_init();
printf("ganerating fault info ...\n");
int num_gates = 0;
int num_total_fault = 0;
int num_detected_fault = 0;
int num_undetected_fault = 0;
int num_pattern = 0;
for(LUT* lut : luts) {
num_gates += lut->inner_gates.size();
}
assert(num_gates == C->gates.size());
fault_detected = new int*[num_gates];
for(int i=0; i<num_gates; i++) {
fault_detected[i] = new int[2];
fault_detected[i][0] = fault_detected[i][1] = 0;
}
num_total_fault = num_undetected_fault = num_gates * 2;
printf("staring local search ...\n");
std::queue<TMP_FAULT> faults;
for(Gate* g : C->gates) {
std::string name = g->name;
// if(name.find("_") != std::string::npos) {
// name = name.substr(0, name.find("_"));
// }
if(g->is_stem) {
// printf("stem: %s\n", name.c_str());
faults.push(TMP_FAULT{g, name, 0, 1, 0});
faults.push(TMP_FAULT{g, name, 1, 1, 0});
} else {
if(g->isPO) {
// printf("out: %s\n", name.c_str());
faults.push(TMP_FAULT{g, name, 0, g->type != Gate::LINE, g->type == Gate::LINE});
faults.push(TMP_FAULT{g, name, 1, g->type != Gate::LINE, g->type == Gate::LINE});
continue;
}
assert(g->fanouts.size() == 1);
Gate *fanout = g->fanouts[0];
int stem = (!g->isPI) && (g->type != Gate::LINE);
if(fanout->type == Gate::Type::BUF || fanout->type == Gate::Type::NOT) {
continue;
} else if(fanout->type == Gate::Type::XOR || fanout->type == Gate::Type::XNOR) {
faults.push(TMP_FAULT{g, name, 0, stem, 0});
faults.push(TMP_FAULT{g, name, 1, stem, 0});
} else if(fanout->type == Gate::Type::NAND || fanout->type == Gate::Type::AND) {
faults.push(TMP_FAULT{g, name, 1, stem, 0});
} else if(fanout->type == Gate::Type::NOR || fanout->type == Gate::Type::OR) {
faults.push(TMP_FAULT{g, name, 0, stem, 0});
} else {
assert(false);
}
}
}
printf("fault-size: %d\n", faults.size());
std::vector<TMP_FAULT> t_faults;
std::set<TMP_FAULT> t_verify_set;
while(!faults.empty()) {
TMP_FAULT f = faults.front();
faults.pop();
assert(t_verify_set.count(f) == 0);
t_faults.push_back(f);
t_verify_set.insert(f);
}
for(TMP_FAULT &f : t_faults) {
faults.push(f);
}
// std::sort(t_faults.begin(), t_faults.end(), [](const TMP_FAULT &a, const TMP_FAULT &b) {
// int ta = std::atoi(a.g->name.substr(1).c_str());
// int tb = std::atoi(b.g->name.substr(1).c_str());
// return ta < tb;
// });
// for(auto &f : t_faults) {
// }
printf("fault-size: %d\n", t_faults.size());
printf("verify-size: %d\n", t_verify_set.size());
assert(t_faults.size() == t_verify_set.size());
// for(TMP_FAULT &f : t_faults) {
// printf("!! Fault: %s stuck-at: %d is_stem: %d is_po: %d\n", f.g->name.c_str(), f.stuck_at, f.is_stem, f.is_PO);
// std::vector<int> input_vector;
// bool detected = sat_atpg(f, input_vector);
// printf(">> Fault: %s stuck-at: %d is_stem: %d is_po: %d detected: %d\n", f.g->name.c_str(), f.stuck_at, f.is_stem, f.is_PO, detected);
// }
// exit(0);
auto start = std::chrono::high_resolution_clock::now();
// int cnt = 0;
while(!faults.empty()) {
while(!faults.empty()) {
TMP_FAULT f = faults.front();
if(fault_detected[f.g->id-1][f.stuck_at]) {
faults.pop();
} else {
break;
}
}
if(faults.empty()) break;
ls_random_sol();
TMP_FAULT f = faults.front(); faults.pop();
Gate* g = f.g;
int stuck_at = f.stuck_at;
printf("start with fault: %s SA%d\t", g->name.c_str(), stuck_at);
std::vector<int> inputs;
printf("verify ...");
int res1 = sat_atpg(f, inputs);
if(res1 == 0) {
printf(" unsat!\n");
continue;
}
assert(inputs.size() == PIs.size());
for(int i=0; i<inputs.size(); i++) {
PIs[i]->value = inputs[i];
}
printf("sim: %s %d\n", g->name.c_str(), stuck_at);
for(int i=0; i<inputs.size(); i++) {
printf("%d ", inputs[i]);
}
printf("\n");
int score;
simulator->simulate(PIs, score, fault_detected);
if(simulator->name2gate[g->name]->fault_detected[stuck_at]) {
printf(" successful!\n");
for(LUT* lut : luts) {
lut->input_var = 0;
for(int i=0; i<lut->fanins.size(); i++) {
LUT* in = lut->fanins[i];
lut->input_var |= (in->value << i);
}
}
ls_gen_sol(g, stuck_at);
int res = simulator->verify(this, fault_detected);
assert(res == 1);
} else {
printf(" failed!\n");
simulator->name2gate[g->name]->fault_detected[stuck_at] = 1;
// exit(-1);
}
// printf("g: %s\n", g->name.c_str());
// assert(simulator->name2gate[g->name]->fault_detected[stuck_at]);
int num_fault = 0;
for(Gate* g : simulator->gates) {
if(g->fault_detected[0] && !fault_detected[g->id-1][0]) {
fault_detected[g->id-1][0] = 1;
num_detected_fault++;
num_undetected_fault--;
num_fault++;
}
if(g->fault_detected[1] && !fault_detected[g->id-1][1]) {
fault_detected[g->id-1][1] = 1;
num_detected_fault++;
num_undetected_fault--;
num_fault++;
}
}
if(num_fault > 0) {
num_pattern++;
}
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
// cnt++;
printf("Cover: %.2f%% pattern: %d new_detected: %d undected: %d time: %.2fs\n", (double)num_detected_fault / num_total_fault * 100, num_pattern, num_fault, num_undetected_fault, (double)duration/1000);
// break;
}
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "Execution time: " << duration << " milliseconds" << std::endl;
}
void LUTCircuit::ls_gen_sol(Gate* target, int stuck_at) {
for(int step=0; ; step++) {
// printf("step: %d\n", step);
LUT* pick = ls_pick();
if(pick == nullptr) {
break;
}
// pick->cal_score();
// double t1 = check();
// printf(">>>>>>>>>>>>>\n");
// printf("dert_score: %.2f\n", pick->score);
// printf("dert_unsat_cost: %.2f\n", pick->score_value_unsatisfied_cost);
// printf("dert_fault_detected_weight: %.2f\n", pick->score_fault_detected_weight);
// printf("dert_fault_propagated_weight: %.2f\n", pick->score_fault_propagated_weight);
// printf("dert_up_cost: %.2f\n", pick->score_fault_update_cost);
int last = simulator->name2gate[target->name]->fault_detected[stuck_at];
ls_flip(pick);
// double t2 = check();
// assert(((t2 - t1) - pick->score) < 1e-6);
if(pick->isPI) {
int score;
simulator->simulate(PIs, score, fault_detected);
if(simulator->name2gate[target->name]->fault_detected[stuck_at] != last) {
ls_flip(pick);
pick->CC = 0;
}
// printf("step: %d fd: %d\n", step, score);
}
}
}
void LUTCircuit::ls_init() {
for(LUT* lut : luts) {
static int cnt = 0;
printf("[%d/%d]\n", ++cnt, luts.size());
lut->init_lookup_table();
}
for(LUT* lut : luts) {
for(LUT* out :lut->fanouts) {
for(int i=0; i<out->fanins.size(); i++) {
if(out->fanins[i] == lut) {
lut->fault_info.push_back(out->fault_table[i]);
}
}
}
}
for(LUT* lut : luts) {
std::set<LUT*> t_reigon;
for(LUT* out : lut->fanouts) {
for(LUT* in : out->fanins) {
t_reigon.insert(in);
}
}
for(LUT* in : lut->fanins) {
t_reigon.insert(in);
}
t_reigon.erase(lut);
for(LUT* r : t_reigon) {
lut->reigon.push_back(r);
}
}
for(LUT* lut : luts) {
std::set<LUT*> t_reigon;
for(LUT* r: lut->reigon) {
t_reigon.insert(r);
for(LUT* out2 : r->fanouts) {
t_reigon.insert(out2);
for(LUT* in2 : out2->fanins) {
t_reigon.insert(in2);
}
}
}
for(LUT* r : lut->fanouts) {
t_reigon.insert(r);
}
for(LUT* r : t_reigon) {
lut->update_reigon.push_back(r);
}
}
}
void LUTCircuit::ls_random_sol() {
step = 0;
std::vector<int*> t_focus;
for(LUT* lut : luts) {
lut->up_cost = 1;
lut->vunat_cost = 1;
if(lut->isPI) {
lut->vunat_cost = OPT(vsat_inc) * 100;
}
lut->CC = 1;
for(Gate* g : lut->inner_gates) {
g->fault_detected_weight[0] = !fault_detected[g->id-1][0];
g->fault_detected_weight[1] = !fault_detected[g->id-1][1];
if(g->fault_detected_weight[0]) {
t_focus.push_back(&g->fault_detected_weight[0]);
}
if(g->fault_detected_weight[1]) {
t_focus.push_back(&g->fault_detected_weight[1]);
}
g->fault_propagated_weight[0] = !fault_detected[g->id-1][0];
g->fault_propagated_weight[1] = !fault_detected[g->id-1][1];
}
}
int *tw = t_focus[rand()%t_focus.size()];
*tw = 100000;
for(LUT* lut : luts) {
lut->uptag = 0;
lut->value = rand() % 2;
}
for(LUT* lut : luts) {
lut->input_var = 0;
for(int i=0; i<lut->fanins.size(); i++) {
LUT* in = lut->fanins[i];
lut->input_var |= (in->value << i);
}
}
for(LUT* lut : luts) {
lut->vsat = (lut->value == lut->cal_value());
}
for(LUT* lut : rtopo_luts) {
lut->cal_fault_info(lut->fd, lut->fpl);
}
for(LUT* lut : luts) {
lut->cal_score();
}
}

205
src/lut.cpp Normal file
View File

@ -0,0 +1,205 @@
#include <set>
#include "lut.h"
#include "paras.h"
using namespace atpg_ls;
void LUT::flip_value() {
value ^= 1;
for(auto&[out, id] : fanouts_with_id) {
out->input_var ^= (1 << id);
}
}
void LUT::cal_fault_info(int *fd, int* fpl) {
fd[0] = fd[1] = fpl[0] = fpl[1] = 0;
if(isPO) {
fd[!value] = 1;
fd[value] = 0;
return;
}
for(auto&[out, id] : fanouts_with_id) {
if(!out->vsat) continue;
FaultInfo &info = out->fault_table[id][out->input_var << 1 | out->value];
int t_fd[2], t_fpl[2];
t_fd[0] = info.fd[0] && out->fd[!out->value];
t_fd[1] = info.fd[1] && out->fd[!out->value];
t_fpl[0] = info.fpl[0] + info.fd[0] * out->fpl[!out->value];
t_fpl[1] = info.fpl[1] + info.fd[1] * out->fpl[!out->value];
fd[0] |= t_fd[0];
fd[1] |= t_fd[1];
fpl[0] = std::max(fpl[0], t_fpl[0]);
fpl[1] = std::max(fpl[1], t_fpl[1]);
}
// std::vector<Gate*> reigon;
// std::priority_queue<std::pair<Gate*, int>, std::vector<std::pair<Gate*, int>>,
// std::function<bool(const std::pair<Gate*, int>&, const std::pair<Gate*, int>&)>> pq([](const std::pair<Gate*, int>& p1, const std::pair<Gate*, int>& p2) {
// return p1.first->id < p2.first->id;
// });
// for(Gate* out : gate->fanouts) {
// if(!out->vsat) continue;
// pq.push(std::make_pair(out, 0));
// }
// pq.push(std::make_pair(gate, 0));
// while(!q.empty()) {
// auto [now, level] = q.front(); q.pop();
// for(Gate* out : now->fanouts) {
// if(!out->is_detected(now)) continue;
// if(level + 1 < OPT(lut)) {
// q.push(std::make_pair(out, level + 1));
// }
// }
// }
}
int LUT::cal_value() {
if(isPI) return value;
return value_table[input_var];
}
LUT::LUT(Gate *gate, LUTCircuit *circuit):gate(gate), value(gate->value), name(gate->name.c_str()) {
C = circuit;
isPI = gate->isPI;
isPO = gate->isPO;
inner_gates.push_back(gate);
std::set<Gate*> fanins;
for(Gate* g : gate->fanins) {
fanins.insert(g);
}
while(true) {
std::vector<Gate*> candidates;
for(Gate* fanin : fanins) {
if(fanin->fanouts.size() >= 2) continue;
if(fanin->isPI) continue;
int add = 0;
for(Gate* in : fanin->fanins) {
if(fanins.count(in) == 0) {
add++;
}
}
if(fanins.size() - 1 + add <= OPT(lut)) {
candidates.push_back(fanin);
}
}
if(candidates.size() == 0) break;
Gate* random_gate = candidates[rand()%candidates.size()];
inner_gates.push_back(random_gate);
fanins.erase(random_gate);
for(Gate* in : random_gate->fanins) {
fanins.insert(in);
}
}
for(Gate* in : fanins) {
__gate_fanins.push_back(in);
}
}
void LUT::init_lookup_table() {
value_table = new int[1 << fanins.size()];
fault_table = new FaultInfo *[fanins.size() + inner_gates.size()];
for (int i = 0; i < (fanins.size() + inner_gates.size()); i++) {
fault_table[i] = new FaultInfo[1 << (fanins.size() + 1)];
}
std::unordered_map<Gate*, int> gate2index;
for(int i=0; i<fanins.size(); i++) {
gate2index[fanins[i]->gate] = i;
}
for(int i=0; i<inner_gates.size(); i++) {
gate2index[inner_gates[i]] = i + fanins.size();
}
for (int i = 0; i < (1 << fanins.size()); i++) {
for (int j = 0; j < fanins.size(); j++) {
fanins[j]->gate->value = (i >> j) & 1;
}
for (Gate *g : inner_gates) {
g->value = g->cal_value();
}
assert(inner_gates[inner_gates.size() - 1] == gate);
value_table[i] = gate->value;
for(gate->value=0; gate->value<=1; gate->value++) {
for(auto&[g, index] : gate2index) {
g->fault_detected[0] = g->fault_detected[1] = 0;
g->fault_propagated_len[0] = g->fault_propagated_len[1] = 0;
}
gate->fault_detected[!gate->value] = 1;
gate->fault_detected[gate->value] = 0;
gate->fault_propagated_len[0] = 0;
gate->fault_propagated_len[1] = 0;
std::queue<Gate*> q;
q.push(gate);
while(!q.empty()) {
Gate *now = q.front(); q.pop();
FaultInfo *info = &fault_table[gate2index[now]][(i<<1)|gate->value];
info->fd[0] = now->fault_detected[0];
info->fd[1] = now->fault_detected[1];
info->fpl[0] = now->fault_propagated_len[0];
info->fpl[1] = now->fault_propagated_len[1];
info->value = now->value;
// if(now->name == "new_n22_") {
// printf("Gate: %s value: %d inputs: [ ", now->name.c_str(), now->value);
// for(Gate *in : now->fanins) {
// printf("%s ", in->name.c_str());
// }
// printf("]\n");
// }
for(Gate *in : now->fanins) {
if(gate2index.count(in) == 0) continue;
if(now->is_detected(in)) {
in->fault_detected[!in->value] = std::max(in->fault_detected[!in->value], now->fault_detected[!now->value]);
in->fault_propagated_len[!in->value] = std::max(in->fault_propagated_len[!in->value], now->fault_propagated_len[!now->value] + 1);
}
q.push(in);
}
}
}
}
}

78
src/lut.h Normal file
View File

@ -0,0 +1,78 @@
#pragma once
#include "gate.h"
namespace atpg_ls {
class LUTCircuit;
class LUT {
public:
LUT(Gate *gate, LUTCircuit *circuit);
LUTCircuit *C;
Gate *gate;
bool isPI, isPO;
uint32_t input_var;
std::vector<LUT *> fanins;
std::vector<LUT *> fanouts;
std::vector<std::pair<LUT*, int>> fanouts_with_id;
std::vector<LUT *> reigon;
std::vector<LUT *> update_reigon;
std::vector<Gate *> inner_gates;
std::vector<Gate *> __gate_fanins;
std::unordered_map<Gate *, int> input_id;
int &value;
void flip_value();
const char *name;
int *value_table;
struct FaultInfo {
int fd[2];
int fpl[2];
int value;
} **fault_table;
std::vector<FaultInfo *> fault_info;
void init_lookup_table();
// local search
bool vsat;
int vunat_cost;
bool uptag;
int up_cost;
int fd[2];
int fpl[2];
// int is_good_var;
int CC;
int cal_value();
void cal_fault_info(int *t_fd, int *t_fpl);
void get_fault_info(Gate *gate, int *t_fd, int *t_fpl);
// score
double score;
double score_value_unsatisfied_cost;
double score_fault_detected_weight;
double score_fault_propagated_weight;
double score_fault_update_cost;
void cal_score();
void cal_update();
};
}

67
src/main.cpp Normal file
View File

@ -0,0 +1,67 @@
#include "circuit.h"
#include "simulator.h"
#include "paras.h"
#include "sat_atpg.h"
using namespace atpg_ls;
int main(int argc, char *argv[]) {
// 初始化命令行参数
INIT_ARGS
srand(OPT(seed));
Circuit *circuit = new Circuit();
Simulator* simulator = new Simulator();
printf("parsing file %s ...\n", OPT(instance).c_str());
circuit->parse_from_file(OPT(instance).c_str());
circuit->insert_lines_for_stem();
simulator->parse_from_file(OPT(instance).c_str());
simulator->insert_lines_for_stem();
circuit->init_topo_index();
simulator->init_topo_index();
circuit->init_avg_dist();
circuit->print();
/**
* D算法/ - 200000F = (123) -> F -> (5,6)
* SAT - 200000F * avg(N) (1011) (1010)
*
* primary input
* gate input
*
* (F0)
* PIs assignment (10101010101010) -> (F0)
*
* (10101010101010) inital sol
* LOCAL + F0
*
* (SAT + LS)
**/
sat_atpg_init(OPT(instance).c_str());
// circuit->
printf("building lut circuit ...\n");
LUTCircuit *C = circuit->build_lut_circuit();
C->simulator = simulator;
printf("====== Circuit Statistics ====== \n");
printf("PI:\t%ld\n", circuit->PIs.size());
printf("PO:\t%ld\n", circuit->POs.size());
printf("Gate:\t%ld\n", circuit->gates.size());
printf("LUT:\t%ld\n", C->luts.size());
printf("================================ \n");
C->ls_main();
return 0;
}

54
src/paras.cpp Normal file
View File

@ -0,0 +1,54 @@
#include "paras.h"
#include "cmdline.h"
#include <cstdio>
#include <iostream>
#include <string>
paras __global_paras;
void paras::parse_args(int argc, char *argv[]) {
cmdline::parser parser;
#define STR_PARA(N, S, M, D, C) \
parser.add<std::string>(#N, S, C, M, D);
STR_PARAS
#undef STR_PARA
#define PARA(N, T, S, M, D, L, H, C) \
if (!strcmp(#T, "int")) parser.add<int>(#N, S, C, M, D, cmdline::range((int)L, (int)H)); \
else parser.add<double>(#N, S, C, M, D, cmdline::range((double)L, (double)H));
PARAS
#undef PARA
parser.parse_check(argc, argv);
#define STR_PARA(N, S, M, D, C) \
OPT(N) = parser.get<std::string>(#N);
STR_PARAS
#undef STR_PARA
#define PARA(N, T, S, M, D, L, H, C) \
if (!strcmp(#T, "int")) OPT(N) = parser.get<int>(#N); \
else OPT(N) = parser.get<double>(#N);
PARAS
#undef PARA
}
void paras::print_change() {
printf("c ------------------- Paras list -------------------\n");
printf("c %-20s\t %-10s\t %-10s\t %-10s\t %s\n",
"Name", "Type", "Now", "Default", "Comment");
#define PARA(N, T, S, M, D, L, H, C) \
if (!strcmp(#T, "int")) printf("c %-20s\t %-10s\t %-10d\t %-10s\t %s\n", (#N), (#T), N, (#D), (C)); \
else printf("c %-20s\t %-10s\t %-10f\t %-10s\t %s\n", (#N), (#T), N, (#D), (C));
PARAS
#undef PARA
#define STR_PARA(N, S, M, D, C) \
printf("c %-20s\t string\t\t %-10s\t %-10s\t %s\n", (#N), N.c_str(), (#D), (C));
STR_PARAS
#undef STR_PARA
printf("c --------------------------------------------------\n");
}

47
src/paras.h Normal file
View File

@ -0,0 +1,47 @@
#ifndef _paras_hpp_INCLUDED
#define _paras_hpp_INCLUDED
#include <string>
#include <cstring>
#include <unordered_map>
// name, type, short-name,must-need, default ,low, high, comments
#define PARAS \
PARA( seed , int , '\0' , false , 17 , 0 , 100000000 , "max input numbers of LUT") \
PARA( lut , int , '\0' , false , 8 , 0 , 30 , "max input numbers of LUT") \
PARA( sp , double , '\0' , false , 0.01 , 0 , 1 , "max input numbers of LUT") \
PARA( brk_sp , double , '\0' , false , 0.05 , 0 , 1 , "max input numbers of LUT") \
PARA( t , int , '\0' , false , 20 , 0 , 1000 , "max input numbers of LUT") \
PARA( vsat_inc , int , '\0' , false , 10 , 0 , 100000 , "max input numbers of LUT") \
PARA( vsat_max , int , '\0' , false , 10000 , 0 , 100000 , "max input numbers of LUT") \
PARA( fw_inc , int , '\0' , false , 1 , 0 , 1000 , "max input numbers of LUT") \
PARA( fw_max , int , '\0' , false , 500 , 0 , 1000 , "max input numbers of LUT") \
PARA( up_inc , int , '\0' , false , 1 , 0 , 1000 , "max input numbers of LUT") \
PARA( up_max , int , '\0' , false , 1000 , 0 , 1000 , "max input numbers of LUT")
// name, short-name, must-need, default, comments
#define STR_PARAS \
STR_PARA( instance , 'i' , true , "" , ".bench format instance")
struct paras
{
#define PARA(N, T, S, M, D, L, H, C) \
T N = D;
PARAS
#undef PARA
#define STR_PARA(N, S, M, D, C) \
std::string N = D;
STR_PARAS
#undef STR_PARA
void parse_args(int argc, char *argv[]);
void print_change();
};
#define INIT_ARGS __global_paras.parse_args(argc, argv);
extern paras __global_paras;
#define OPT(N) (__global_paras.N)
#endif

View File

@ -6,6 +6,8 @@
#include <regex>
#include <set>
using namespace atpg_ls;
void line2tokens(const std::string &line, std::vector<std::string> &tokens) {
std::string token;
for(char c : line) {
@ -73,12 +75,9 @@ void Circuit::parse_from_file(const char *filename) {
Gate* gate = new Gate();
gate->name = tokens[0];
gate->sa[0] = gate->sa[1] = false;
gate->stem = false;
gate->isPI = false;
gate->isPO = false;
for(auto &in : ins) {
if(!name2gate.count(in)) {
printf("Error while reading file: gate %s used before defination.\n", in.c_str());
@ -87,8 +86,8 @@ void Circuit::parse_from_file(const char *filename) {
auto in_gate = name2gate[in];
gate->inputs.push_back(in_gate);
in_gate->outputs.push_back(gate);
gate->fanins.push_back(in_gate);
in_gate->fanouts.push_back(gate);
}
if(tokens[2] == "AND") { gate->type = Gate::AND; }
@ -113,8 +112,6 @@ void Circuit::parse_from_file(const char *filename) {
Gate* gate = new Gate();
gate->name = tokens[2];
gate->type = Gate::INPUT;
gate->sa[0] = gate->sa[1] = false;
gate->stem = true;
gate->isPI = true;
gate->isPO = false;
@ -142,7 +139,6 @@ void Circuit::parse_from_file(const char *filename) {
Gate* po = name2gate[po_name];
po->isPO = true;
po->stem = true;
POs.push_back(po);
}
}

122
src/sat_atpg.cpp Normal file
View File

@ -0,0 +1,122 @@
#include "sat_atpg.h"
#include "circuit_graph.h"
#include "iscas89_parser.h"
#include "circuit_to_cnf.h"
#include "fault_cnf.h"
#include "fault_manager.h"
#include "sat/sat_solver.h"
#include "solver_proxy.h"
#include "util/log.h"
#include "util/timer.h"
#include <fstream>
#include <algorithm>
#include <iostream>
#include <map>
CircuitGraph *graph;
Iscas89Parser *parser;
FaultManager *fault_manager;
FaultCnfMaker *fault_cnf_maker;
std::unique_ptr<SatSolver> solver;
ProxyCnf *proxy;
std::map<TMP_FAULT, Fault> fault_map;
bool sat_atpg(const TMP_FAULT &fal, std::vector<int> &input_vector) {
assert(fault_map.count(fal) != 0);
Fault f = fault_map[fal];
fault_cnf_maker->make_fault(f, *proxy);
SatSolver::SolveStatus status = solver->solve_prepared();
for (Line* l : graph->get_inputs()) {
int8_t val = solver->get_value(line_to_literal(l->id));
input_vector.push_back(val == -1 ? 0 : 1);
}
if(status == SatSolver::Sat) {
return true;
} else if(status == SatSolver::Unsat) {
return false;
} else {
assert(false);
printf(">> UNKNOWN\n");
}
}
void sat_atpg_init(const char* file) {
graph = new CircuitGraph();
parser = new Iscas89Parser();
std::ifstream ifs(file);
if (!ifs.good()) {
std::cout << "can't open file" << file;
exit(-1);
}
if (!parser->parse(ifs, *graph)) {
std::cout << "can't parse file" << file;
exit(-1);
}
solver = SolverFactory::make_solver();
if (!solver) {
std::cout << "No SAT solver, can't run";
exit(-1);
}
fault_manager = new FaultManager(*graph);
fault_cnf_maker = new FaultCnfMaker(*graph);
fault_cnf_maker->set_threshold_ratio(0.6);
proxy = new ProxyCnf(*solver);
int sz = 0;
while(fault_manager->has_faults_left()) {
Fault f = fault_manager->next_fault();
sz++;
if(f.is_stem || (f.line->source == nullptr && f.line->destinations.size() == 1)) {
printf("Fault: %s stuck-at: %d is_stem: %d is_po: %d dest: %d\n", f.line->name.c_str(), f.stuck_at, f.is_stem, f.is_primary_output, f.line->destinations.size());
TMP_FAULT tf = TMP_FAULT{nullptr, f.line->name, f.stuck_at, f.is_stem, f.is_primary_output};
assert(fault_map.count(tf) == 0);
fault_map[tf] = f;
} else {
std::string name;
if(f.is_primary_output) {
name = f.line->name + "_line_PO";
} else {
name = f.line->name + "_line_" + f.connection.gate->get_output()->name;
}
printf("Fault: %s stuck-at: %d is_stem: %d is_po: %d dest: %d\n", name.c_str(), f.stuck_at, f.is_stem, f.is_primary_output, f.line->destinations.size());
TMP_FAULT tf = TMP_FAULT{nullptr, name, f.stuck_at, f.is_stem, f.is_primary_output};
assert(fault_map.count(tf) == 0);
fault_map[tf] = f;
}
// printf(">> Fault: %s stuck-at: %d is_stem: %d is_po: %d\n", f.line->name.c_str(), f.stuck_at, f.is_stem, f.is_primary_output);
}
printf("tg-pro fault-size: %d table-size: %d\n", sz, fault_map.size());
assert(sz == fault_map.size());
// exit(0);
}

8
src/sat_atpg.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include "circuit.h"
using atpg_ls::TMP_FAULT;
bool sat_atpg(const TMP_FAULT &fal, std::vector<int> &input_vector);
void sat_atpg_init(const char* file);

141
src/score.cpp Normal file
View File

@ -0,0 +1,141 @@
#include "lut.h"
#include "circuit.h"
using namespace atpg_ls;
void LUT::cal_score() {
score = 0;
score_value_unsatisfied_cost = 0;
score_fault_detected_weight = 0;
score_fault_propagated_weight = 0;
score_fault_update_cost = 0;
// value = !value;
this->flip_value();
if(uptag) {
score_fault_update_cost -= up_cost;
}
// value sat score
if(!isPI) {
if(vsat) score_value_unsatisfied_cost += vunat_cost;
else score_value_unsatisfied_cost -= vunat_cost;
vsat = !vsat;
}
for(LUT* out : fanouts) {
if(!out->vsat && out->cal_value() == out->value) {
score_value_unsatisfied_cost -= out->vunat_cost;
out->vsat = 1;
}
if(out->vsat && out->cal_value() != out->value){
score_value_unsatisfied_cost += out->vunat_cost;
out->vsat = 0;
}
}
int old_fd[2], old_fpl[2];
old_fd[0] = fd[0];
old_fd[1] = fd[1];
old_fpl[0] = fpl[0];
old_fpl[1] = fpl[1];
// fault detected score
cal_fault_info(fd, fpl);
// printf("fd: %d %d %d %d\n", fd[0], fd[1], old_fd[0], old_fd[1]);
for(auto&[out, id] : fanouts_with_id) {
uint32_t in1 = out->input_var, in2 = out->input_var;
in1 ^= (1 << id);
in1 = (in1 << 1) | out->value;
in2 = (in2 << 1) | out->value;
for(int i=out->fanins.size(); i<out->fanins.size()+out->inner_gates.size(); i++) {
Gate* g = out->inner_gates[i-out->fanins.size()];
int t_fd1[2], t_fpl1[2];
int t_fd2[2], t_fpl2[2];
t_fd1[0] = out->fault_table[i][in1].fd[0] && out->fd[!out->value];
t_fd1[1] = out->fault_table[i][in1].fd[1] && out->fd[!out->value];
t_fd2[0] = out->fault_table[i][in2].fd[0] && out->fd[!out->value];
t_fd2[1] = out->fault_table[i][in2].fd[1] && out->fd[!out->value];
t_fpl1[0] = out->fault_table[i][in1].fpl[0] + out->fault_table[i][in1].fd[0] * out->fpl[!out->value];
t_fpl1[1] = out->fault_table[i][in1].fpl[1] + out->fault_table[i][in1].fd[1] * out->fpl[!out->value];
t_fpl2[0] = out->fault_table[i][in2].fpl[0] + out->fault_table[i][in2].fd[0] * out->fpl[!out->value];
t_fpl2[1] = out->fault_table[i][in2].fpl[1] + out->fault_table[i][in2].fd[1] * out->fpl[!out->value];
score_fault_detected_weight += (t_fd2[0] - t_fd1[0]) * g->fault_detected_weight[0];
score_fault_detected_weight += (t_fd2[1] - t_fd1[1]) * g->fault_detected_weight[1];
if(!g->isPO) {
score_fault_propagated_weight += (double)(t_fpl2[0] - t_fpl1[0]) / g->avg_dist * g->fault_detected_weight[0];
score_fault_propagated_weight += (double)(t_fpl2[1] - t_fpl1[1]) / g->avg_dist * g->fault_detected_weight[1];
}
}
}
int in1 = this->input_var, in2 = this->input_var;
in1 = (in1 << 1) | !value;
in2 = (in2 << 1) | value;
for(int i=fanins.size(); i<fanins.size()+inner_gates.size(); i++) {
Gate* g = inner_gates[i-fanins.size()];
int t_fd1[2], t_fpl1[2];
int t_fd2[2], t_fpl2[2];
t_fd1[0] = fault_table[i][in1].fd[0] && old_fd[value];
t_fd1[1] = fault_table[i][in1].fd[1] && old_fd[value];
t_fd2[0] = fault_table[i][in2].fd[0] && fd[!value];
t_fd2[1] = fault_table[i][in2].fd[1] && fd[!value];
t_fpl1[0] = fault_table[i][in1].fpl[0] + fault_table[i][in1].fd[0] * old_fpl[value];
t_fpl1[1] = fault_table[i][in1].fpl[1] + fault_table[i][in1].fd[1] * old_fpl[value];
t_fpl2[0] = fault_table[i][in2].fpl[0] + fault_table[i][in2].fd[0] * fpl[!value];
t_fpl2[1] = fault_table[i][in2].fpl[1] + fault_table[i][in2].fd[1] * fpl[!value];
score_fault_detected_weight += (t_fd2[0] - t_fd1[0]) * g->fault_detected_weight[0];
score_fault_detected_weight += (t_fd2[1] - t_fd1[1]) * g->fault_detected_weight[1];
if(!g->isPO) {
score_fault_propagated_weight += (double)(t_fpl2[0] - t_fpl1[0]) / g->avg_dist * g->fault_detected_weight[0];
score_fault_propagated_weight += (double)(t_fpl2[1] - t_fpl1[1]) / g->avg_dist * g->fault_detected_weight[1];
}
}
// update cost score
for(LUT* r : reigon) {
int t_fd[2], t_fpl[2];
r->cal_fault_info(t_fd, t_fpl);
if(t_fd[0] == r->fd[0] && t_fd[1] == r->fd[1] && t_fpl[0] == r->fpl[0] && t_fpl[1] == r->fpl[1]) continue;
if(!r->uptag) {
score_fault_update_cost += r->up_cost;
}
}
this->flip_value();
if(!isPI) vsat = !vsat;
fd[0] = old_fd[0];
fd[1] = old_fd[1];
fpl[0] = old_fpl[0];
fpl[1] = old_fpl[1];
for(LUT* out : fanouts) {
out->vsat = ( out->cal_value() == out->value );
}
score = - score_value_unsatisfied_cost + score_fault_detected_weight + score_fault_propagated_weight - score_fault_update_cost;
}

113
src/simulator.cpp Normal file
View File

@ -0,0 +1,113 @@
#include "simulator.h"
using namespace atpg_ls;
int Simulator::verify(LUTCircuit *lut_circuit, int** fault_detected) {
// lut_circuit->check();
// for(LUT* lut : lut_circuit->PIs) {
// printf("PI: %s = %d\n", lut->name, lut->value);
// }
int score;
simulate(lut_circuit->PIs, score, fault_detected);
for(LUT* lut : lut_circuit->luts) {
assert(lut->value == lut->cal_value());
}
for(LUT* lut : lut_circuit->rtopo_luts) {
lut->cal_fault_info(lut->fd, lut->fpl);
}
// lut_circuit->print();
std::unordered_map<int, Gate*> id2gate;
for(Gate* gate : gates) {
id2gate[gate->id] = gate;
}
for(LUT* lut : lut_circuit->luts) {
int input_var = 0;
for(int i=0; i<lut->fanins.size(); i++) {
LUT* l = lut->fanins[i];
input_var |= l->value << i;
}
assert(input_var == lut->input_var);
if(!lut->isPI) assert(lut->value_table[lut->input_var] == lut->value);
// printf(">> LUT: %s\n", lut->name);
// assert(lut->fd[0] == id2gate[lut->gate->id]->fault_detected[0]);
// assert(lut->fd[1] == id2gate[lut->gate->id]->fault_detected[1]);
// assert(lut->fpl[0] == id2gate[lut->gate->id]->fault_propagated_len[0]);
// assert(lut->fpl[1] == id2gate[lut->gate->id]->fault_propagated_len[1]);
for(int i=lut->fanins.size(); i<lut->fanins.size()+lut->inner_gates.size(); i++) {
LUT::FaultInfo &info = lut->fault_table[i][(lut->input_var<<1)|lut->value];
Gate* g = lut->inner_gates[i-lut->fanins.size()];
int t_fd[2], t_fpl[2];
t_fd[0] = info.fd[0] && lut->fd[!lut->value];
t_fd[1] = info.fd[1] && lut->fd[!lut->value];
t_fpl[0] = info.fpl[0] + info.fd[0] * lut->fpl[!lut->value];
t_fpl[1] = info.fpl[1] + info.fd[1] * lut->fpl[!lut->value];
Gate* sim_g = id2gate[g->id];
assert(g->name == sim_g->name);
// if(g->name == "new_n32_" || g->name == "new_n33_") {
// printf("Gate: %s value: %d %d\n", g->name.c_str(), info.value, sim_g->value);
// printf("l_fd[0]: %d, l_fd[1]: %d, l_fpl[0]: %d, l_fpl[1]: %d\n", lut->fd[0], lut->fd[1], lut->fpl[0], lut->fpl[1]);
// printf("i_fd[0]: %d, i_fd[1]: %d, i_fpl[0]: %d, i_fpl[1]: %d\n", info.fd[0], info.fd[1], info.fpl[0], info.fpl[1]);
// printf("t_fd[0]: %d, t_fd[1]: %d, t_fpl[0]: %d, t_fpl[1]: %d\n", t_fd[0], t_fd[1], t_fpl[0], t_fpl[1]);
// printf("s_fd[0]: %d, s_fd[1]: %d, s_fpl[0]: %d, s_fpl[1]: %d\n\n", sim_g->fault_detected[0], sim_g->fault_detected[1], sim_g->fault_propagated_len[0], sim_g->fault_propagated_len[1]);
// }
assert(info.value == sim_g->value);
assert(t_fd[0] == sim_g->fault_detected[0]);
assert(t_fd[1] == sim_g->fault_detected[1]);
// assert(t_fpl[0] == sim_g->fault_propagated_len[0]);
// assert(t_fpl[1] == sim_g->fault_propagated_len[1]);
}
}
return 1;
}
void Simulator::simulate(std::vector<LUT*> &inputs, int &score, int** fault_detected) {
assert(inputs.size() == this->PIs.size());
for(int i=0; i<inputs.size(); i++) {
PIs[i]->value = inputs[i]->value;
}
for(auto gate : gates) {
gate->value = gate->cal_value();
}
for(auto gate : rtopo_gates) {
gate->fault_detected[0] = gate->cal_fault_detected(0);
gate->fault_detected[1] = gate->cal_fault_detected(1);
gate->fault_propagated_len[0] = gate->cal_propagate_len(0);
gate->fault_propagated_len[1] = gate->cal_propagate_len(1);
}
score = 0;
for(auto gate : gates) {
if(gate->fault_detected[0] && !fault_detected[gate->id-1][0]) {
score++;
}
if(gate->fault_detected[1] && !fault_detected[gate->id-1][1]) {
score++;
}
}
}

13
src/simulator.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#include "circuit.h"
namespace atpg_ls {
class Simulator : public Circuit {
public:
void simulate(std::vector<LUT*> &inputs, int &score, int** fault_detected);
int verify(LUTCircuit *lut_circuit, int** fault_detected);
};
}

1
tg-pro Submodule

@ -0,0 +1 @@
Subproject commit 7f0eef881be4d91aef0095e3a889e485a4e42f5d