Skip to content

Commit

Permalink
rename mapping as legalization
Browse files Browse the repository at this point in the history
  • Loading branch information
lee30sonia committed Mar 5, 2024
1 parent 886b95d commit d56f795
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
10 changes: 5 additions & 5 deletions experiments/aqfp_flow_tcad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <fmt/format.h>

#include <mockturtle/algorithms/aqfp/aqfp_mapping.hpp>
#include <mockturtle/algorithms/aqfp/aqfp_legalization.hpp>
#include <mockturtle/algorithms/aqfp/buffer_verification.hpp>
#include <mockturtle/algorithms/cleanup.hpp>
#include <mockturtle/io/verilog_reader.hpp>
Expand Down Expand Up @@ -66,16 +66,16 @@ int main()
aqfp_ps.balance_pis = true;
aqfp_ps.balance_pos = true;

aqfp_mapping_params ps;
aqfp_legalization_params ps;
ps.aqfp_assumptions_ps = aqfp_ps;
ps.mapping_mode = aqfp_mapping_params::portfolio;
ps.legalization_mode = aqfp_legalization_params::portfolio;
ps.verbose = true;
ps.max_chunk_size = UINT32_MAX;
ps.retime_iterations = UINT32_MAX;
ps.optimization_rounds = UINT32_MAX;
aqfp_mapping_stats st;
aqfp_legalization_stats st;

buffered_aqfp_network res = aqfp_mapping( mig_opt, ps, &st );
buffered_aqfp_network res = aqfp_legalization( mig_opt, ps, &st );

/* cec */
auto cec = abc_cec_aqfp( res, benchmark );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*/

/*!
\file aqfp_mapping.hpp
\brief Mapping flow for AQFP networks
\file aqfp_legalization.hpp
\brief Legalization + buffer optimization flow for AQFP networks
\author Alessandro Tempia Calvino
*/
Expand All @@ -49,21 +49,21 @@
namespace mockturtle
{

struct aqfp_mapping_params
struct aqfp_legalization_params
{
aqfp_mapping_params()
aqfp_legalization_params()
{
aqfp_assumptions_ps.branch_pis = true;
aqfp_assumptions_ps.balance_pis = true;
aqfp_assumptions_ps.balance_pos = true;
}

/*! \brief Mapping mode. */
/*! \brief legalization mode. */
enum
{
better,
portfolio
} mapping_mode = portfolio;
} legalization_mode = portfolio;

/*! \brief AQFP technology assumptions. */
aqfp_assumptions_legacy aqfp_assumptions_ps{};
Expand All @@ -87,7 +87,7 @@ struct aqfp_mapping_params
bool verbose{ false };
};

struct aqfp_mapping_stats
struct aqfp_legalization_stats
{
/*! \brief Number of Josephson Junctions (JJs). */
uint32_t num_jjs{ 0 };
Expand Down Expand Up @@ -118,10 +118,10 @@ namespace detail
{

template<class Ntk>
class aqfp_mapping_impl
class aqfp_legalization_impl
{
public:
explicit aqfp_mapping_impl( Ntk const& ntk, aqfp_mapping_params const& ps, aqfp_mapping_stats& st )
explicit aqfp_legalization_impl( Ntk const& ntk, aqfp_legalization_params const& ps, aqfp_legalization_stats& st )
: _ntk( ntk ), _ps( ps ), _st( st )
{
}
Expand All @@ -143,7 +143,7 @@ class aqfp_mapping_impl
bool retiming_backward_first = false;

/* Starndard flow: insertion + optimization */
if ( _ps.mapping_mode == aqfp_mapping_params::better )
if ( _ps.legalization_mode == aqfp_legalization_params::better )
{
buffered_aqfp_network buffered_aqfp = aqfp_buffer_insertion( buf_inst, retiming_backward_first );
buffered_aqfp_network aqfp_res = aqfp_buffer_optimize( buffered_aqfp, retiming_backward_first );
Expand Down Expand Up @@ -177,7 +177,7 @@ class aqfp_mapping_impl
{
stopwatch t( _st.time_insertion );

if ( _ps.mapping_mode == aqfp_mapping_params::portfolio )
if ( _ps.legalization_mode == aqfp_legalization_params::portfolio )
{
if ( is_alap )
{
Expand All @@ -188,7 +188,7 @@ class aqfp_mapping_impl
buf_inst.set_scheduling_policy( buffer_insertion_params::ASAP_depth );
}
}
else if ( _ps.mapping_mode == aqfp_mapping_params::better )
else if ( _ps.legalization_mode == aqfp_legalization_params::better )
{
buf_inst.set_scheduling_policy( buffer_insertion_params::better_depth );
}
Expand Down Expand Up @@ -281,13 +281,13 @@ class aqfp_mapping_impl

private:
Ntk const& _ntk;
aqfp_mapping_params const& _ps;
aqfp_mapping_stats& _st;
aqfp_legalization_params const& _ps;
aqfp_legalization_stats& _st;
};

} /* namespace detail */

/*! \brief AQFP mapping.
/*! \brief AQFP legalization.
*
* This function returns an optimized AQFP circuit
* derived from the input one by inserting buffer
Expand All @@ -297,10 +297,10 @@ class aqfp_mapping_impl
* optimization.
*
* \param ntk Boolean network as an MIG or AQFP network
* \param ps AQFP mapping
* \param ps AQFP legalization parameters
*/
template<class Ntk>
buffered_aqfp_network aqfp_mapping( Ntk const& ntk, aqfp_mapping_params const& ps = {}, aqfp_mapping_stats* pst = nullptr )
buffered_aqfp_network aqfp_legalization( Ntk const& ntk, aqfp_legalization_params const& ps = {}, aqfp_legalization_stats* pst = nullptr )
{
static_assert( is_network_type_v<Ntk>, "Ntk is not a network type" );
static_assert( has_get_node_v<Ntk>, "Ntk does not implement the get_node method" );
Expand All @@ -314,9 +314,9 @@ buffered_aqfp_network aqfp_mapping( Ntk const& ntk, aqfp_mapping_params const& p
static_assert( has_is_complemented_v<Ntk>, "Ntk does not implement the is_complemented method" );
static_assert( std::is_same_v<typename Ntk::base_type, mig_network> || std::is_same_v<typename Ntk::base_type, aqfp_network>, "Ntk in not an MIG or AQFP network type" );

aqfp_mapping_stats st;
aqfp_legalization_stats st;

detail::aqfp_mapping_impl p( ntk, ps, st );
detail::aqfp_legalization_impl p( ntk, ps, st );
auto res = p.run();

if ( ps.verbose )
Expand Down

0 comments on commit d56f795

Please sign in to comment.