lsils / mockturtle

C++ logic network library
MIT License
191 stars 133 forks source link

The `blif_reader` to mig directly is not worked as expected #620

Closed wjrforcyber closed 10 months ago

wjrforcyber commented 10 months ago

Describe the bug The blif_reader to mig directly is not worked as expected with error: static assertion failed: Ntk does not implement the create_node function or the create_cover_node function

To Reproduce version: latest version

Reproduce with:

mockturtle::mig_network ntk;
mockturtle::names_view<mockturtle::mig_network> names_view{ntk};
lorina::return_code result = lorina::read_blif(filename, mockturtle::blif_reader(names_view));

Error

error: static assertion failed: Ntk does not implement the create_node function or the create_cover_node function
static_assert( has_create_node_v<Ntk> || has_create_cover_node_v<Ntk>, "Ntk does not implement the create_node function or the create_c
over_node function" );

Environment Centos 8 Debug mode

Check list

lee30sonia commented 10 months ago

This is the expected behavior. The BLIF format specifies blocks of logic functions, i.e., a k-LUT network in our terminology. We cannot ensure that the input file only contains MAJ-3 gates, thus reading a BLIF file as an MIG is not supported. What you could do is reading BLIF as a klut_network, and then use one of the mapping or graph conversion methods to convert into mig_network.

wjrforcyber commented 10 months ago

This is the expected behavior. The BLIF format specifies blocks of logic functions, i.e., a k-LUT network in our terminology. We cannot ensure that the input file only contains MAJ-3 gates, thus reading a BLIF file as an MIG is not supported. What you could do is reading BLIF as a klut_network, and then use one of the mapping or graph conversion methods to convert into mig_network.

I thought since aig reader is supported, an automatic convert from aig to mig is supported too. Thanks for your reply.

lee30sonia commented 10 months ago

I'm not sure what you mean by "aig reader is supported", but if you have an AIGER file, you could read_aiger with mig_network, that should work.