lsils / mockturtle

C++ logic network library
MIT License
202 stars 136 forks source link

Write a sequential circuit with register outputs. #572

Closed Nozidoali closed 1 year ago

Nozidoali commented 1 year ago

Describe the bug A register output (RO) created before a primary output (PO) will become a PO when writing to the BLIF file. (because write_blif always assume the first num_co index are POs and the rest are ROs).

To Reproduce

  sequential<klut_network> klut;

  const auto a = klut.create_pi();
  const auto b = klut.create_pi();
  const auto f1 = klut.create_or( a, b );

  klut.create_ri( f1 );
  const auto f2 = klut.create_ro(); // always_ff: f2 <= f1;

  klut.create_po( f2 );

  write_blif( klut, "<filename>.blif" );

Environment

Additional context In the current version (commit 39fd19c3215da2d395c769cfa92df578847ae6f7), ROs and POs are mixed in all network implementations.

Check list