diff --git a/ariths_gen/core/arithmetic_circuits/general_circuit.py b/ariths_gen/core/arithmetic_circuits/general_circuit.py index 5f0b677..301453f 100644 --- a/ariths_gen/core/arithmetic_circuits/general_circuit.py +++ b/ariths_gen/core/arithmetic_circuits/general_circuit.py @@ -881,7 +881,6 @@ class GeneralCircuit(): for i in range(self.out.N): active_outputs.add(self.out[i].name) - print(active_outputs) # for all gates back for g in reversed(self.circuit_gates): if g.out.name in active_outputs: @@ -894,12 +893,6 @@ class GeneralCircuit(): print("Setting active output", g.out, " for gate ", g) - print("active outputs", active_outputs) - - print(hash_outputs) - - - inputs = [] for i in self.inputs: for j in range(i.N): diff --git a/tests/tb_adder_signed.v b/tests/tb_adder_signed.v index aaebec4..b6d39aa 100644 --- a/tests/tb_adder_signed.v +++ b/tests/tb_adder_signed.v @@ -28,6 +28,6 @@ module add_signed_tb; end end; end; - $finish; + $finish(0); end endmodule \ No newline at end of file diff --git a/tests/tb_adder_unsigned.v b/tests/tb_adder_unsigned.v index 2957c41..9116c71 100644 --- a/tests/tb_adder_unsigned.v +++ b/tests/tb_adder_unsigned.v @@ -28,6 +28,6 @@ module add_unsigned_tb; end end; end; - $finish; + $finish(0); end endmodule \ No newline at end of file diff --git a/tests/tb_multiplier_signed.v b/tests/tb_multiplier_signed.v index 67a87bd..ff6e15b 100644 --- a/tests/tb_multiplier_signed.v +++ b/tests/tb_multiplier_signed.v @@ -28,6 +28,6 @@ module mul_unsigned_tb; end end; end; - $finish; + $finish(0); end endmodule \ No newline at end of file diff --git a/tests/tb_multiplier_unsigned.v b/tests/tb_multiplier_unsigned.v index 4a706ab..0ecb53d 100644 --- a/tests/tb_multiplier_unsigned.v +++ b/tests/tb_multiplier_unsigned.v @@ -28,6 +28,6 @@ module mul_unsigned_tb; end end; end; - $finish; + $finish(0); end endmodule \ No newline at end of file diff --git a/tests/tb_subtractor_signed.v b/tests/tb_subtractor_signed.v index 92d2af2..985c0dc 100644 --- a/tests/tb_subtractor_signed.v +++ b/tests/tb_subtractor_signed.v @@ -28,6 +28,6 @@ module sub_signed_tb; end end; end; - $finish; + $finish(0); end endmodule \ No newline at end of file diff --git a/tests/tb_subtractor_unsigned.v b/tests/tb_subtractor_unsigned.v index fec214e..ac36aff 100644 --- a/tests/tb_subtractor_unsigned.v +++ b/tests/tb_subtractor_unsigned.v @@ -28,6 +28,6 @@ module sub_unsigned_tb; end end; end; - $finish; + $finish(0); end endmodule \ No newline at end of file diff --git a/tests/test_cnf.py b/tests/test_cnf.py index c2f4149..68b5510 100644 --- a/tests/test_cnf.py +++ b/tests/test_cnf.py @@ -1,6 +1,7 @@ import os import sys + # Add the parent directory to the system path DIR_PATH = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(DIR_PATH, '..')) @@ -11,6 +12,8 @@ import math from io import StringIO import tempfile +from ariths_gen.one_bit_circuits.logic_gates.logic_gates import AndGate, NotGate, OrGate, XnorGate, XorGate, NandGate, NorGate +from ariths_gen.wire_components.buses import Bus, Wire from ariths_gen.core.cgp_circuit import UnsignedCGPCircuit from ariths_gen.core.arithmetic_circuits.general_circuit import GeneralCircuit @@ -98,7 +101,24 @@ def test_cnf_minisat(): assert res["clauses"] == 0 assert not res["SATISFIABLE"] +def test_cnf_own(): + class c(GeneralCircuit): + def __init__(self): + inputs = Bus(N=4, prefix="a") + super().__init__(name="c", prefix="c", inputs=[inputs], out_N=1) + + # a AND (NOT a) + g1 = self.add_component(NotGate(inputs[0], prefix="g1")).out + g2 = self.add_component(AndGate(inputs[0], g1, prefix="g2")).out + self.out.connect(0, g2) + + res = minisat_runner(c()).get_results() + print(res) + assert not res["SATISFIABLE"] # UNSAT + assert res["clauses"] == 0 + if __name__ == "__main__": + test_cnf_own() test_cnf_minisat() print("CNF Python tests were successful!")