From 8327b3ac66f59d40608d980919c71a5ccc70e48a Mon Sep 17 00:00:00 2001 From: 3A <524019351@qq.com> Date: Wed, 30 Dec 2020 23:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8A=B6=E6=80=81=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E7=9C=9F=E5=80=BC=E8=A1=A8=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/node.h b/node.h index eddf170..e914c68 100644 --- a/node.h +++ b/node.h @@ -100,22 +100,27 @@ class nodeManager vector allInput; vector allOutput; vector allTri; - void recuTriTrue(uint sub = 0) + + string recuTriTrue(uint sub = 0) { + string result; + tri* t=(tri*)(allTri[sub]->g); t->setQ(0); - if(sub==allTri.size()-1) - run(true); + if(sub==allTri.size()-1) //产生一个所有触发器值的组合之后再run + result=run(true)+result; else - recuTriTrue(sub+1); + result=recuTriTrue(sub+1)+result; t->setQ(1); if(sub==allTri.size()-1) - run(true); + result=run(true)+result; else - recuTriTrue(sub+1); + result=recuTriTrue(sub+1)+result; + + return result; } void resetChunk() @@ -164,18 +169,22 @@ class nodeManager string trueTable(uint sub = 0, bool staRecu=false) { + if(staRecu && this->allTri.empty()) + return "There is no trigger in this circuit\n"; + string result; + auto conti=[&]() { if(sub==allInput.size()-1) { if(staRecu) - recuTriTrue(); + result+=recuTriTrue(); else result+=run(); } else - trueTable(sub+1,staRecu); + result+=trueTable(sub+1,staRecu); }; allInput[sub]->constVal=0; @@ -200,7 +209,7 @@ class nodeManager for(uint i=0;ig); - result+="["+to_string(i)+"]"+to_string(t->getQ())<+" "; + result+="["+to_string(i)+"]"+to_string(t->getQ())+" "; } }