Skip to content

Commit

Permalink
addign cl report
Browse files Browse the repository at this point in the history
  • Loading branch information
kanndil committed Sep 30, 2024
1 parent 748ad2f commit a3cfc9e
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/PodemQuest/PODEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def compute(self, algorithm="basic"):
# print("test vector: NOT FOUND ")
elif algorithm == "advanced":
test_vectors = [] # Initialize an empty list to store the test vectors
for fault in self.circuit.faults:
total_faults = len(self.circuit.faults) # Total number of faults to process
progress_threshold = total_faults // 20 # Every 5% of total faults

for idx, fault in enumerate(self.circuit.faults):
fault_site = fault[0]
self.fault_gate = self.circuit.gates[fault_site]
self.fault_gate.faulty = True
Expand All @@ -97,36 +100,39 @@ def compute(self, algorithm="basic"):
self.fault_gate.fault_value = D_Value.ONE

self.init_PODEM()
# print("Fault: ", fault)
ret = self.advanced_PODEM()
self.fault_gate.faulty = False
if ret == True:
self.uncovered_faults += 1
success_vector = self.ret_success_vector() # Get the test vector
# print("test vector: ", success_vector)

success_vector = "".join(
["0" if char == "X" else char for char in success_vector]
)
test_vectors.append(
str(self.uncovered_faults) + ": " + f"{success_vector}\n"
)

else:
# print("test vector: NOT FOUND ")
self.failures += 1
## Write the entire list to the file at once
header_pin_names = """* Test pattern file
* generated by PodemQuest"""
# for PI in self.circuit.primary_input_gates:
# header_pin_names+= f"{PI.outputpin} "

with open(self.output_file, "w") as f:
f.write(header_pin_names + "\n")
f.writelines(test_vectors)
# Print progress bar for every 5% completion
print(f"idx: {idx} / {total_faults}")
if (idx + 1) % progress_threshold == 0 or idx == total_faults - 1:
percentage_done = (idx + 1) / total_faults * 100
print(f"Progress: {percentage_done:.2f}% done")


# Write the entire list to the file at once
header_pin_names = """* Test pattern file
* generated by PodemQuest"""

with open(self.output_file, "w") as f:
f.write(header_pin_names + "\n")
f.writelines(test_vectors)

# print("wrote to ", self.output_file)
return


def init_PODEM(self):
"""
Initializes the output of each gate to X.
Expand Down

0 comments on commit a3cfc9e

Please sign in to comment.