Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to emap #641

Merged
merged 28 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4d29ec0
First incomplete tuned emap
aletempiac Apr 24, 2024
ac376e8
Fixes for tuning estimated references and inverters
aletempiac Apr 24, 2024
28091a0
Removing collective references and collective estimations, removing d…
aletempiac Apr 25, 2024
0a8f4b8
Experiment file
aletempiac Apr 25, 2024
25b0bf1
Add new multi-output cut initialization
aletempiac Apr 25, 2024
996c068
Fixes to emap
aletempiac Apr 25, 2024
4d6ba96
Lowering the default memory usage and formatting the code
aletempiac Apr 26, 2024
72e7d7e
Reverting emap experiment to default
aletempiac Apr 26, 2024
ecb1746
Add updated tests
aletempiac Apr 26, 2024
f75f399
Improving phase dropping heuristics and first implementation of alter…
aletempiac Apr 29, 2024
e82ffaf
Improving emap and integration of alternatives
aletempiac Apr 30, 2024
ec071e4
Performance improvements
aletempiac May 1, 2024
c2ca9a8
Add inverter cost evaluation in exact area (high inverter cost optimi…
aletempiac May 1, 2024
b9fb641
Add pin-specific input arrival times and required time constraints to…
aletempiac May 1, 2024
f720bea
removing standard foward exact area method (completely replaced by ex…
aletempiac May 1, 2024
1c5284c
Updating tests
aletempiac May 1, 2024
e202d8d
Adding tests on custom required times, required time relaxation, and …
aletempiac May 1, 2024
42f2e13
Reverting experiment file
aletempiac May 1, 2024
cc3babc
Formatting and changing output text when loading a library
aletempiac May 1, 2024
2e8855f
Updating documentation
aletempiac May 1, 2024
653427c
Changing names and formatting
aletempiac May 1, 2024
406a5de
Fixing multioutput cut insertion on cutset
aletempiac May 3, 2024
f222053
Adding option for removing symmetrical permutations of gates for fast…
aletempiac May 6, 2024
fe15cd6
Updating experiment emap
aletempiac May 6, 2024
bc32f0d
Bug fix delay for structural matches
aletempiac May 6, 2024
328b919
Merge remote-tracking branch 'origin/master' into emap_tuned
aletempiac May 6, 2024
8a10355
Fixes and data structure changes
aletempiac May 6, 2024
c13cd02
revert changes
aletempiac May 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 85 additions & 81 deletions docs/algorithms/mapper.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,87 @@
Extended technology mapping
---------------------------

**Header:** ``mockturtle/algorithms/emap.hpp``

The command `emap` stands for extended mapper. It supports large
library cells, of more than 6 inputs, and can perform matching using 3
different methods: Boolean, pattern, or hybrid. The current version
can map to 2-output gates, such as full adders and half adders,
and provides a 2x speedup in mapping time compared to command `map`
for similar or better quality. Similarly, to `map`, the implementation
is independent of the underlying graph representation.
Additionally, `emap` supports "don't touch" white boxes (gates).

Command `emap` can return the mapped network in two formats.
Command `emap` returns a `cell_view<block_network>` that supports
multi-output cells. Command `emap_klut` returns a `binding_view<klut_network>`
similarly as command `map`.

The following example shows how to perform delay-oriented technology mapping
from an and-inverter graph using large cells up to 9 inputs:

.. code-block:: c++

aig_network aig = ...;

/* read cell library in genlib format */
std::vector<gate> gates;
std::ifstream in( ... );
lorina::read_genlib( in, genlib_reader( gates ) )
tech_library<9> tech_lib( gates );

/* perform technology mapping */
cell_view<block_network> res = emap<9>( aig, tech_lib );

The next example performs area-oriented graph mapping using multi-output cells:

.. code-block:: c++

aig_network aig = ...;

/* read cell library in genlib format */
std::vector<gate> gates;
std::ifstream in( ... );
lorina::read_genlib( in, genlib_reader( gates ) )
tech_library tech_lib( gates );

/* perform technology mapping */
emap_params ps;
ps.area_oriented_mapping = true;
ps.map_multioutput = true;
cell_view<block_network> res = emap( aig, tech_lib, ps );

In this case, `emap` is used to return a `block_network`, which can respresent multi-output
cells as single nodes. Alternatively, also `emap_klut` can be used but multi-output cells
would be reporesented by single-output nodes.

The maximum number of cuts stored for each node is limited to 20.
To increase this limit, change `max_cut_num` in `emap`.

You can set the inputs arrival time and output required times using the parameters `arrival_times`
and `required times`. Moreover, it is possible to ask for a required time relaxation. For instance,
if we want to map a network with an increase of 10% over its minimal delay, we can set
`relax_required` to 10.

For further details and usage scenarios of `emap`, such as white boxes, please check the
related tests.

**Parameters and statistics**

.. doxygenstruct:: mockturtle::emap_params
:members:

.. doxygenstruct:: mockturtle::emap_stats
:members:

**Algorithm**

.. doxygenfunction:: mockturtle::emap(Ntk const&, tech_library<NInputs, Configuration> const&, emap_params const&, emap_stats*)
.. doxygenfunction:: mockturtle::emap_klut(Ntk const&, tech_library<NInputs, Configuration> const&, emap_params const&, emap_stats*)
.. doxygenfunction:: mockturtle::emap_node_map(Ntk const&, tech_library<NInputs, Configuration> const&, emap_params const&, emap_stats*)
.. doxygenfunction:: mockturtle::emap_load_mapping(Ntk&)


Technology mapping and network conversion
-----------------------------------------

Expand Down Expand Up @@ -136,84 +220,4 @@ To increase this limit, change `max_cut_num` in `fast_network_cuts`.
**Algorithm**

.. doxygenfunction:: mockturtle::map(Ntk const&, tech_library<NInputs, Configuration> const&, map_params const&, map_stats*)
.. doxygenfunction:: mockturtle::map(Ntk&, exact_library<NtkDest, RewritingFn, NInputs> const&, map_params const&, map_stats*)



Extended technology mapping
---------------------------

**Header:** ``mockturtle/algorithms/emap.hpp``

The command `emap` stands for extended mapper. It supports large
library cells, of more than 6 inputs, and can perform matching using 3
different methods: Boolean, pattern, or hybrid. The current version
can map to 2-output gates, such as full adders and half adders,
and provides a 2x speedup in mapping time compared to command `map`
for similar or better quality. Similarly, to `map`, the implementation
is independent of the underlying graph representation.
Additionally, `emap` supports "don't touch" white boxes (gates).

Command `emap` can return the mapped network in two formats.
Command `emap` returns a `cell_view<block_network>` that supports
multi-output cells. Command `emap_klut` returns a `binding_view<klut_network>`
similarly as command `map`.

The following example shows how to perform delay-oriented technology mapping
from an and-inverter graph using large cells up to 9 inputs:

.. code-block:: c++

aig_network aig = ...;

/* read cell library in genlib format */
std::vector<gate> gates;
std::ifstream in( ... );
lorina::read_genlib( in, genlib_reader( gates ) )
tech_library<9> tech_lib( gates );

/* perform technology mapping */
cell_view<block_network> res = emap<9>( aig, tech_lib );

The next example performs area-oriented graph mapping using multi-output cells:

.. code-block:: c++

aig_network aig = ...;

/* read cell library in genlib format */
std::vector<gate> gates;
std::ifstream in( ... );
lorina::read_genlib( in, genlib_reader( gates ) )
tech_library tech_lib( gates );

/* perform technology mapping */
emap_params ps;
ps.area_oriented_mapping = true;
ps.map_multioutput = true;
cell_view<block_network> res = emap( aig, tech_lib, ps );

In this case, `emap` is used to return a `block_network`, which can respresent multi-output
cells as single nodes. Alternatively, also `emap_klut` can be used but multi-output cells
would be reporesented by single-output nodes.

The maximum number of cuts stored for each node is limited to 32.
To increase this limit, change `max_cut_num` in `emap`.

For further details and usage scenarios of `emap`, such as white boxes, please check the
related tests.

**Parameters and statistics**

.. doxygenstruct:: mockturtle::emap_params
:members:

.. doxygenstruct:: mockturtle::emap_stats
:members:

**Algorithm**

.. doxygenfunction:: mockturtle::emap(Ntk const&, tech_library<NInputs, Configuration> const&, emap_params const&, emap_stats*)
.. doxygenfunction:: mockturtle::emap_klut(Ntk const&, tech_library<NInputs, Configuration> const&, emap_params const&, emap_stats*)
.. doxygenfunction:: mockturtle::emap_node_map(Ntk const&, tech_library<NInputs, Configuration> const&, emap_params const&, emap_stats*)
.. doxygenfunction:: mockturtle::emap_load_mapping(Ntk&)
.. doxygenfunction:: mockturtle::map(Ntk&, exact_library<NtkDest, NInputs> const&, map_params const&, map_stats*)
2 changes: 2 additions & 0 deletions experiments/emap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ int main()
}

tech_library_params tps;
tps.ignore_symmetries = false; // set to true to drastically speed-up mapping with minor delay increase
tps.verbose = true;
tech_library<9> tech_lib( gates, tps );

Expand All @@ -91,6 +92,7 @@ int main()
ps.matching_mode = emap_params::hybrid;
ps.area_oriented_mapping = false;
ps.map_multioutput = true;
ps.relax_required = 0;
emap_stats st;
cell_view<block_network> res = emap<9>( aig, tech_lib, ps, &st );

Expand Down
Loading
Loading