ACESLabUCSD / TinyGarbleCircuitSynthesis

Circuit Synthesis for Yao's Garbled Circuit by TinyGarble
10 stars 1 forks source link

The Division example is not giving correct outputs #1

Open andremmvgabriel opened 4 years ago

andremmvgabriel commented 4 years ago

Hello,

I'm using Yosys to read and make the synthesis of the Division Verilogs. However, for the verilogs inside the benchmarks folder, the "hierarchy -check -top top_module" step is not working. As so, the circuit synthesis for example is not achievable... Can you verify if everything is correct for this example?

On the other hand, I've tried as well to make the synthesis of the Division verilog inside the benchmarks2 folder (a .sv file). With that one I was able to make it and then able to convert it to a .scd file. However, when I was testing that circuit, the outputs were mostly incorrect... For example, these 2 tests:

If you don't mind, can you also check that circuit?

Thanks for your attention.

Best regards, André Gabriel

siamumar commented 4 years ago

Hi, sorry for the delay in reply.

Regarding "hierarchy -check -top top_module", what did you set as the top module and what is the error? It would be easier if you send the entire .yos file and the error reported by Yosys.

Regarding the division inside the benchmarks2 folder, the outputs are actually correct if you treat them as signed numbers. decimal is (-126)/5 = -25. If you look inside "Benchmarks2/div/div_nm_2n.sv", you will see that all the inputs and outputs are signed. Also "DIV" (with the underscore) is for signed operations. If you want unsigned operations, please remove "signed" from input and output ports and replace "div" with "div". You can see the implementation of both "div" and "div" in "SynthesisLibrary/syn_lib".