Skip to content

Commit

Permalink
Fix travis and add network base_type (lsils#95)
Browse files Browse the repository at this point in the history
* Ignore files.

* Travis.

* Network base_type.

* Docs.
  • Loading branch information
msoeken authored Nov 28, 2018
1 parent 1b6f84d commit f25c34f
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
build/
build-*/
.vscode/
examples/

**/*~
**/.DS_Store

docs/_build
docs/doxyxml
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ matrix:
before_install:
- brew update
- brew install llvm
env: COMPILER=/usr/local/Cellar/llvm/7.0.0/bin/clang++
env: COMPILER=/usr/local/opt/llvm/bin/clang++
- os: osx
osx_image: xcode8.3
compiler: gcc
before_install:
- brew update
- brew install gcc
env: COMPILER=/usr/local/Cellar/gcc/8.2.0/bin/g++-8
env: COMPILER=/usr/local/opt/gcc/bin/g++-8
- os: osx
osx_image: xcode8.3
compiler: gcc
before_install:
- brew update
- brew install gcc@7
env: COMPILER=/usr/local/Cellar/gcc@7/7.3.0/bin/g++-7
env: COMPILER=/usr/local/opt/gcc@7/bin/g++-7
8 changes: 4 additions & 4 deletions docs/network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ This page describes the interface of a logic network data structure in
Mandatory types and constants
-----------------------------

The interaction with a logic network data structure is performed using three
types for which no application details are assumed. The following three types
The interaction with a logic network data structure is performed using four
types for which no application details are assumed. The following four types
must be defined within the network data structure. They can be implemented as
nested type, but may also be exposed as type alias.

.. doxygenclass:: mockturtle::network
:members: node, signal, storage
:members: base_type, node, signal, storage
:no-link:

Futher, a network must expose the following compile-time constants:
Further, a network must expose the following compile-time constants:

.. code-block:: c++

Expand Down
8 changes: 4 additions & 4 deletions docs/philosophy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ The *mockturtle* philosophy
The mockturtle philosophy is based on a principle of 4 layers that depend on
each other in a linear order as depicted in the figure on the right-hand side.
The fundament, depicted by the bottom layer, is provided by the :ref:`network`.
It defines naming conventions for types and methods for types and methods in
classes that implement network interfaces, some of which are mandatory while
others are optional. The network interface API does *not* provide any
implementations for a network though.
It defines naming conventions for types and methods in classes that implement
network interfaces, some of which are mandatory while others are optional. The
network interface API does *not* provide any implementations for a network
though.

Algorithms, the second layer, are implemented in terms of generic functions
that takes as input an instance of some hypothetical network type and require
Expand Down
8 changes: 8 additions & 0 deletions include/mockturtle/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ static_assert( false, "file interface.hpp cannot be included, it's only used for
class network final
{
public:
/*! \brief Type referring to itself.
*
* The ``base_type`` is the network type itself. It is required, because
* views may extend networks, and this type provides a way to determine the
* underlying network type.
*/
using base_type = network;

/*! \brief Type representing a node.
*
* A ``node`` is a node in the logic network. It could be a constant, a
Expand Down
1 change: 1 addition & 0 deletions include/mockturtle/networks/aig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class aig_network
static constexpr auto min_fanin_size = 2u;
static constexpr auto max_fanin_size = 2u;

using base_type = aig_network;
using storage = std::shared_ptr<aig_storage>;
using node = uint64_t;

Expand Down
1 change: 1 addition & 0 deletions include/mockturtle/networks/klut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class klut_network
static constexpr auto min_fanin_size = 1;
static constexpr auto max_fanin_size = 32;

using base_type = klut_network;
using storage = std::shared_ptr<klut_storage>;
using node = uint64_t;
using signal = uint64_t;
Expand Down
1 change: 1 addition & 0 deletions include/mockturtle/networks/mig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class mig_network
static constexpr auto min_fanin_size = 3u;
static constexpr auto max_fanin_size = 3u;

using base_type = mig_network;
using storage = std::shared_ptr<mig_storage>;
using node = uint64_t;

Expand Down
1 change: 1 addition & 0 deletions include/mockturtle/networks/xag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class xag_network
static constexpr auto min_fanin_size = 2u;
static constexpr auto max_fanin_size = 2u;

using base_type = xag_network;
using storage = std::shared_ptr<xag_storage>;
using node = uint64_t;

Expand Down
1 change: 1 addition & 0 deletions include/mockturtle/networks/xmg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class xmg_network
static constexpr auto min_fanin_size = 3u;
static constexpr auto max_fanin_size = 3u;

using base_type = xmg_network;
using storage = std::shared_ptr<xmg_storage>;
using node = std::size_t;

Expand Down
3 changes: 2 additions & 1 deletion include/mockturtle/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ struct is_network_type : std::false_type
template<class Ntk>
struct is_network_type<Ntk, std::enable_if_t<
std::is_constructible_v<signal<Ntk>, node<Ntk>>,
std::void_t<signal<Ntk>,
std::void_t<typename Ntk::base_type,
signal<Ntk>,
node<Ntk>,
typename Ntk::storage,
decltype( Ntk::max_fanin_size ),
Expand Down
1 change: 1 addition & 0 deletions test/test_networks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace mockturtle
class dummy_network
{
public:
using base_type = dummy_network;
using node = uint32_t;
using signal = uint32_t;
using storage = uint64_t;
Expand Down

0 comments on commit f25c34f

Please sign in to comment.