Skip to content

Commit

Permalink
AQFP network fix (#540)
Browse files Browse the repository at this point in the history
* Technology mapper

* Tech mapper fixes

* Tech mapper test updates

* Updates and fixes

* Mapper updates: switching power optimization and templates restructuring

* Mapper: added option to exploit logic sharing, name modifications, tests and experiments updates

* minor fixes

* Modified test: from exact_map to map

* Added P-enumeration and N-matching option in library and mapping to support bigger cell libraries, improved mapping performances, fixed error when truth table minimization is false, increased the cut limit to 50, updated tests for changes

* Added inverter usage in exact mapping

* removed always_inline to avoid compiler error on Windows

* Added mapper documentation

* docs fix

* Add binding view for mapped networks, added i/o code to write mapped networks in verilog

* Added buffering in mapping

* Simplified write_verilog for mapped networks, added and updated tests, minor fixes

* Added compatibility with multiple pins in Genlib libraries, changed experiment setup for MIG map reading AIGs into MIGs

* Support pin names from genlib, better checks on pins parsing

* Genilb test corrections

* Supergates importing and representation utilities

* Updates for supergates support

* Added supergates support

* Moved gates usage report to binding_view

* Test fixes for new library structure

* Added report commands in binding_view

* Added new tests for supergates, modified supergates insertion procedure to avoid duplicated gates

* Added NP-configurations of supergates, use of phmap for better performances, added tests for mapping with supergates

* Added tests for binding_library

* Fixes

* Fixes cast

* Added tests to improve coverage

* Header and description fixes

* Fixes in constant gates for write_verilog, extended usage of topo_view in mapping

* Added new mapper, library, supergates, and i/o documentation

* Updates to the documentation

* Minor fixes and error reporting in mapper

* Small fix

* bux fix in AQFP network

* fix in binding view

* Removed random truth table in akers_synthesis test cases, AQFP network fix
  • Loading branch information
aletempiac authored Mar 21, 2022
1 parent 5ec601e commit ce17ff1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
21 changes: 13 additions & 8 deletions include/mockturtle/networks/aqfp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
\brief AQFP network implementation
\author Dewmini Marakkalage
\author Alessandro Tempia Calvino
*/

#pragma once
Expand Down Expand Up @@ -521,23 +522,27 @@ class aqfp_network

std::vector<signal> old_children;

for ( auto i = 0u; i <= node.children.size(); ++i )
bool replacement = false;
for ( size_t i = 0u; i < node.children.size(); ++i )
{
if ( i == node.children.size() )
{
return std::nullopt;
}

old_children.push_back( signal{ node.children[i] } );

if ( node.children[i].index == old_node )
{
node.children[i] = node.children[i].weight ? !new_signal : new_signal;
new_signal.complement ^= node.children[i].weight;
replacement = true;

// update the reference counter of the new signal
_storage->nodes[new_signal.index].data[0].h1++;
}
}

/* TODO: Do the simplifications if possible */
if ( !replacement )
{
return std::nullopt;
}

/* TODO: Do the simplifications if possible and ordering */

for ( auto const& fn : _events->on_modified )
{
Expand Down
4 changes: 2 additions & 2 deletions include/mockturtle/views/binding_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class binding_view : public Ntk
{
float tot_gate_area = gates_profile[i] * _library[i].area;

os << fmt::format( "[i] {:<15}", _library[i].name )
os << fmt::format( "[i] {:<25}", _library[i].name )
<< fmt::format( "\t Instance = {:>10d}", gates_profile[i] )
<< fmt::format( "\t Area = {:>12.2f}", tot_gate_area )
<< fmt::format( " {:>8.2f} %\n", tot_gate_area / area * 100 );
Expand All @@ -248,7 +248,7 @@ class binding_view : public Ntk
}
}

os << fmt::format( "[i] {:<15}", "TOTAL" )
os << fmt::format( "[i] {:<25}", "TOTAL" )
<< fmt::format( "\t Instance = {:>10d}", tot_instances )
<< fmt::format( "\t Area = {:>12.2f} 100.00 %\n", area );
}
Expand Down
10 changes: 7 additions & 3 deletions test/algorithms/akers_synthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ TEST_CASE( "Check Akers for MAJ-5 in XMG", "[akers_synthesis]" )

TEST_CASE( "Check Akers for random - 4 inputs", "[akers_synthesis]" )
{
std::array<std::string, 5> tts = { "d5d0", "fe52", "ad1b", "401a", "79e2" };

for ( auto y = 0; y < 5; y++ )
{
std::vector<kitty::dynamic_truth_table> xs{6, kitty::dynamic_truth_table( 4 )};
Expand All @@ -97,7 +99,7 @@ TEST_CASE( "Check Akers for random - 4 inputs", "[akers_synthesis]" )
kitty::create_nth_var( xs[4], 2 );
kitty::create_nth_var( xs[5], 3 );

create_random( xs[0] );
create_from_hex_string( xs[0], tts[y] );

for ( auto i = 0u; i < unsigned( xs[0].num_bits() ); i++ )
{
Expand Down Expand Up @@ -134,6 +136,8 @@ TEST_CASE( "Check Akers for random - 4 inputs", "[akers_synthesis]" )

TEST_CASE( "Check Akers for random - 5 inputs", "[akers_synthesis]" )
{
std::array<std::string, 5> tts = { "e3cee67b", "bb5bee39", "b220ff4c", "fa43751f", "9ec83bf4" };

for ( auto y = 0; y < 5; y++ )
{
std::vector<kitty::dynamic_truth_table> xs{7, kitty::dynamic_truth_table( 5 )};
Expand All @@ -143,7 +147,7 @@ TEST_CASE( "Check Akers for random - 5 inputs", "[akers_synthesis]" )
kitty::create_nth_var( xs[5], 3 );
kitty::create_nth_var( xs[6], 4 );

create_random( xs[0] );
create_from_hex_string( xs[0], tts[y] );

for ( auto i = 0u; i < unsigned( xs[0].num_bits() ); i++ )
{
Expand Down Expand Up @@ -190,7 +194,7 @@ TEST_CASE( "Check Akers for random - 6 inputs", "[akers_synthesis]" )
kitty::create_nth_var( xs[6], 4 );
kitty::create_nth_var( xs[7], 5 );

create_random( xs[0] );
create_from_hex_string( xs[0], "32b43db39dde2b16" );

for ( auto i = 0u; i < unsigned( xs[0].num_bits() ); i++ )
{
Expand Down
10 changes: 5 additions & 5 deletions test/views/binding_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ TEST_CASE( "Create binding view", "[binding_view]" )
std::stringstream report_gates;
ntk.report_gates_usage( report_gates );
CHECK( report_gates.str() == "[i] Report gates usage:\n"
"[i] zero \t Instance = 1\t Area = 0.00 0.00 %\n"
"[i] inverter \t Instance = 1\t Area = 1.00 6.25 %\n"
"[i] and \t Instance = 2\t Area = 10.00 62.50 %\n"
"[i] or \t Instance = 1\t Area = 5.00 31.25 %\n"
"[i] TOTAL \t Instance = 5\t Area = 16.00 100.00 %\n" );
"[i] zero \t Instance = 1\t Area = 0.00 0.00 %\n"
"[i] inverter \t Instance = 1\t Area = 1.00 6.25 %\n"
"[i] and \t Instance = 2\t Area = 10.00 62.50 %\n"
"[i] or \t Instance = 1\t Area = 5.00 31.25 %\n"
"[i] TOTAL \t Instance = 5\t Area = 16.00 100.00 %\n" );
}

TEST_CASE( "Binding view on copy", "[binding_view]" )
Expand Down

0 comments on commit ce17ff1

Please sign in to comment.