Coloquinte / moosic-yosys-plugin

Yosys plugin for logic locking and supply-chain security
GNU General Public License v2.0
20 stars 2 forks source link

Flip-flops with a direct output cause combinatorial loops with Antisat #26

Closed Coloquinte closed 5 months ago

Coloquinte commented 5 months ago

This can be seen with the following test:

yosys -m moosic -p "read_blif -sop blif/iscas89-s1196a.blif; flatten; synth; show; logic_locking -target outputs -nb-antisat 16 -antisat antisat -key 77777777777777777777777777777777777777; check"
Coloquinte commented 5 months ago

What happens is that:

  1. We decide which gates to lock - the flip-flop in this case
  2. Add the Antisat structures, using the flip-flop output
  3. Add key gates and connect them to the Antisat, creating the loop

The issue is that the creation of the Antisat structure uses the inputs before locking, but locking adds key gates before some of those inputs. We could:

Coloquinte commented 5 months ago

Now fixed: locking is done first, then the Antisat structure, then the connections between them