#include <rrrSimulator.h>
template<typename Ntk>
class rrr::Simulator< Ntk >
Definition at line 15 of file rrrSimulator.h.
◆ Simulator() [1/2]
Definition at line 662 of file rrrSimulator.h.
662 :
664 nVerbose(0),
665 nWords(0),
666 fGenerated(false),
667 fInitialized(false),
668 target(-1),
669 iPivot(0),
670 fUpdate(false) {
672 }
◆ Simulator() [2/2]
Definition at line 675 of file rrrSimulator.h.
675 :
677 nVerbose(
pPar->nSimulatorVerbose),
678 nWords(
pPar->nWords),
679 fGenerated(false),
680 fInitialized(false),
681 target(-1),
682 iPivot(0),
683 fUpdate(false) {
684 care.resize(nWords);
685 tmp.resize(nWords);
687 }
◆ AddCex()
Definition at line 786 of file rrrSimulator.h.
786 {
787 if(nVerbose) {
791 }
793 }
794
797 for(
int idx = 0;
idx < pNtk->GetNumPis();
idx++) {
801 break;
804 break;
805 default:
806 break;
807 }
808 }
810
817 int id = pNtk->GetPi(
idx);
821 } else {
824 }
825 itr
x = vValues.begin() +
id * nWords +
iWord;
826 itr
y = vAssignedStimuli.begin() +
idx * nWords +
iWord;
827 And(1, tmp.begin(),
x,
y, !
c,
false);
828 And(1,
it,
it, tmp.begin(),
false,
true);
830 break;
831 }
832 }
834 break;
835 }
836 }
837
842 while(!((*
it >>
iBit) & 1)) {
844 }
845 if(nVerbose) {
847 }
849 } else {
850
853 if(nVerbose) {
855 }
857
858 vPackedCountEvicted.push_back(vPackedCount[
iWord * 64 +
iBit]);
859 }
862 for(
int idx = 0;
idx < pNtk->GetNumPis();
idx++) {
864 }
865 iPivot++;
866 if(iPivot == 64 * nWords) {
867 iPivot = 0;
868 }
869 }
870
872 int id = pNtk->GetPi(
idx);
876 } else {
879 }
881 if(nVerbose) {
883 Print(1, vValues.begin() +
id * nWords +
iWord);
886 Print(1, vAssignedStimuli.begin() +
idx * nWords +
iWord);
888 }
889 }
890
891 SimulateOneWord(
iWord);
892
894 if(target != -1 && !pNtk->IsPoDriver(target)) {
895 if(nVerbose) {
897 }
898 vValues2.resize(vValues.size());
899 pNtk->ForEachPi([&](int id) {
900 vValues2[
id * nWords +
iWord] = vValues[
id * nWords +
iWord];
901 });
902 pNtk->ForEachInt([&](int id) {
903 vValues2[
id * nWords +
iWord] = vValues[
id * nWords +
iWord];
904 });
905 pNtk->ForEachTfo(target, false, [&](int id) {
906 SimulateOneWordNode(vValues2,
id,
iWord, target);
907 if(nVerbose) {
909 Print(1, vValues2.begin() +
id * nWords +
iWord);
911 }
912 });
913 Clear(1, care.begin() +
iWord);
914 pNtk->ForEachPoDriver([&](
int fi) {
917 });
918 if(nVerbose) {
920 Print(1, care.begin() +
iWord);
922 }
923 }
925 nCex++;
926 }
◆ AssignNetwork()
Definition at line 690 of file rrrSimulator.h.
690 {
692 fGenerated = false;
693 }
694 fInitialized = false;
695 target = -1;
696 fUpdate = false;
697 sUpdates.clear();
700 }
◆ CheckFeasibility()
Definition at line 747 of file rrrSimulator.h.
747 {
748 if(!fInitialized) {
749 Initialize();
750 }
751 ComputeCare(id);
752 switch(pNtk->GetNodeType(id)) {
754 itr
x = vValues.end();
756 pNtk->ForEachFanin(
id, [&](
int fi,
bool c) {
757 if(
x == vValues.end()) {
758 x = vValues.begin() +
fi * nWords;
760 } else {
761 And(nWords, tmp.begin(),
x, vValues.begin() +
fi * nWords,
cx,
c);
764 }
765 });
766 if(
x == vValues.end()) {
768 } else {
769 And(nWords, tmp.begin(),
x, care.begin(),
cx,
false);
771 }
772 And(nWords, tmp.begin(),
x, vValues.begin() +
fi * nWords,
false, !
c);
773 return IsZero(nWords, tmp.begin());
774 }
775 default:
777 }
778 return false;
779 }
◆ CheckRedundancy()
Definition at line 707 of file rrrSimulator.h.
707 {
708 if(!fInitialized) {
709 Initialize();
710 }
711 ComputeCare(id);
712 switch(pNtk->GetNodeType(id)) {
714 itr
x = vValues.end();
716 pNtk->ForEachFaninIdx(
id, [&](
int idx2,
int fi,
bool c) {
718 return;
719 }
720 if(
x == vValues.end()) {
721 x = vValues.begin() +
fi * nWords;
723 } else {
724 And(nWords, tmp.begin(),
x, vValues.begin() +
fi * nWords,
cx,
c);
727 }
728 });
729 if(
x == vValues.end()) {
731 } else {
732 And(nWords, tmp.begin(),
x, care.begin(),
cx,
false);
734 }
735 int fi = pNtk->GetFanin(
id,
idx);
736 bool c = pNtk->GetCompl(
id,
idx);
737 And(nWords, tmp.begin(),
x, vValues.begin() +
fi * nWords,
false, !
c);
738 return IsZero(nWords, tmp.begin());
739 }
740 default:
742 }
743 return false;
744 }
◆ GetStatsSummary()
Definition at line 948 of file rrrSimulator.h.
948 {
950 v.emplace_back(
"sim cex", nCex);
951 if(!fKeepStimula) {
952 v.emplace_back(
"sim discarded cex", nDiscarded);
953 }
954 int nPackedCount = vPackedCountEvicted.size() - nPackedCountOld;
955 for(
int count: vPackedCount) {
958 }
959 }
961 v.emplace_back(
"sim evicted pattern", vPackedCountEvicted.size());
963 };
◆ GetTimesSummary()
Definition at line 966 of file rrrSimulator.h.
966 {
968 v.emplace_back(
"sim simulation", durationSimulation);
969 v.emplace_back(
"sim care computation", durationCare);
971 };
◆ ResetSummary()
Definition at line 933 of file rrrSimulator.h.
933 {
934 nCex = 0;
935 nDiscarded = 0;
936 nPackedCountOld = 0;
937 for(
int count: vPackedCount) {
939 nPackedCountOld++;
940 }
941 }
942 vPackedCountEvicted.clear();
943 durationSimulation = 0;
944 durationCare = 0;
945 };
The documentation for this class was generated from the following file: