Classes | Typedefs | Enumerations | Functions
revkit Namespace Reference

Main namespace. More...

Classes

class  standard_circuit
 Represents a circuit. More...
 
class  subcircuit
 Represents a sub-circuit. More...
 
class  circuit
 Main circuit class. More...
 
class  active_controls
 Slot for adding control lines automatically. More...
 
class  target_line_adder
 Helper class for adding lines in an easier way. More...
 
class  control_line_adder
 Helper class for adding lines in an easier way. More...
 
class  constructible_tree
 This class represents a tree based on a Boost.Graph. More...
 
struct  copy_metadata_settings
 Settings for copy_metadata. More...
 
class  functor
 Functor class for interfacing algorithms. More...
 
class  gate
 Represents a gate in a circuit. More...
 
class  filtered_gate
 Wrapper for a gate to filter some lines. More...
 
class  create_image_settings
 Generic class for the create_image function (Template Design Pattern) More...
 
class  create_pstricks_settings
 Implementation of create_image_settings for generating LaTeX code using PsTricks. More...
 
class  create_tikz_settings
 Implementation of create_image_settings for generating LaTeX code using TikZ. More...
 
struct  print_circuit_settings
 Settings for print_circuit function. More...
 
struct  print_statistics_settings
 Settings for print_statistics. More...
 
struct  read_pla_settings
 Settings for read_pla function. More...
 
class  BDDTable
 Contains the result data for read_pla_to_bdd. More...
 
class  circuit_processor
 Implementation of revlib_processor to construct a circuit. More...
 
class  specification_processor
 Implementation of revlib_processor to construct a reversible_truth_table. More...
 
class  revlib_processor
 Base class for actions on the revlib_parser. More...
 
struct  write_blif_settings
 Settings for write_blif. More...
 
struct  write_realization_settings
 Settings for write_realization function. More...
 
struct  write_specification_settings
 Settings for write_specification. More...
 
struct  write_verilog_settings
 Settings for write_verilog. More...
 
class  bus_collection
 Collection for buses. More...
 
class  pattern
 Pattern file for sequential simulation. More...
 
struct  properties
 Property Map for storing settings and statistical information. More...
 
struct  toffoli_tag
 Target Tag for Toffoli gates. More...
 
struct  fredkin_tag
 Target Tag for Fredkin gates. More...
 
struct  peres_tag
 Target Tag for Peres gates. More...
 
struct  v_tag
 Target Tag for V gates. More...
 
struct  vplus_tag
 Target Tag for V+ gates. More...
 
struct  module_tag
 Target Tag for Modules. More...
 
class  truth_table
 Represents a truth table. More...
 
struct  gate_costs
 Calculates the gate costs. More...
 
struct  line_costs
 Calculates the line costs. More...
 
struct  quantum_costs
 Calculates the quantum costs. More...
 
struct  transistor_costs
 Calculates the transistor costs. More...
 
class  program_options
 Class for program options on top of the Boost.Program_Options library. More...
 
struct  print_timer
 Functor for the timer class which prints the run-time to an output stream. More...
 
struct  reference_timer
 Functor for the timer class which assigns the run-time to a given variable. More...
 
struct  properties_timer
 Functor for the timer class which assigns the run-time to a property map. More...
 
struct  measure_method
 Measure Method for timer. More...
 
class  timer
 A generic timer class. More...
 
struct  embed_and_synthesize
 Concrete re-synthesis functor for the revkit::line_reduction algorithm. More...
 
struct  shift_window_selection
 Window Selection functor based on Shift Window Selection. More...
 
struct  line_window_selection
 Window Selection functor based on Line Window Selection. More...
 
struct  resynthesis_optimization
 Re-synthesis optimization (Wrapper for window_optimization) More...
 
struct  core_gate_simulation
 A gate simulation implementation of gate_simulation_func. More...
 
struct  weighted_reordering
 Cubes reordering strategy as proposed in [FTR07]. More...
 
struct  standard_decomposition
 Default gate-wise decomposition. More...
 

Typedefs

typedef boost::optional< bool > constant
 Type for determine whether line is constant or not. More...
 
typedef boost::variant
< standard_circuit, subcircuit
circuit_variant
 Generic circuit. More...
 
typedef boost::adjacency_list
< boost::vecS, boost::vecS,
boost::bidirectionalS,
boost::property
< boost::vertex_name_t,
boost::tuple< std::string,
const circuit * > > > 
hierarchy_graph
 Hierarchy Graph. More...
 
typedef constructible_tree
< hierarchy_graph
hierarchy_tree
 Hierarchy Tree. More...
 
typedef truth_table
< boost::optional< bool > > 
binary_truth_table
 A predefined truth table for specifications using binary values as in specifications for reversible circuits. More...
 
typedef unsigned long long cost_t
 Type for costs. More...
 
typedef boost::function
< cost_t(const circuit &circ)> 
costs_by_circuit_func
 Functor for cost function measured by the whole circuit. More...
 
typedef boost::function
< cost_t(const gate &gate,
unsigned lines)> 
costs_by_gate_func
 Functor for cost function measured by each gate. More...
 
typedef boost::variant
< costs_by_circuit_func,
costs_by_gate_func
cost_function
 Cost Function type. More...
 
typedef boost::function< bool(circuit
&, binary_truth_table &, const
std::vector< unsigned > &order)> 
window_synthesis_func
 Functor for re-synthesis in the revkit::line_reduction algorithm. More...
 
typedef functor< bool(circuit
&, const circuit &)> 
optimization_func
 Optimization functor. More...
 
typedef boost::function
< circuit(const circuit &)> 
select_window_func
 Functor for selecting the windows. More...
 
typedef boost::function
< boost::dynamic_bitset<>const
std::map< std::string,
boost::dynamic_bitset
<> > &, const
boost::dynamic_bitset<> &)> 
sequential_step_result_func
 Functor which is called after a circuit is simulated combinationally. More...
 
typedef boost::function
< boost::dynamic_bitset
<> &(const gate
&, boost::dynamic_bitset<> &)> 
gate_simulation_func
 Functor for gate-wise simulation, used as a setting for simple_simulation. More...
 
typedef boost::function< void(const
gate &, const
boost::dynamic_bitset<> &)> 
step_result_func
 Functor which is called after a step result is calculated. More...
 
typedef functor< bool(boost::dynamic_bitset
<> &, const circuit &, const
boost::dynamic_bitset<> &)> 
simulation_func
 Simulation functor. More...
 
typedef functor< bool(std::vector
< boost::dynamic_bitset
<> > &, const circuit &, const
std::vector
< boost::dynamic_bitset<> > &)> 
multi_step_simulation_func
 Multi step simulation functor. More...
 
typedef boost::function< void(std::vector
< std::pair
< binary_truth_table::cube_type,
binary_truth_table::cube_type > > &)> 
cube_reordering_func
 Functor for cubes reordering in ESOP based synthesis. More...
 
typedef boost::function< void(circuit
&, const gate &)> 
gate_decomposition_func
 Functor for the gate-wise decomposition. More...
 
typedef boost::function< void()> swop_step_func
 Functor which can be called after each SWOP iteration. More...
 
typedef functor< bool(circuit
&, const binary_truth_table &)> 
truth_table_synthesis_func
 Functor for synthesis based on a truth table. More...
 
typedef functor< bool(circuit
&, const std::string &)> 
pla_blif_synthesis_func
 Functor for synthesis based on a file-name (PLA or BLIF) More...
 
typedef functor< bool(binary_truth_table
&, const binary_truth_table &)> 
embedding_func
 Functor for embedding a binary truth table in place. More...
 
typedef functor< bool(circuit
&, const circuit &)> 
decomposition_func
 Functor for decomposing a reversible circuit into a quantum circuit. More...
 
typedef std::vector< std::pair
< boost::dynamic_bitset
<>, boost::dynamic_bitset<> > > 
counterexample
 Datastructure for counterexamples. More...
 
typedef functor< bool(circuit
const &, circuit const &impl)> 
equivalence_func
 Functor for equivalence checker functions. More...
 

Enumerations

enum  { kfdd_synthesis_dtl_shannon, kfdd_synthesis_dtl_positive_davio, kfdd_synthesis_dtl_negative_davio }
 Flags for default KFDD decomposition in kfdd_synthesis_settings. More...
 
enum  {
  kfdd_synthesis_reordering_none, kfdd_synthesis_reordering_exact_dtl_friedman, kfdd_synthesis_reordering_exact_dtl_permutation, kfdd_synthesis_reordering_dtl_sifting,
  kfdd_synthesis_reordering_exact_friedman, kfdd_synthesis_reordering_exact_permutation, kfdd_synthesis_reordering_sifting, kfdd_synthesis_reordering_sifting_and_dtl_sifting,
  kfdd_synthesis_reordering_inverse
}
 Flags for KFDD Reordering strategies in kfdd_synthesis_settings. More...
 
enum  { kfdd_synthesis_growth_limit_relative = 'r', kfdd_synthesis_growth_limit_absolute = 'a' }
 Flags for the growth limit in kfdd_synthesis_settings. More...
 
enum  {
  kfdd_synthesis_sifting_method_random = 'r', kfdd_synthesis_sifting_method_initial = 'i', kfdd_synthesis_sifting_method_greatest = 'g', kfdd_synthesis_sifting_method_loser_first = 'l',
  kfdd_synthesis_sifting_method_verify = 'v'
}
 Flags for the sifting method. More...
 

Functions

void append_circuit (circuit &circ, const circuit &src, const gate::line_container &controls=gate::line_container())
 Insert a circuit src at the end of another circuit circ. More...
 
void prepend_circuit (circuit &circ, const circuit &src, const gate::line_container &controls=gate::line_container())
 Insert a circuit src at the beginning of another circuit circ. More...
 
void insert_circuit (circuit &circ, unsigned pos, const circuit &src, const gate::line_container &controls=gate::line_container())
 Insert a circuit src before gate pos (counting from 0) of another circuit circ. More...
 
gateappend_toffoli (circuit &circ, const gate::line_container &controls, const gate::line &target)
 Helper function for appending a Toffoli gate. More...
 
gateappend_fredkin (circuit &circ, const gate::line_container &controls, const gate::line &target1, const gate::line &target2)
 Helper function for appending a Fredkin gate. More...
 
gateappend_peres (circuit &circ, const gate::line &control, const gate::line &target1, const gate::line &target2)
 Helper function for appending a Peres gate. More...
 
gateappend_cnot (circuit &circ, const gate::line &control, const gate::line &target)
 Helper function for appending a CNOT gate. More...
 
gateappend_v (circuit &circ, const gate::line &control, const gate::line &target)
 Helper function for appending a V gate. More...
 
gateappend_vplus (circuit &circ, const gate::line &control, const gate::line &target)
 Helper function for appending a V+ gate. More...
 
gateappend_not (circuit &circ, const gate::line &target)
 Helper function for appending a NOT gate. More...
 
gateappend_module (circuit &circ, const std::string &module_name, const gate::line_container &controls, const std::vector< unsigned > &targets)
 Helper function for appending a module gate. More...
 
control_line_adder append_gate (circuit &circ, const boost::any &tag)
 Helper function for appending a generic gate using the control_line_adder. More...
 
control_line_adder append_toffoli (circuit &circ)
 Helper function for appending a Toffoli gate using the control_line_adder. More...
 
control_line_adder append_fredkin (circuit &circ)
 Helper function for appending a Fredkin gate using the control_line_adder. More...
 
gateprepend_toffoli (circuit &circ, const gate::line_container &controls, const gate::line &target)
 Helper function for prepending a Toffoli gate. More...
 
gateprepend_fredkin (circuit &circ, const gate::line_container &controls, const gate::line &target1, const gate::line &target2)
 Helper function for prepending a Fredkin gate. More...
 
gateprepend_peres (circuit &circ, const gate::line &control, const gate::line &target1, const gate::line &target2)
 Helper function for prepending a Peres gate. More...
 
gateprepend_cnot (circuit &circ, const gate::line &control, const gate::line &target)
 Helper function for prepending a CNOT gate. More...
 
gateprepend_v (circuit &circ, const gate::line &control, const gate::line &target)
 Helper function for prepending a V gate. More...
 
gateprepend_vplus (circuit &circ, const gate::line &control, const gate::line &target)
 Helper function for prepending a V+ gate. More...
 
gateprepend_not (circuit &circ, const gate::line &target)
 Helper function for prepending a NOT gate. More...
 
gateprepend_module (circuit &circ, const std::string &module_name, const gate::line_container &controls, const std::vector< unsigned > &targets)
 Helper function for prepending a module gate. More...
 
control_line_adder prepend_gate (circuit &circ, const boost::any &tag)
 Helper function for prepending a generic gate using the control_line_adder. More...
 
control_line_adder prepend_toffoli (circuit &circ)
 Helper function for prepending a Toffoli gate using the control_line_adder. More...
 
control_line_adder prepend_fredkin (circuit &circ)
 Helper function for prepending a Fredkin gate using the control_line_adder. More...
 
gateinsert_toffoli (circuit &circ, unsigned n, const gate::line_container &controls, const gate::line &target)
 Helper function for inserting a Toffoli gate. More...
 
gateinsert_fredkin (circuit &circ, unsigned n, const gate::line_container &controls, const gate::line &target1, const gate::line &target2)
 Helper function for inserting a Fredkin gate. More...
 
gateinsert_peres (circuit &circ, unsigned n, const gate::line &control, const gate::line &target1, const gate::line &target2)
 Helper function for inserting a Peres gate. More...
 
gateinsert_cnot (circuit &circ, unsigned n, const gate::line &control, const gate::line &target)
 Helper function for inserting a CNOT gate. More...
 
gateinsert_v (circuit &circ, unsigned n, const gate::line &control, const gate::line &target)
 Helper function for inserting a V gate. More...
 
gateinsert_vplus (circuit &circ, unsigned n, const gate::line &control, const gate::line &target)
 Helper function for inserting a V+ gate. More...
 
gateinsert_not (circuit &circ, unsigned n, const gate::line &target)
 Helper function for inserting a NOT gate. More...
 
gateinsert_module (circuit &circ, unsigned n, const std::string &module_name, const gate::line_container &controls, const std::vector< unsigned > &targets)
 Helper function for inserting a module gate. More...
 
control_line_adder insert_gate (circuit &circ, unsigned n, const boost::any &tag)
 Helper function for inserting a generic gate using the control_line_adder. More...
 
control_line_adder insert_toffoli (circuit &circ, unsigned n)
 Helper function for inserting a Toffoli gate using the control_line_adder. More...
 
control_line_adder insert_fredkin (circuit &circ, unsigned n)
 Helper function for inserting a Fredkin gate using the control_line_adder. More...
 
unsigned add_line_to_circuit (circuit &circ, const std::string &input, const std::string &output, const constant &c=constant(), bool g=false)
 Add a line to a circuit with specifying all meta-data. More...
 
void circuit_hierarchy (const circuit &circ, hierarchy_tree &tree)
 Calculates the hierarchy of a circuit by its modules. More...
 
bool circuit_to_truth_table (const circuit &circ, binary_truth_table &spec, const functor< bool(boost::dynamic_bitset<> &, const circuit &, const boost::dynamic_bitset<> &)> &simulation)
 Generates a truth table from a circuit. More...
 
void clear_circuit (circuit &circ)
 Clears the circuit circ. More...
 
template<typename Iterator >
Iterator control_lines (const gate &g, Iterator result)
 Gets the control lines of a gate. More...
 
void copy_circuit (const circuit &src, circuit &dest)
 Copies a circuit with all meta information. More...
 
template<typename T >
void copy_metadata (const truth_table< T > &spec, circuit &circ)
 Copies meta-data from a specification to a circuit. More...
 
void copy_metadata (const circuit &base, circuit &circ, const copy_metadata_settings &settings=copy_metadata_settings())
 Copies meta-data from a circuit to another circuit. More...
 
bool create_simulation_pattern (const pattern &p, const circuit &circ, std::vector< boost::dynamic_bitset<> > &sim, std::map< std::string, boost::dynamic_bitset<> > &init, std::string *error=0)
 Create simulation pattern for sequential simulation. More...
 
bool expand_circuit (const circuit &base, circuit &circ, unsigned num_lines, const std::vector< unsigned > &filter)
 Expands a circuit. More...
 
bool expand_circuit (const circuit &base, circuit &circ)
 Expands a circuit. More...
 
void extend_truth_table (binary_truth_table &spec)
 Removes the Don't Care Values of a binary truth table. More...
 
template<typename Iterator >
Iterator find_non_empty_lines (const gate &src, Iterator result)
 Finds non empty lines in a gate. More...
 
template<typename GateIterator , typename Iterator >
Iterator find_non_empty_lines (GateIterator first, GateIterator last, Iterator result)
 Finds non empty lines in a range of gates. More...
 
template<typename Iterator >
Iterator find_non_empty_lines (const circuit &circ, Iterator result)
 Finds non empty lines in a circuit. More...
 
template<typename Iterator >
Iterator find_empty_lines (const gate &src, unsigned line_size, Iterator result)
 Finds empty lines in a gate. More...
 
void find_empty_lines (const gate &src, unsigned line_size, gate::line_container &lines)
 Finds empty lines in a gate. More...
 
template<typename GateIterator , typename Iterator >
Iterator find_empty_lines (GateIterator first, GateIterator last, unsigned line_size, Iterator result)
 Finds empty lines in a range of gates. More...
 
template<typename Iterator >
Iterator find_empty_lines (const circuit &circ, Iterator result)
 Finds empty lines in a circuit. More...
 
void flatten_circuit (const circuit &base, circuit &circ, bool keep_meta_data=false)
 Flattens a circuit with modules. More...
 
template<typename T >
bool fully_specified (const truth_table< T > &tt, const typename truth_table< T >::value_type &dc_value, bool is_reversible=true)
 Returns whether a truth table is fully specified. More...
 
bool fully_specified (const binary_truth_table &tt, bool is_reversible=true)
 Returns whether a truth table is fully specified. More...
 
void reverse_circuit (const circuit &src, circuit &dest)
 Reverse a circuit. More...
 
void reverse_circuit (circuit &circ)
 Reverse a circuit in-place. More...
 
template<typename Iterator >
Iterator target_lines (const gate &g, Iterator result)
 Gets the target lines of a gate. More...
 
bool transposition_to_circuit (circuit &circ, const boost::dynamic_bitset<> &inputs, const boost::dynamic_bitset<> &outputs)
 Creates a circuit realization for a transposition. More...
 
void create_image (std::ostream &os, const circuit &circ, create_image_settings &settings)
 Create image from circuit circ and write it to os. More...
 
void create_image (const std::string &filename, const circuit &circ, create_image_settings &settings)
 Wrapper for create_image to save to a file. More...
 
void print_circuit (const circuit &circ, const print_circuit_settings &settings=print_circuit_settings())
 Prints a circuit as ASCII. More...
 
std::ostream & operator<< (std::ostream &os, const circuit &circ)
 Wrapper for using with the output stream operator. More...
 
void print_statistics (std::ostream &os, const circuit &circ, double runtime=-1.0, const print_statistics_settings &settings=print_statistics_settings())
 Print statistics about a circuit to an arbitrary output stream. More...
 
void print_statistics (const circuit &circ, double runtime=-1.0, const print_statistics_settings &settings=print_statistics_settings())
 Print statistics about a circuit to standard output. More...
 
bool read_pattern (pattern &p, const std::string &filename, std::string *error=0)
 I/O routine for reading a pattern (*.sim) file. More...
 
bool read_pla (binary_truth_table &spec, const std::string &filename, const read_pla_settings &settings=read_pla_settings(), std::string *error=0)
 Reads a specification from a PLA file. More...
 
bool read_pla_to_bdd (BDDTable &bdd, const std::string &filename)
 Reads a BDD from a PLA file. More...
 
bool read_realization (circuit &circ, std::istream &in, std::string *error=0)
 Read a circuit realization into a circuit from stream. More...
 
bool read_realization (circuit &circ, const std::string &filename, std::string *error=0)
 Read a circuit realization into a circuit from filename. More...
 
bool read_specification (binary_truth_table &spec, std::istream &in, std::string *error=0)
 Read a specification into a truth table from stream. More...
 
bool read_specification (binary_truth_table &spec, const std::string &filename, std::string *error=0)
 Read a specification into a truth table from filename. More...
 
bool revlib_parser (std::istream &in, revlib_processor &reader, const std::string &base_directory=std::string("."), std::string *error=0)
 A parser for the RevLib file format. More...
 
void write_blif (const circuit &circ, std::ostream &os=std::cout, const write_blif_settings &settings=write_blif_settings())
 Writes a circuit to a BLIF file. More...
 
void write_realization (const circuit &circ, std::ostream &os, const write_realization_settings &settings=write_realization_settings())
 Writes a circuit as RevLib realization to an output stream. More...
 
bool write_realization (const circuit &circ, const std::string &filename, const write_realization_settings &settings=write_realization_settings(), std::string *error=0)
 Writes a circuit as RevLib realization to a file. More...
 
bool write_specification (const binary_truth_table &spec, const std::string &filename, const write_specification_settings &settings=write_specification_settings())
 Writes a truth table to a RevLib specification file. More...
 
void write_verilog (const circuit &circ, std::ostream &os=std::cout, const write_verilog_settings &settings=write_verilog_settings())
 Writes a circuit to a Verilog file. More...
 
template<typename T >
get (const properties::ptr &settings, const properties::key_type &k, const T &default_value)
 A helper method to access the get method on a properties smart pointer. More...
 
void set_error_message (properties::ptr statistics, const std::string &error)
 Sets an error message to a statistics smart pointer. More...
 
template<typename T >
bool is_type (const boost::any &operand)
 Compares type of a boost::any variable. More...
 
bool same_type (const gate &g1, const gate &g2)
 Checks if two gates have the same type. More...
 
bool is_toffoli (const gate &g)
 Returns whether a gate is a Toffoli gate. More...
 
bool is_fredkin (const gate &g)
 Returns whether a gate is a Fredkin gate. More...
 
bool is_peres (const gate &g)
 Returns whether a gate is a Peres gate. More...
 
bool is_v (const gate &g)
 Returns whether a gate is a V gate. More...
 
bool is_vplus (const gate &g)
 Returns whether a gate is a V+ gate. More...
 
bool is_module (const gate &g)
 Returns whether a gate is a module. More...
 
std::ostream & operator<< (std::ostream &os, const binary_truth_table &spec)
 Outputs a truth table. More...
 
unsigned truth_table_cube_to_number (const binary_truth_table::cube_type &cube)
 Converts a truth table cube to a number. More...
 
binary_truth_table::cube_type number_to_truth_table_cube (unsigned number, unsigned bw)
 Converts a number to a cube of a fixed bitwidth. More...
 
cost_t costs (const circuit &circ, const cost_function &f)
 Calculates the costs of a circuit by a given cost function. More...
 
const char * revkit_version ()
 Returns RevKit version. More...
 
bool adding_lines (circuit &circ, const circuit &base, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Adding Lines Optimization. More...
 
optimization_func adding_lines_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the adding_lines algorithm. More...
 
bool line_reduction (circuit &circ, const circuit &base, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Line Reduction Optimization. More...
 
optimization_func line_reduction_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the line_reduction algorithm. More...
 
bool lnn_optimization (circuit &circ, const circuit &base, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Linear nearest Neighbor. More...
 
optimization_func lnn_optimization_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the lnn_optimization algorithm. More...
 
bool window_optimization (circuit &circ, const circuit &base, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Window Optimization. More...
 
optimization_func window_optimization_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the window_optimization algorithm. More...
 
bool partial_simulation (boost::dynamic_bitset<> &output, const circuit &circ, const boost::dynamic_bitset<> &input, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Simulation considering constant inputs and garbage outputs. More...
 
simulation_func partial_simulation_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the partial_simulation algorithm. More...
 
bool sequential_simulation (std::vector< boost::dynamic_bitset<> > &outputs, const circuit &circ, const std::vector< boost::dynamic_bitset<> > &inputs, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Sequential Simulation considering state inputs. More...
 
multi_step_simulation_func sequential_simulation_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the sequential_simulation algorithm. More...
 
bool simple_simulation (boost::dynamic_bitset<> &output, const gate &g, const boost::dynamic_bitset<> &input, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Simple Simulation function for a single gate. More...
 
bool simple_simulation (boost::dynamic_bitset<> &output, circuit::const_iterator first, circuit::const_iterator last, const boost::dynamic_bitset<> &input, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Simple Simulation function for a range of gates. More...
 
bool simple_simulation (boost::dynamic_bitset<> &output, const circuit &circ, const boost::dynamic_bitset<> &input, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Simple Simulation function for a circuit. More...
 
simulation_func simple_simulation_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the simple_simulation algorithm. More...
 
bool bdd_synthesis (circuit &circ, const std::string &filename, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 BDD based synthesis approach. More...
 
pla_blif_synthesis_func bdd_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the bdd_synthesis_func algorithm. More...
 
bool embed_truth_table (binary_truth_table &spec, const binary_truth_table &base, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Embedding of an irreversible specification. More...
 
embedding_func embed_truth_table_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the embed_truth_table algorithm. More...
 
void no_reordering (std::vector< std::pair< binary_truth_table::cube_type, binary_truth_table::cube_type > > &cubes)
 Empty functor for cube_reordering_func. More...
 
bool esop_synthesis (circuit &circ, const std::string &filename, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 ESOP Based Synthesis. More...
 
pla_blif_synthesis_func esop_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the esop_synthesis algorithm. More...
 
bool exact_synthesis (circuit &circ, const binary_truth_table &spec, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Synthesizes a minimal circuit (with respect to the number of gates) using the SAT-based exact synthesis approach as presented in [GWDD09]. More...
 
truth_table_synthesis_func exact_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the exact_synthesis algorithm. More...
 
bool kfdd_synthesis (circuit &circ, const std::string &filename, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 KFDD Based Synthesis. More...
 
pla_blif_synthesis_func kfdd_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the kfdd_synthesis_func algorithm. More...
 
bool quantum_decomposition (circuit &circ, const circuit &base, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Quantum Decomposition of Reversible Circuits. More...
 
decomposition_func quantum_decomposition_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the quantum_decomposition algorithm. More...
 
bool reed_muller_synthesis (circuit &circ, const binary_truth_table &spec, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Synthesis algorithm based on Reed Muller Spectra. More...
 
truth_table_synthesis_func reed_muller_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the reed_muller_synthesis algorithm. More...
 
bool swop (circuit &circ, const binary_truth_table &spec, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 SWOP Synthesis Approach. More...
 
truth_table_synthesis_func swop_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the swop algorithm. More...
 
bool transformation_based_synthesis (circuit &circ, const binary_truth_table &spec, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Synthesizes a circuit using the Transformation Based approach. More...
 
truth_table_synthesis_func transformation_based_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the transformation_based_synthesis algorithm. More...
 
bool transposition_based_synthesis (circuit &circ, const binary_truth_table &spec, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 A simple synthesis algorithm based on transpositions. More...
 
truth_table_synthesis_func transposition_based_synthesis_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the transposition_based_synthesis algorithm. More...
 
bool equivalence_check (const circuit &spec, const circuit &impl, properties::ptr settings=properties::ptr(), properties::ptr statistics=properties::ptr())
 Functional and formal equivalence check. More...
 
equivalence_func equivalence_check_func (properties::ptr settings=properties::ptr(new properties()), properties::ptr statistics=properties::ptr(new properties()))
 Functor for the equivalence_check algorithm. More...
 

Detailed Description

Main namespace.

Typedef Documentation

typedef truth_table<boost::optional<bool> > binary_truth_table

A predefined truth table for specifications using binary values as in specifications for reversible circuits.

As template type boost::optional<bool> is used, which represents 0, 1, and a don't care value.

  • Description Char representation Typed value
    No constant input line '-'
    boost::optional<bool>()
    Constant input line with value 0 '0'
    boost::optional<bool>( 0 )
    Constant input line with value 1 '1'
    boost::optional<bool>( 1 )
typedef boost::variant<standard_circuit, subcircuit> circuit_variant

Generic circuit.

This circuit can be both standard_circuit or a subcircuit. In the default case it is considered as standard_circuit with no lines.

In the following examples are given how to construct different types of circuits.

Empty circuit with no lines

circuit circ;

Empty circuit with 3 lines

circuit circ( 3 );

Sub-circuit from circ including gates [2,4)

subcircuit subcirc( circ, 2, 4 );
Author
RevKit
Since
1.0
typedef boost::optional<bool> constant

Type for determine whether line is constant or not.

The following table summarizes the use of constant values in circuit representations.

Description Char representation Typed value
No constant input line '-'
Constant input line with value 0 '0'
constant( 0 )
Constant input line with value 1 '1'
constant( 1 )

Example

This example demonstrates how to access the constant values.

constant c = // some constant
if ( c ) // checks whether c is set or not
{
if ( *c ) // c is checked, checks the value of c
{
std::cout << "constant value 1" << std::endl;
}
else
{
std::cout << "constant value 0" << std::endl;
}
}
else
{
std::cout << "no constant value" << std::endl;
}
Author
RevKit
Since
1.0

Cost Function type.

It can either be a costs_by_circuit_func or a costs_by_gate_func

Author
RevKit
Since
1.0
typedef unsigned long long cost_t

Type for costs.

Costs is an unsigned long long, that is usually at least a 64-bit integer, but depending on the platform.

Author
RevKit
Since
1.2
typedef boost::function<cost_t( const circuit& circ )> costs_by_circuit_func

Functor for cost function measured by the whole circuit.

Author
RevKit
Since
1.0
typedef boost::function<cost_t( const gate& gate, unsigned lines )> costs_by_gate_func

Functor for cost function measured by each gate.

Author
RevKit
Since
1.0
typedef std::vector< std::pair < boost::dynamic_bitset<>, boost::dynamic_bitset<> > > counterexample

Datastructure for counterexamples.

Author
RevKit
Since
1.0
typedef boost::function<void(std::vector<std::pair<binary_truth_table::cube_type, binary_truth_table::cube_type> >&)> cube_reordering_func

Functor for cubes reordering in ESOP based synthesis.

This functor reorders the cubes in place and gets as single parameter a mutable vector of pairs, which contains input (first) and output cubes (second).

Author
RevKit
Since
1.0
typedef functor<bool(circuit&, const circuit&)> decomposition_func

Functor for decomposing a reversible circuit into a quantum circuit.

Author
RevKit
Since
1.0

Functor for embedding a binary truth table in place.

Author
RevKit
Since
1.0
typedef functor<bool (circuit const&, circuit const& impl)> equivalence_func

Functor for equivalence checker functions.

Author
RevKit
Since
1.0
typedef boost::function<void(circuit&, const gate&)> gate_decomposition_func

Functor for the gate-wise decomposition.

The quantum_decomposition algorithm has a setting to specify the gate-wise decomposition. Per default, this is standard_decomposition.

Author
RevKit
Since
1.0
typedef boost::function<boost::dynamic_bitset<>&( const gate&, boost::dynamic_bitset<>& )> gate_simulation_func

Functor for gate-wise simulation, used as a setting for simple_simulation.

For more information, see the concrete implementation core_gate_simulation

Author
RevKit
Since
1.0
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_name_t, boost::tuple<std::string, const circuit*> > > hierarchy_graph

Hierarchy Graph.

Graph concept class for holding a hierarchy graph which is encapsulated inside a tree with hierarchy_tree. For each node it holds the name and the reference of the module inside a tuple stored in the vertex_name property.

For further information on how to process graphs and trees, please refer to the Boost Graph Libary.

Author
RevKit
Since
1.1

Hierarchy Tree.

This tree is used to store the hierarchy of a tree. It is based on the hierarchy_graph

Author
RevKit
Since
1.1
typedef functor<bool(std::vector<boost::dynamic_bitset<> >&, const circuit&, const std::vector<boost::dynamic_bitset<> >& )> multi_step_simulation_func

Multi step simulation functor.

Author
RevKit
Since
1.2
typedef functor<bool(circuit&, const circuit&)> optimization_func

Optimization functor.

Author
RevKit
Since
1.0
typedef functor<bool(circuit&, const std::string&)> pla_blif_synthesis_func

Functor for synthesis based on a file-name (PLA or BLIF)

Author
RevKit
Since
1.0
typedef boost::function<circuit(const circuit&)> select_window_func

Functor for selecting the windows.

The selection of the windows can be defined by functors. Two are already implemented, namely the Line Window Selection and the Shift Window Selection.

Example: How to assign a window selection method

sws.window_length = 5;
sws.offset = 4;
settings->set( "select_window", sws );
// or for line window selection without specifying a parameter
settings->set( "select_window", revkit::line_window_selection() );

Example: How to create a new window selection functor

New window selection functors can be easily defined by creating a struct with the operator() method having the signature as follows in this example. In this example the first half of the circuit is chosen as a window. In the implementation of window_optimization, this functor is called iteratively until an empty circuit is returned. Thus, the done flag is set to true after the first call and the functor returns the empty circuit in the second call.

struct whole_circuit_selection
{
whole_circuit_selection() : done( false ) {}
revkit::circuit operator()( const revkit::circuit& base )
{
if ( done ) return revkit::circuit();
done = true;
return revkit::subcircuit( base, 0u, base.num_gates() / 2 );
}
private:
bool done;
};
Author
RevKit
Since
1.0
typedef boost::function<boost::dynamic_bitset<>const std::map<std::string, boost::dynamic_bitset<> >&, const boost::dynamic_bitset<>&)> sequential_step_result_func

Functor which is called after a circuit is simulated combinationally.

If set, this functor is called in sequential_simulation after every circuit simulation with a mapping of the state signals and the current output pattern as parameter.

Author
RevKit
Since
1.2
typedef functor<bool(boost::dynamic_bitset<>&, const circuit&, const boost::dynamic_bitset<>&)> simulation_func

Simulation functor.

Author
RevKit
Since
1.0
typedef boost::function<void(const gate&, const boost::dynamic_bitset<>&)> step_result_func

Functor which is called after a step result is calculated.

If set, this functor is called in simple_simulation after every gate simulation with the current gate and the calculated output pattern as parameter.

Author
RevKit
Since
1.0
typedef boost::function<void()> swop_step_func

Functor which can be called after each SWOP iteration.

This functor is used for the stepfunc setting in the swop synthesis algorithm. It takes no arguments and returns no value.

Author
RevKit
Since
1.0

Functor for synthesis based on a truth table.

Author
RevKit
Since
1.0
typedef boost::function<bool(circuit&, binary_truth_table&, const std::vector<unsigned>& order)> window_synthesis_func

Functor for re-synthesis in the revkit::line_reduction algorithm.

This functor needs in addition to the truth_table_synthesis_func functor an output order. This output order can be passed to the embedding algorithm.

Author
RevKit
Since
1.0

Enumeration Type Documentation

anonymous enum

Flags for default KFDD decomposition in kfdd_synthesis_settings.

The default decomposition type is especially important when no DTL reordering strategy is used.

Author
RevKit
Since
1.0
Enumerator
kfdd_synthesis_dtl_shannon 

Use Shannon as default.

kfdd_synthesis_dtl_positive_davio 

Use positive Davio as default.

kfdd_synthesis_dtl_negative_davio 

Use negative Davio as default.

anonymous enum

Flags for KFDD Reordering strategies in kfdd_synthesis_settings.

Author
RevKit
Since
1.0
Enumerator
kfdd_synthesis_reordering_none 

No reordering.

kfdd_synthesis_reordering_exact_dtl_friedman 

Exact DTL and variable re-ordering according to an algorithm introduced by Friedman.

kfdd_synthesis_reordering_exact_dtl_permutation 

Exact DTL and variable re-ordering by permutation.

kfdd_synthesis_reordering_dtl_sifting 

Heuristic DTL and variable re-ordering by sifting.

kfdd_synthesis_reordering_exact_friedman 

Exact variable re-ordering according to an algorithm introduced by Friedman.

kfdd_synthesis_reordering_exact_permutation 

Exact variable re-ordering by permutation.

kfdd_synthesis_reordering_sifting 

Heuristic variable re-ordering by sifting.

kfdd_synthesis_reordering_sifting_and_dtl_sifting 

Heuristic variable re-ordering by sifting followed by heuristic DTL and variable re-ordering by sifting.

kfdd_synthesis_reordering_inverse 

Inversion of the variable ordering.

anonymous enum

Flags for the growth limit in kfdd_synthesis_settings.

Enumerator
kfdd_synthesis_growth_limit_relative 

Relative growth limit: after each repositioning of a sifting variable the comparison size for the growing is actualized.

kfdd_synthesis_growth_limit_absolute 

Absolute growth limit: the comparison size is the intial size of the DDs for the complete sifting-process.

anonymous enum

Flags for the sifting method.

Enumerator
kfdd_synthesis_sifting_method_random 

Random

kfdd_synthesis_sifting_method_initial 

Initial: The sifting variables are chosen in the order given before the sifting procedure starts

kfdd_synthesis_sifting_method_greatest 

Greatest: Chooses the variable in the level with the largest number of nodes

kfdd_synthesis_sifting_method_loser_first 

Loser first: Although the complete sifting process will reduce the number of DD-Nodes (or at least keep the same size if no improvement can be done) after each repositioning of a sifting variable there will occasionally be some levels that grow. The loser first strategy chooses the next sifting candidate as the variable in the level with the least increase in size

kfdd_synthesis_sifting_method_verify 

Verify: Calculates the number of node eliminations due to the reduction rules of KFDDs if a variable is repositioned in a specific level. It then chooses the best position according to the highest count result

Function Documentation

unsigned revkit::add_line_to_circuit ( circuit &  circ,
const std::string &  input,
const std::string &  output,
const constant &  c = constant(),
bool  g = false 
)

Add a line to a circuit with specifying all meta-data.

This function helps adding a line to the circuit. Besides incrementing the line counter, all meta-data information is adjusted as well.

Parameters
circCircuit
inputName of the input of the line
outputName of the output of the line
cConstant value of that line (Default: Not constant)
gIf true, line is a garbage line
Returns
The index of the newly added line
Author
RevKit
Since
1.0 (Return value since 1.1)
bool revkit::adding_lines ( circuit &  circ,
const circuit &  base,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Adding Lines Optimization.

This algorithm implements the Adding Lines Optimization proposed in [MWD10] which adds helper lines to reduce quantum costs in reversible circuits.

Parameters
circOptimized circuit to be generated
baseOriginal circuit
settings
Setting Type Default Value
additional_lines unsigned 1u
Number of additional helper lines to add to the circuit.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.1
optimization_func revkit::adding_lines_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the adding_lines algorithm.

Parameters
settingsSettings (see adding_lines)
statisticsStatistics (see adding_lines)
Returns
A functor which complies with the optimization_func interface
Author
RevKit
Since
1.1
void revkit::append_circuit ( circuit &  circ,
const circuit &  src,
const gate::line_container &  controls = gate::line_container() 
)

Insert a circuit src at the end of another circuit circ.

Parameters
circDestination circuit
srcSource circuit
controlsControls, which are added to each gate in src (introduced in version 1.1)
Author
RevKit
Since
1.0
gate& revkit::append_cnot ( circuit &  circ,
const gate::line &  control,
const gate::line &  target 
)

Helper function for appending a CNOT gate.

Parameters
circCircuit
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::append_fredkin ( circuit &  circ,
const gate::line_container &  controls,
const gate::line &  target1,
const gate::line &  target2 
)

Helper function for appending a Fredkin gate.

Parameters
circCircuit
controlsControl Lines
target1Target Line 1
target2Target Line 2
Returns
Gate reference
Author
RevKit
Since
1.0
control_line_adder revkit::append_fredkin ( circuit &  circ)

Helper function for appending a Fredkin gate using the control_line_adder.

Parameters
circCircuit
Returns
A control_line_adder
See Also
Adding Gates
Author
RevKit
Since
1.0
control_line_adder revkit::append_gate ( circuit &  circ,
const boost::any &  tag 
)

Helper function for appending a generic gate using the control_line_adder.

Parameters
circCircuit
tagGate type tag
Returns
A control_line_adder
See Also
Adding Gates
Target Tags
Author
RevKit
Since
1.0
gate& revkit::append_module ( circuit &  circ,
const std::string &  module_name,
const gate::line_container &  controls,
const std::vector< unsigned > &  targets 
)

Helper function for appending a module gate.

Parameters
circCircuit
module_nameName of the module (already added to the circuit)
controlsControl Lines
targetsTarget Lines (has to be a ordered vector for the mapping to the module lines)
Returns
Gate reference
Author
RevKit
Since
1.1
gate& revkit::append_not ( circuit &  circ,
const gate::line &  target 
)

Helper function for appending a NOT gate.

Parameters
circCircuit
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::append_peres ( circuit &  circ,
const gate::line &  control,
const gate::line &  target1,
const gate::line &  target2 
)

Helper function for appending a Peres gate.

Parameters
circCircuit
controlControl Line
target1Target Line 1
target2Target Line 2
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::append_toffoli ( circuit &  circ,
const gate::line_container &  controls,
const gate::line &  target 
)

Helper function for appending a Toffoli gate.

Parameters
circCircuit
controlsControl Lines
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
control_line_adder revkit::append_toffoli ( circuit &  circ)

Helper function for appending a Toffoli gate using the control_line_adder.

Parameters
circCircuit
Returns
A control_line_adder
See Also
Adding Gates
Author
RevKit
Since
1.0
gate& revkit::append_v ( circuit &  circ,
const gate::line &  control,
const gate::line &  target 
)

Helper function for appending a V gate.

Parameters
circCircuit
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::append_vplus ( circuit &  circ,
const gate::line &  control,
const gate::line &  target 
)

Helper function for appending a V+ gate.

Parameters
circCircuit
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
bool revkit::bdd_synthesis ( circuit &  circ,
const std::string &  filename,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

BDD based synthesis approach.

This algorithm implements the BDD based synthesis approach based on [WD09]. It supports complemented edges, different re-ordering strategies and the generation of both, Toffoli and elementary quantum gates.

The function representation can be read from a PLA file-name.

Parameters
circThe circuit to be constructed
filenameA PLA file
settings
Setting Type Default Value
complemented_edges bool true
Specifies whether complemented edges should be used for the BDD.
reordering unsigned CUDD_REORDER_SIFT
Reordering of the BDD. Check CUDD Manual for details.
dotfilename std::string std::string()
If not empty a DOT representation of the BDD is dumped to the file-name.
infofilename std::string std::string()
If not empty information about the BDD is dumped to the file-name.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
node_count unsigned Number of nodes of the BDD.
Returns
true on success
Author
RevKit
Since
1.0
pla_blif_synthesis_func revkit::bdd_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the bdd_synthesis_func algorithm.

Parameters
settingsSettings (see bdd_synthesis_func)
statisticsStatistics (see bdd_synthesis_func)
Returns
A functor which complies with the pla_blif_synthesis_func interface
Author
RevKit
Since
1.0
void revkit::circuit_hierarchy ( const circuit &  circ,
hierarchy_tree &  tree 
)

Calculates the hierarchy of a circuit by its modules.

This function traverses all modules starting from a top circuit circ recursively and builds a tree and stores it in tree.

Parameters
circCircuit
treeHierarchy Tree
Author
RevKit
Since
1.1
bool revkit::circuit_to_truth_table ( const circuit &  circ,
binary_truth_table &  spec,
const functor< bool(boost::dynamic_bitset<> &, const circuit &, const boost::dynamic_bitset<> &)> &  simulation 
)

Generates a truth table from a circuit.

This function takes a circuit, simulates it with a custom simulation function and creates the specification. Further, the meta is copied.

Parameters
circCircuit to be simulated
specEmpty truth table to be constructed
simulationSimulation function object
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
void revkit::clear_circuit ( circuit &  circ)

Clears the circuit circ.

This function clears all lines, gates and meta-data in a circuit.

Parameters
circCircuit
Author
RevKit
Since
1.0
Iterator revkit::control_lines ( const gate &  g,
Iterator  result 
)

Gets the control lines of a gate.

This function stores all control lines of a gate into a container.

Example

gate g = ...;
std::vector<gate::line> controls;
control_lines( g, std::back_inserter( controls ) );
Parameters
gGate
resultIterator to store the lines as gate::line type
Returns
The iterator after adding the lines (pointing after the end)
Author
RevKit
Since
1.0
void revkit::copy_circuit ( const circuit &  src,
circuit &  dest 
)

Copies a circuit with all meta information.

This function creates a copy of the circuit src in dest including all meta information as input and output names, and also constant input and garbage output information.

Parameters
srcSource circuit
destDestination circuit
Author
RevKit
Since
1.0
void revkit::copy_metadata ( const truth_table< T > &  spec,
circuit &  circ 
)

Copies meta-data from a specification to a circuit.

This method reads the inputs and outputs from a specification and assigns to it to a circuit. Truth-table based synthesis algorithms should use this method.

Parameters
specTruth Table
circCircuit
Author
RevKit
Since
1.0
void revkit::copy_metadata ( const circuit &  base,
circuit &  circ,
const copy_metadata_settings &  settings = copy_metadata_settings() 
)

Copies meta-data from a circuit to another circuit.

This method copies everything but the gates from circuit base to circuit circ.

Parameters
baseSource circuit
circDestination circuit
settingsSettings for copy_metadata (since 1.2)
Author
RevKit
Since
1.0
cost_t revkit::costs ( const circuit &  circ,
const cost_function &  f 
)

Calculates the costs of a circuit by a given cost function.

With this function the costs for a circuit can be calculated. Thereby this functions is generic and calls a cost_function for determine the costs. The costs function can either be derived from costs_by_circuit, whereby the costs are calculated on base by the whole circuit or it can be derived from costs_by_gate, whereby the costs are of each gate are calculated and the sum is returned.

Parameters
circCircuit
fCost function
Returns
The costs for the circuit in respect to the given cost function
See Also
Cost Functions
Author
RevKit
Since
1.0
void revkit::create_image ( std::ostream &  os,
const circuit &  circ,
create_image_settings &  settings 
)

Create image from circuit circ and write it to os.

This function creates an image from a circuit. Thereby, the third parameter is a struct which derives from create_image_settings, for example create_pstricks_settings of create_tikz_settings for creating LaTeX pictures based on PsTricks or TikZ, respectively.

In order to write to an unsupported format, derive a class from create_image_settings and re-implement the abstract methods.

Parameters
osOutput stream to write the image to
circCircuit
settingsThe settings for painting which provides as well the painting methods
Author
RevKit
Since
1.0
void revkit::create_image ( const std::string &  filename,
const circuit &  circ,
create_image_settings &  settings 
)

Wrapper for create_image to save to a file.

This is a wrapper for create_image(std::ostream& os, const circuit&, create_image_settings&) which creates a ostream object for a file buffer.

Parameters
filenameFile-name
circCircuit
settingsThe settings for painting which provides as well the painting methods
Author
RevKit
Since
1.0
bool revkit::create_simulation_pattern ( const pattern &  p,
const circuit &  circ,
std::vector< boost::dynamic_bitset<> > &  sim,
std::map< std::string, boost::dynamic_bitset<> > &  init,
std::string *  error = 0 
)

Create simulation pattern for sequential simulation.

Parameters
pPattern class
circCircuit to be simulated
simEmpty vector which is filled with input assignments for every step
initMap which contains the initial assignment for state signals
errorIf not null, the string targeted by the pointer is assigned with an error message
Author
RevKit
Since
1.2
bool revkit::embed_truth_table ( binary_truth_table &  spec,
const binary_truth_table &  base,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Embedding of an irreversible specification.

This algorithm takes an irreversible (incompletely) specified truth table, for example using read_pla and embeds it into a reversible specification. Thereby necessary garbage and constant lines are added. The function is always embedded using the 0 values of the constant lines and the method which is used is the "Greedy Method" applying possible assignments by the minimal hamming distance.

Example

binary_truth_table base, spec;
read_pla( base, "filename.pla" );
embed_truth_table( spec, base );
Parameters
specEmbedded specification (it can be the same as base to embed in place)
baseSpecification to be embedded
settings
Setting Type Default Value
default_decomposition garbage_name "g"
Name of the output of the helper line, if added by the algorithm.
output_order std::vector<unsigned> empty vector
Order of the output when embedding. The vector contains indices of all possible positions. A valid unique position for each output has to be specified. If empty the first lines are used for the outputs in order.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
embedding_func revkit::embed_truth_table_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the embed_truth_table algorithm.

Parameters
settingsSettings (see embed_truth_table)
statisticsStatistics (see embed_truth_table)
Returns
A functor which complies with the embedding_func interface
Author
RevKit
Since
1.0
bool revkit::equivalence_check ( const circuit &  spec,
const circuit &  impl,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Functional and formal equivalence check.

This function implements the SAT-based equivalence checker as introduced in [WGMD09].

Parameters
specCircuit (Specification)
implCircuit to be verified (Implementation)
settings
Setting Type Default Value
solver std::string "MiniSAT"
The solver to be used in the approach.
max_counterexample unsigned 10u
The number of maximal generated counterexample.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
counterexample counterexample Generated counterexample if the specification and the implementation differ.
Returns
true if successful, false otherwise
Author
RevKit
Since
1.0
equivalence_func revkit::equivalence_check_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the equivalence_check algorithm.

Parameters
settingsSettings (see equivalence_check)
statisticsStatistics (see equivalence_check)
Returns
A functor which complies with the equivalence_check_func interface
Author
RevKit
Since
1.0
bool revkit::esop_synthesis ( circuit &  circ,
const std::string &  filename,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

ESOP Based Synthesis.

This algorithm implements the ESOP based synthesis approach as introduced in [FTR07]. The basic approach, where each input signal requires to line for its positive and negative polarity version, can be enabled by setting the property separate_polarities to true. If one line is used for both polarities, which is the default case, a functor can be specified to reorder the cubes in order to minimize inverter gates. Two functors are provided which are, no_reordering which keeps the initial order from the truth table, and weighted_reordering which is proposed in [FTR07] as reordering strategy.

Parameters
circCircuit to be generated.
filenameA file-name of a function as ESOP PLA representation.
settings
Setting Type Default Value
separate_polarities bool false
If true, the basic approach using two circuit lines for each input variable is used. Further, in that case, no reordering functor has to be specified.
reordering cube_reordering_func weighted_reordering()
Function for reordering the cubes to obtain a better result by using less NOT gates.
garbage_name std::string "g"
Name of the garbage outputs which are added by the algorithm for each input line.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
pla_blif_synthesis_func revkit::esop_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the esop_synthesis algorithm.

Parameters
settingsSettings (see esop_synthesis)
statisticsStatistics (see esop_synthesis)
Returns
A functor which complies with the pla_blif_synthesis_func interface
Author
RevKit
Since
1.0
bool revkit::exact_synthesis ( circuit &  circ,
const binary_truth_table &  spec,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Synthesizes a minimal circuit (with respect to the number of gates) using the SAT-based exact synthesis approach as presented in [GWDD09].

Parameters
circEmpty Circuit
specFunction Specification (has to be fully specified)
settings
Setting Type Default Value
solver std::string "MiniSAT"
The solver to be used in the approach.
spec_incremental bool true
Specifies, whether the incremental encoding should be used.
max_depth unsigned 20u
The maximal considered circuit depth.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true if successful, false otherwise
Author
RevKit
Since
1.0
truth_table_synthesis_func revkit::exact_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the exact_synthesis algorithm.

Parameters
settingsSettings (see exact_synthesis)
statisticsStatistics (see exact_synthesis)
Returns
A functor which complies with the exact_synthesis_func interface
Author
RevKit
Since
1.0
bool revkit::expand_circuit ( const circuit &  base,
circuit &  circ,
unsigned  num_lines,
const std::vector< unsigned > &  filter 
)

Expands a circuit.

This function expands the circuit base, such that it will have num_lines and maps each line i in the circuit base to the line filter[i] in the circuit circ.

Parameters
baseBase circuit
circNewly created circuit, extended from base. Needs to be empty.
num_linesNew number of lines
filterMapping for calculating the new line indices.
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
bool revkit::expand_circuit ( const circuit &  base,
circuit &  circ 
)

Expands a circuit.

As expand_circuit(const circuit&, circuit&, unsigned, const std::vector<unsigned>& but takes the number of lines and the filter from the circuit::filter method. This function requires base to be a subcircuit.

Parameters
baseBase circuit. Needs to be a subcircuit.
circNewly created circuit, extended from base. Needs to be empty.
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
void revkit::extend_truth_table ( binary_truth_table &  spec)

Removes the Don't Care Values of a binary truth table.

This methods fills the incomplete cubes of a truth table.

Parameters
specTruth table
Author
RevKit
Since
1.0
Iterator revkit::find_empty_lines ( const gate &  src,
unsigned  line_size,
Iterator  result 
)

Finds empty lines in a gate.

This function inserts all empty lines, which are neither control or target line into an iterator.

Example

revkit::find_empty_lines( circ[0], circ.lines(), std::insert_iterator<revkit::gate::line_container>( empty_lines, empty_lines.begin() ) );
Parameters
srcGate
line_sizeNumber of lines in the gate
resultIterator to add empty lines of type gate::line
Returns
The iterator after adding the lines (pointing behind the end)
Author
RevKit
Since
1.0
void revkit::find_empty_lines ( const gate &  src,
unsigned  line_size,
gate::line_container &  lines 
)

Finds empty lines in a gate.

This function inserts all empty lines, which are neither control or target line into an line container.

Example

revkit::find_empty_lines( *circ[0], circ.lines(), empty_lines );
Parameters
srcGate
line_sizeNumber of lines in the gate
linesA gate::line_container to insert the empty lines
Author
RevKit
Since
1.0
Iterator revkit::find_empty_lines ( GateIterator  first,
GateIterator  last,
unsigned  line_size,
Iterator  result 
)

Finds empty lines in a range of gates.

This function finds lines in a range of gates [first, last) which are never used by any gate, meaning that they are no control or target line for any gate.

Parameters
firstBegin iterator of the gates (inclusive)
lastEnd iterator of the gates (exclusive)
line_sizeNumber of lines for the gates
resultIterator to add empty lines of type gate::line
Returns
The iterator after adding the lines (pointing behind the end)
Author
RevKit
Since
1.0
Iterator revkit::find_empty_lines ( const circuit &  circ,
Iterator  result 
)

Finds empty lines in a circuit.

This function finds lines in a circuit which are never used by any gate, meaning that they are no control or target line for any gate.

Parameters
circCircuit
resultIterator to add empty lines of type gate::line
Returns
The iterator after adding the lines (pointing behind the end)
Author
RevKit
Since
1.0
Iterator revkit::find_non_empty_lines ( const gate &  src,
Iterator  result 
)

Finds non empty lines in a gate.

This function inserts all lines, which are either control or target line into an iterator.

Example

revkit::find_non_empty_lines( circ[0], circ.lines(), std::insert_iterator<revkit::gate::line_container>( non_empty_lines, non_empty_lines.begin() ) );
Parameters
srcGate
resultIterator to add non empty lines of type gate::line
Returns
The iterator after adding the lines (pointing behind the end)
Author
RevKit
Since
1.0
Iterator revkit::find_non_empty_lines ( GateIterator  first,
GateIterator  last,
Iterator  result 
)

Finds non empty lines in a range of gates.

This function finds lines in a range of gates [first, last) which are used by at least one gate, meaning that they are control or target line for at least one gate.

Parameters
firstBegin iterator of the gates (inclusive)
lastEnd iterator of the gates (exclusive)
resultIterator to add non empty lines of type gate::line
Returns
The iterator after adding the lines (pointing behind the end)
Author
RevKit
Since
1.0
Iterator revkit::find_non_empty_lines ( const circuit &  circ,
Iterator  result 
)

Finds non empty lines in a circuit.

This function finds lines in a circuit which are used by at least one gate, meaning that they are control or target line for at least one gate.

Parameters
circCircuit
resultIterator to add non empty lines of type gate::line
Returns
The iterator after adding the lines (pointing behind the end)
Author
RevKit
Since
1.0
void revkit::flatten_circuit ( const circuit &  base,
circuit &  circ,
bool  keep_meta_data = false 
)

Flattens a circuit with modules.

This functions takes a circuit with module base and substitutes all modules with their elementary gates recursively and saves the result in circ.

Parameters
baseCircuit to flatten (with modules)
circResulting circuit (without modules)
keep_meta_dataSpecifies, whether the RevLib 2.0 meta data such as buses should be kept (since 1.2)
Author
RevKit
Since
1.1
bool revkit::fully_specified ( const truth_table< T > &  tt,
const typename truth_table< T >::value_type &  dc_value,
bool  is_reversible = true 
)

Returns whether a truth table is fully specified.

This function checks whether a truth table tt is full specified, that is input dimension is equal to output dimension and there is no don't care value dc_value in any of the assigments.

Further, the truth table cannot be empty.

Note
A fully specified truth table does not imply that it is reversible
Parameters
ttTruth table
dc_valueThe don't care value for the truth table
is_reversibleIf true, number of outputs has to match number of inputs. Default value is true.
Returns
true, if it is fully speciefied, otherwise false
Author
RevKit
Since
1.0
bool revkit::fully_specified ( const binary_truth_table &  tt,
bool  is_reversible = true 
)

Returns whether a truth table is fully specified.

This function is specialized for a reversible_truth_table, but calls the generic version with the don't care value.

Parameters
ttTruth table
is_reversibleIf true, number of outputs has to match number of inputs. Default value is true.
Returns
true, if it is fully speciefied, otherwise false
Author
RevKit
Since
1.0
T revkit::get ( const properties::ptr &  settings,
const properties::key_type &  k,
const T &  default_value 
)

A helper method to access the get method on a properties smart pointer.

This method has basically two fall backs. If settings does not point to anything, it returns default_value, and otherwise it calls the get method on the pointee of the smart pointer with the default_value again, so in case the key k does not exists, the default_value is returned as well.

Parameters
settingsA smart pointer to a properties instance or an empty smart pointer
kKey of the property to be accessed
default_valueA default_value as fall back option in case the smart pointer is empty or the key does not exist.
Returns
The value addressed by k or the default_value.
Author
RevKit
Since
1.0
void revkit::insert_circuit ( circuit &  circ,
unsigned  pos,
const circuit &  src,
const gate::line_container &  controls = gate::line_container() 
)

Insert a circuit src before gate pos (counting from 0) of another circuit circ.

Parameters
circDestination circuit
posPosition where to insert
srcSource circuit
controlsControls, which are added to each gate in src (introduced in version 1.1)
Author
RevKit
Since
1.0
gate& revkit::insert_cnot ( circuit &  circ,
unsigned  n,
const gate::line &  control,
const gate::line &  target 
)

Helper function for inserting a CNOT gate.

Parameters
circCircuit
nIndex to insert the gate
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::insert_fredkin ( circuit &  circ,
unsigned  n,
const gate::line_container &  controls,
const gate::line &  target1,
const gate::line &  target2 
)

Helper function for inserting a Fredkin gate.

Parameters
circCircuit
nIndex to insert the gate
controlsControl Lines
target1Target Line 1
target2Target Line 2
Returns
Gate reference
Author
RevKit
Since
1.0
control_line_adder revkit::insert_fredkin ( circuit &  circ,
unsigned  n 
)

Helper function for inserting a Fredkin gate using the control_line_adder.

Parameters
circCircuit
nIndex to insert the gate
Returns
A control_line_adder
See Also
Adding Gates
Author
RevKit
Since
1.0
control_line_adder revkit::insert_gate ( circuit &  circ,
unsigned  n,
const boost::any &  tag 
)

Helper function for inserting a generic gate using the control_line_adder.

Parameters
circCircuit
nIndex to insert the gate
tagGate type tag
Returns
A control_line_adder
See Also
Adding Gates
Target Tags
Author
RevKit
Since
1.0
gate& revkit::insert_module ( circuit &  circ,
unsigned  n,
const std::string &  module_name,
const gate::line_container &  controls,
const std::vector< unsigned > &  targets 
)

Helper function for inserting a module gate.

Parameters
circCircuit
nIndex to insert the gate
module_nameName of the module (already added to the circuit)
controlsControl Lines
targetsTarget Lines (has to be a ordered vector for the mapping to the module lines)
Returns
Gate reference
Author
RevKit
Since
1.1
gate& revkit::insert_not ( circuit &  circ,
unsigned  n,
const gate::line &  target 
)

Helper function for inserting a NOT gate.

Parameters
circCircuit
nIndex to insert the gate
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::insert_peres ( circuit &  circ,
unsigned  n,
const gate::line &  control,
const gate::line &  target1,
const gate::line &  target2 
)

Helper function for inserting a Peres gate.

Parameters
circCircuit
nIndex to insert the gate
controlControl Line
target1Target Line 1
target2Target Line 2
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::insert_toffoli ( circuit &  circ,
unsigned  n,
const gate::line_container &  controls,
const gate::line &  target 
)

Helper function for inserting a Toffoli gate.

Parameters
circCircuit
nIndex to insert the gate
controlsControl Lines
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
control_line_adder revkit::insert_toffoli ( circuit &  circ,
unsigned  n 
)

Helper function for inserting a Toffoli gate using the control_line_adder.

Parameters
circCircuit
nIndex to insert the gate
Returns
A control_line_adder
See Also
Adding Gates
Author
RevKit
Since
1.0
gate& revkit::insert_v ( circuit &  circ,
unsigned  n,
const gate::line &  control,
const gate::line &  target 
)

Helper function for inserting a V gate.

Parameters
circCircuit
nIndex to insert the gate
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::insert_vplus ( circuit &  circ,
unsigned  n,
const gate::line &  control,
const gate::line &  target 
)

Helper function for inserting a V+ gate.

Parameters
circCircuit
nIndex to insert the gate
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
bool revkit::is_fredkin ( const gate &  g)

Returns whether a gate is a Fredkin gate.

Parameters
gGate
Returns
true, if g is a Fredkin gate
Author
RevKit
Since
1.0
bool revkit::is_module ( const gate &  g)

Returns whether a gate is a module.

Parameters
gGate
Returns
true, if g is a module
Author
RevKit
Since
1.1
bool revkit::is_peres ( const gate &  g)

Returns whether a gate is a Peres gate.

Parameters
gGate
Returns
true, if g is a Peres gate
Author
RevKit
Since
1.0
bool revkit::is_toffoli ( const gate &  g)

Returns whether a gate is a Toffoli gate.

Parameters
gGate
Returns
true, if g is a Toffoli gate
Author
RevKit
Since
1.0
bool revkit::is_type ( const boost::any &  operand)

Compares type of a boost::any variable.

This method is called by is_gate functions like is_toffoli().

Parameters
operandA variable of type boost::any
Returns
true, if operand is of type T.
Author
RevKit
Since
1.0
bool revkit::is_v ( const gate &  g)

Returns whether a gate is a V gate.

Parameters
gGate
Returns
true, if g is a V gate
Author
RevKit
Since
1.0
bool revkit::is_vplus ( const gate &  g)

Returns whether a gate is a V+ gate.

Parameters
gGate
Returns
true, if g is a V+ gate
Author
RevKit
Since
1.0
bool revkit::kfdd_synthesis ( circuit &  circ,
const std::string &  filename,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

KFDD Based Synthesis.

This algorithm implements the KFDD based synthesis approach as introduced in [SWD10]. Thereby, re-ordering strategies as well as different decomposition types can be used.

Parameters
circEmpty circuit, to be constructed by the algorithm
filenameA functional representation as BLIF or PLA file
settings
Setting Type Default Value
default_decomposition unsigned revkit::kfdd_synthesis_dtl_shannon
Default decomposition type when initially generating the KFDD.
reordering unsigned revkit::kfdd_synthesis_reordering_none
Reordering of the KFDD.
sift_factor double 2.5
Sifting factor, used when reordering uses sifting.
sifting_growth_limit unsigned revkit::kfdd_synthesis_growth_limit_absolute
Sifting growth limit, used when reordering uses sifting.
sifting_method char revkit::kfdd_synthesis_sifting_method_verify
Sifting method, used when reordering uses sifting.
dotfilename std::string std::string()
If not empty a DOT representation of the KFDD is dumped to the file-name.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
node_count unsigned Number of nodes of the KFDD.
Returns
true on success
Author
RevKit
Since
1.0
pla_blif_synthesis_func revkit::kfdd_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the kfdd_synthesis_func algorithm.

Parameters
settingsSettings (see kfdd_synthesis_func)
statisticsStatistics (see kfdd_synthesis_func)
Returns
A functor which complies with the pla_blif_synthesis_func interface
Author
RevKit
Since
1.0
bool revkit::line_reduction ( circuit &  circ,
const circuit &  base,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Line Reduction Optimization.

This algorithm implements the approach presented in [WSD10]. Windows are found and re-synthesized such that an output of that window is always returning a constant value, so that it can be used as replacement for another constant input line, often introduced by hierarchical synthesis methods.

Parameters
circOptimized circuit to be created (needs to be empty)
baseBase circuit which should be optimized
settings
Setting Type Default Value
max_window_lines unsigned 6u
Number of lines the selected windows can have initially.
max_grow_up_window_lines unsigned 9u
When the truth table is not reversible, obtained by a window with max_window_lines lines, then the number of lines can be increased up at most this value.
window_variables_threshold unsigned 17u
The possible window inputs are obtained by simulating its cone of influence. It is only simulated if the number of its primary inputs is less or equal to this value.
simulation simulation_func simple_simulation_func()
Simulation function used to simulate values inside the windows and inside the cone of influence.
window_synthesis window_synthesis_func embed_and_synthesize()
Functor used to re-synthesize the window. It only has to embed and synthesize the window. It is preferred to use embed_and_synthesize, whereby the parameters can be adjusted to use different synthesis algorithms.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
num_considered_windows unsigned Number of windows, which were considered in total.
skipped_max_window_lines unsigned Number of skipped windows due to maximum number of allowed primary inputs to be simulated, see window_variables_threshold.
skipped_ambiguous_line unsigned Number of skipped windows due to irreversible specification.
skipped_no_constant_line unsigned Number of skipped windows in the case that no constant line can be found for a garbage line.
skipped_synthesis_failed unsigned Number of skipped windows in the case that the synthesis of the window failed.
Returns
true on success
Author
RevKit
Since
1.0
optimization_func revkit::line_reduction_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the line_reduction algorithm.

Parameters
settingsSettings (see line_reduction)
statisticsStatistics (see line_reduction)
Returns
A functor which complies with the optimization_func interface
Author
RevKit
Since
1.0
bool revkit::lnn_optimization ( circuit &  circ,
const circuit &  base,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Linear nearest Neighbor.

Algorith implements a linear nearest neighbor approach

optimization_func revkit::lnn_optimization_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the lnn_optimization algorithm.

Parameters
settingsSettings (see lnn_optimization)
statisticsStatistics (see lnn_optimization)
Returns
A functor which complies with the optimization_func interface
void revkit::no_reordering ( std::vector< std::pair< binary_truth_table::cube_type, binary_truth_table::cube_type > > &  cubes)

Empty functor for cube_reordering_func.

This functor is empty and does not sort the cubes, so the order remains the same.

Author
RevKit
Since
1.0
binary_truth_table::cube_type revkit::number_to_truth_table_cube ( unsigned  number,
unsigned  bw 
)

Converts a number to a cube of a fixed bitwidth.

The first element in the cube (at index 0) is thereby the most significant bit.

Parameters
numberNumber to be converted as a cube
bwBit-width of the cube
Returns
The number as cube
Author
RevKit
Since
1.0
std::ostream& revkit::operator<< ( std::ostream &  os,
const circuit &  circ 
)

Wrapper for using with the output stream operator.

This operator wraps the print_circuit method to output a circuit in a stream flow using the left shift operator.

Parameters
osThe stream to dump the circuit
circCircuit
Returns
The stream given as parameter os
Author
RevKit
Since
1.0
std::ostream& revkit::operator<< ( std::ostream &  os,
const binary_truth_table &  spec 
)

Outputs a truth table.

Prints the input and output cubes of a binary truth table

Parameters
osThe output stream
specThe truth table
Returns
The output stream os
Author
RevKit
Since
1.0
bool revkit::partial_simulation ( boost::dynamic_bitset<> &  output,
const circuit &  circ,
const boost::dynamic_bitset<> &  input,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Simulation considering constant inputs and garbage outputs.

This simulation function does not require a complete input pattern. Constant Lines are omitted and not counted in the pattern. If you have a circuit with 5 lines for example and the 2 and 3 lines are constant input lines, only 3 bits are accessed in this simulation, and counted from 0, without taking the constant inputs into account. A valid pattern would be 6 = 110 (MSB is left), assigning the first line to 0, and the fourth and the fifth line to 1.

The constant values are automatically inserted by the algorithm. The same applies, when returning the output pattern. Thereby, the garbage lines are omitted and thus, the indices in the output pattern may not correspond to the indices in the circuit. However, the order is respected.

Parameters
outputOutput pattern
circCircuit to be simulated
inputInput pattern
settings
Setting Type Default Value
simulation simulation_func simple_simulation_func()
After extending the input pattern by the constant values, the pattern is simulated using this algorithm.
keep_full_output bool false
If true, then the garbage output lines are not omitted after simulation.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
simulation_func revkit::partial_simulation_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the partial_simulation algorithm.

Parameters
settingsSettings (see partial_simulation)
statisticsStatistics (see partial_simulation)
Returns
A functor which complies with the simulation_func interface
Author
RevKit
Since
1.0
void revkit::prepend_circuit ( circuit &  circ,
const circuit &  src,
const gate::line_container &  controls = gate::line_container() 
)

Insert a circuit src at the beginning of another circuit circ.

Parameters
circDestination circuit
srcSource circuit
controlsControls, which are added to each gate in src (introduced in version 1.1)
Author
RevKit
Since
1.0
gate& revkit::prepend_cnot ( circuit &  circ,
const gate::line &  control,
const gate::line &  target 
)

Helper function for prepending a CNOT gate.

Parameters
circCircuit
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::prepend_fredkin ( circuit &  circ,
const gate::line_container &  controls,
const gate::line &  target1,
const gate::line &  target2 
)

Helper function for prepending a Fredkin gate.

Parameters
circCircuit
controlsControl Lines
target1Target Line 1
target2Target Line 2
Returns
Gate reference
Author
RevKit
Since
1.0
control_line_adder revkit::prepend_fredkin ( circuit &  circ)

Helper function for prepending a Fredkin gate using the control_line_adder.

Parameters
circCircuit
Returns
A control_line_adder
See Also
Adding Gates
Author
RevKit
Since
1.0
control_line_adder revkit::prepend_gate ( circuit &  circ,
const boost::any &  tag 
)

Helper function for prepending a generic gate using the control_line_adder.

Parameters
circCircuit
tagGate type tag
Returns
A control_line_adder
See Also
Adding Gates
Target Tags
Author
RevKit
Since
1.0
gate& revkit::prepend_module ( circuit &  circ,
const std::string &  module_name,
const gate::line_container &  controls,
const std::vector< unsigned > &  targets 
)

Helper function for prepending a module gate.

Parameters
circCircuit
module_nameName of the module (already added to the circuit)
controlsControl Lines
targetsTarget Lines (has to be a ordered vector for the mapping to the module lines)
Returns
Gate reference
Author
RevKit
Since
1.1
gate& revkit::prepend_not ( circuit &  circ,
const gate::line &  target 
)

Helper function for prepending a NOT gate.

Parameters
circCircuit
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::prepend_peres ( circuit &  circ,
const gate::line &  control,
const gate::line &  target1,
const gate::line &  target2 
)

Helper function for prepending a Peres gate.

Parameters
circCircuit
controlControl Line
target1Target Line 1
target2Target Line 2
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::prepend_toffoli ( circuit &  circ,
const gate::line_container &  controls,
const gate::line &  target 
)

Helper function for prepending a Toffoli gate.

Parameters
circCircuit
controlsControl Lines
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
control_line_adder revkit::prepend_toffoli ( circuit &  circ)

Helper function for prepending a Toffoli gate using the control_line_adder.

Parameters
circCircuit
Returns
A control_line_adder
See Also
Adding Gates
Author
RevKit
Since
1.0
gate& revkit::prepend_v ( circuit &  circ,
const gate::line &  control,
const gate::line &  target 
)

Helper function for prepending a V gate.

Parameters
circCircuit
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
gate& revkit::prepend_vplus ( circuit &  circ,
const gate::line &  control,
const gate::line &  target 
)

Helper function for prepending a V+ gate.

Parameters
circCircuit
controlControl Line
targetTarget Line
Returns
Gate reference
Author
RevKit
Since
1.0
void revkit::print_circuit ( const circuit &  circ,
const print_circuit_settings &  settings = print_circuit_settings() 
)

Prints a circuit as ASCII.

This method can be used to dump a circuit as ASCII to the console output or into debug files.

Parameters
circCircuit
settingsSettings (see print_circuit_settings)
Author
RevKit
Since
1.0
void revkit::print_statistics ( std::ostream &  os,
const circuit &  circ,
double  runtime = -1.0,
const print_statistics_settings &  settings = print_statistics_settings() 
)

Print statistics about a circuit to an arbitrary output stream.

This function prints statistics to an arbitrary output stream os. It should provide a unique way of displaying information about circuit and run-time and should be used for all single algorithm implementations.

Parameters
osOutput stream where to print the information
circCircuit to obtain information from
runtimeOptional, if a run-time has been measured, it will be displayed as well
settingsSettings for printing the statistics (with templates)
Author
RevKit
Since
1.0
void revkit::print_statistics ( const circuit &  circ,
double  runtime = -1.0,
const print_statistics_settings &  settings = print_statistics_settings() 
)

Print statistics about a circuit to standard output.

This function prints statistics to standard output. It should provide a unique way of displaying information about circuit and run-time and should be used for all single algorithm implementations.

Parameters
circCircuit to obtain information from
runtimeOptional, if a run-time has been measured, it will be displayed as well
settingsSettings for printing the statistics (with templates)
Author
RevKit
Since
1.0
bool revkit::quantum_decomposition ( circuit &  circ,
const circuit &  base,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Quantum Decomposition of Reversible Circuits.

This algorithm decomposes a reversible circuit into a quantum circuit based on the work of [BBC+95] and [MD03]. The resulting circuits do not necessarily coincide with the quantum costs calculated by quantum_costs, since some further optimizations are not considered yet.

Parameters
circQuantum circuit to be created
baseReversible circuit
settings
Setting Type Default Value
helper_line_input std::string "w"
Name of the input of the helper line, if added by the algorithm.
helper_line_output std::string "w"
Name of the output of the helper line, if added by the algorithm.
gate_decomposition decomposition_func standard_decomposition()
Gate-wise decomposition function to use.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
decomposition_func revkit::quantum_decomposition_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the quantum_decomposition algorithm.

Parameters
settingsSettings (see quantum_decomposition)
statisticsStatistics (see quantum_decomposition)
Returns
A functor which complies with the decomposition_func interface
Author
RevKit
Since
1.0
bool revkit::read_pattern ( pattern &  p,
const std::string &  filename,
std::string *  error = 0 
)

I/O routine for reading a pattern (*.sim) file.

Parameters
pEmpty pattern class
filenameFile-name of the pattern file
errorIf not null, the string targeted by the pointer is assigned with an error message
Author
RevKit
Since
1.2
bool revkit::read_pla ( binary_truth_table &  spec,
const std::string &  filename,
const read_pla_settings &  settings = read_pla_settings(),
std::string *  error = 0 
)

Reads a specification from a PLA file.

This function parses an PLA file and creates a truth table. Thereby only the specified cubes of the PLA are added as entries including the don't care values. For extending the truth table, i.e. filling the don't cares and specifying the 0-outputs explicitly, call extend_truth_table.

Parameters
specThe truth table
filenameFile-name to read PLA from
settingsSettings for read_pla
errorIf not 0, an error message is assigned when the function returns false
Returns
true on success
Author
RevKit
Since
1.0
bool revkit::read_pla_to_bdd ( BDDTable &  bdd,
const std::string &  filename 
)

Reads a BDD from a PLA file.

Author
RevKit
Since
1.3
bool revkit::read_realization ( circuit &  circ,
std::istream &  in,
std::string *  error = 0 
)

Read a circuit realization into a circuit from stream.

This method uses revlib_parser(std::istream&, revlib_processor&, std::string*) but with a circuit_processor as reader. The required empty circuit for the reader is given as first parameter.

Parameters
circcircuit to be constructed
ininput stream containing the realization
errorA pointer to a string. In case the parsing fails, and error is not null, a error message is stored
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
bool revkit::read_realization ( circuit &  circ,
const std::string &  filename,
std::string *  error = 0 
)

Read a circuit realization into a circuit from filename.

This method construts a std::ifstream of the given filename and calls read_realization(circuit&, std::istream&, std::string*) with it.

Example

The following code demonstrates how to read a realization from a file given by its filename into a circuit.

circuit circ;
read_realization( circ, "circuit.real" );

Sometimes it is useful to provide the caller with error information in case the call failed. To obtain an error message a pointer to a std::string is given as third parameter to the function. The function returns false if it fails.

circuit circ;
std::string error;
if ( !read_realization( circ, "circuit.real", &error ) ) {
std::cerr << "An error occured: " << error << std::endl;
}
Parameters
circcircuit to be constructed
filenamefilename of the realization
errorA pointer to a string. In case the parsing fails, and error is not null, a error message is stored
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
bool revkit::read_specification ( binary_truth_table &  spec,
std::istream &  in,
std::string *  error = 0 
)

Read a specification into a truth table from stream.

This method uses revlib_parser(std::istream&, revlib_processor&, std::string*) but with a specification_processor as reader. The required empty reversible_truth_table for the reader is given as first parameter.

Parameters
spectruth table to be constructed
ininput stream containing the specification
errorA pointer to a string. In case the parsing fails, and error is not null, a error message is stored
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
bool revkit::read_specification ( binary_truth_table &  spec,
const std::string &  filename,
std::string *  error = 0 
)

Read a specification into a truth table from filename.

This method construts a std::ifstream of the given filename and calls read_specification(reversible_truth_table&, std::istream&, std::string*) with it.

Example

The following code demonstrates how to read a specification from a file given by its filename into a truth table.

reversible_truth_table spec;
read_specification( spec, "function.spec" );

Sometimes it is useful to provide the caller with error information in case the call failed. To obtain an error message a pointer to a std::string is given as third parameter to the function. The function returns false if it fails.

reversible_truth_table spec;
std::string error;
if ( !read_specification( spec, "fucntion.spec", &error ) ) {
std::cerr << "An error occured: " << error << std::endl;
}
Parameters
spectruth table to be constructed
filenamefilename of the specification
errorA pointer to a string. In case the parsing fails, and error is not null, a error message is stored
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
bool revkit::reed_muller_synthesis ( circuit &  circ,
const binary_truth_table &  spec,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Synthesis algorithm based on Reed Muller Spectra.

This function implements the algorithm published in [MDM07].

Parameters
circEmpty Circuit
specFunction Specification (has to be fully specified)
settings
Setting Type Default Value
bidirectional bool true
Use the bidirectional approach as described in [MDM07].
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true if successful, false otherwise
Author
RevKit
Since
1.3
truth_table_synthesis_func revkit::reed_muller_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the reed_muller_synthesis algorithm.

Parameters
settingsSettings (see reed_muller_synthesis)
statisticsStatistics (see reed_muller_synthesis)
Returns
A functor which complies with the truth_table_synthesis_func interface
Author
RevKit
Since
1.3
void revkit::reverse_circuit ( const circuit &  src,
circuit &  dest 
)

Reverse a circuit.

This function reverses a circuit src and writes the result to a new circuit dest.

You can use reverse_circuit(circuit&) if the circuit should be reversed in-place.

Parameters
srcSource circuit
destDestination circuit
Author
RevKit
Since
1.0
void revkit::reverse_circuit ( circuit &  circ)

Reverse a circuit in-place.

This function reverses a circuit circ in-place.

Parameters
circCircuit to be reversed
Author
RevKit
Since
1.0
const char* revkit::revkit_version ( )

Returns RevKit version.

Returns the current RevKit version

Returns
Version string
Author
RevKit
Since
1.1
bool revkit::revlib_parser ( std::istream &  in,
revlib_processor &  reader,
const std::string &  base_directory = std::string("."),
std::string *  error = 0 
)

A parser for the RevLib file format.

This function can read a circuit realization and truth table specifications in a format as proposed on RevLib. The function itself just realizes the parser and uses a revlib_processor instance which provides methods for implementation details.

For example, when reading the realization into a circuit structure, the read_realization_circuit_processor class can be used as instance.

Parameters
inInput stream containing the file
readerAn instance of the revlib_processor
base_directoryA base directory to look for included files. This is usually the directory of the loaded file-name. This member was introduced in RevKit version 1.1
errorA pointer to a string. In case the parsing fails, and error is not null, a error message is stored
Returns
true on success, false otherwise
Author
RevKit
Since
1.1
bool revkit::same_type ( const gate &  g1,
const gate &  g2 
)

Checks if two gates have the same type.

Use this function, since == does not work on gate::type to compare to gates by its type.

Parameters
g1First gate
g2Second gate
Returns
true, if they have the same target tag, otherwise false
Author
RevKit
Since
1.0
bool revkit::sequential_simulation ( std::vector< boost::dynamic_bitset<> > &  outputs,
const circuit &  circ,
const std::vector< boost::dynamic_bitset<> > &  inputs,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Sequential Simulation considering state inputs.

This algorithm performs a sequential simulation, i.e the partial simulation function is called for a list of input pattern. For that purpose, all state signals in the circuit are initially set to a value and then re-used for the successive simulations, therefore simulation the sequential behavior. This function can be used also with the create_simulation_pattern function by reading a SIM file.

Parameters
outputsOutput patterns
circCircuit to be simulated
inputsList of input pattern. In this pattern only the values for all input signals and no constant values or state values are set.
settings
Setting Type Default Value
initial_state bitset_map bitset_map()
Initial state for sequential signals per state.
vcd_filename std::string ""
If not empty, a wave trace is written to that file-name.
step_result sequential_step_result_func sequential_step_result_func() (empty)
A functor called at every simulation together with current state and output pattern.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.2
multi_step_simulation_func revkit::sequential_simulation_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the sequential_simulation algorithm.

Parameters
settingsSettings (see sequential_simulation)
statisticsStatistics (see sequential_simulation)
Returns
A functor which complies with the multi_step_simulation_func interface
Author
RevKit
Since
1.2
void revkit::set_error_message ( properties::ptr  statistics,
const std::string &  error 
)

Sets an error message to a statistics smart pointer.

This function checks first if the smart pointer references something, and if that is the case, the value error, is written to the key error.

Parameters
statisticsA smart pointer to a properties instance or an empty smart pointer
errorAn error message, which should be written to the key error if the smart pointer statistics can be de-referenced.
Author
RevKit
Since
1.0
bool revkit::simple_simulation ( boost::dynamic_bitset<> &  output,
const gate &  g,
const boost::dynamic_bitset<> &  input,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Simple Simulation function for a single gate.

This method calls the gate_simulation setting's functor on gate g using the input input and writes the result to output. If a the step_result setting is set, it will be called once, after simulating the single gate.

Parameters
outputOutput pattern. The index of the pattern corresponds to the line index.
gGate to be simulated
inputInput pattern. The index of the pattern corresponds to the line index. The bit-width of the input pattern has to be initialized properly to the number of lines.
settings
Setting Type Default Value
gate_simulation gate_simulation_func core_gate_simulation()
The gate-wise simulation functor to use.
step_result step_result_func step_result_func() (empty)
A functor called with the last simulated gate and the last calculated output pattern.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
bool revkit::simple_simulation ( boost::dynamic_bitset<> &  output,
circuit::const_iterator  first,
circuit::const_iterator  last,
const boost::dynamic_bitset<> &  input,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Simple Simulation function for a range of gates.

This method calls the gate_simulation setting's functor on the gate range from first to (exclusive) last. Thereby, the last calculated output pattern serves as the input pattern for the next gate. The last calculated output pattern is written to output. If a the step_result setting is set, it will be called after each gate simulation passing the gate as well as the step result.

Parameters
outputOutput pattern. The index of the pattern corresponds to the line index.
firstIterator pointing to the first gate.
lastIterator pointing to the last gate (exclusive).
inputInput pattern. The index of the pattern corresponds to the line index. The bit-width of the input pattern has to be initialized properly to the number of lines.
settings
Setting Type Default Value
gate_simulation gate_simulation_func core_gate_simulation()
The gate-wise simulation functor to use.
step_result step_result_func step_result_func() (empty)
A functor called with the last simulated gate and the last calculated output pattern.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
bool revkit::simple_simulation ( boost::dynamic_bitset<> &  output,
const circuit &  circ,
const boost::dynamic_bitset<> &  input,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Simple Simulation function for a circuit.

This method calls the gate_simulation setting's functor on all gates of the circuit circ. Thereby, the last calculated output pattern serves as the input pattern for the next gate. The last calculated output pattern is written to output. If a the step_result setting is set, it will be called after each gate simulation passing the gate as well as the step result.

Parameters
outputOutput pattern. The index of the pattern corresponds to the line index.
circCircuit to be simulated.
inputInput pattern. The index of the pattern corresponds to the line index. The bit-width of the input pattern has to be initialized properly to the number of lines.
settings
Setting Type Default Value
gate_simulation gate_simulation_func core_gate_simulation()
The gate-wise simulation functor to use.
step_result step_result_func step_result_func() (empty)
A functor called with the last simulated gate and the last calculated output pattern.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
simulation_func revkit::simple_simulation_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the simple_simulation algorithm.

Parameters
settingsSettings (see simple_simulation)
statisticsStatistics (see simple_simulation)
Returns
A functor which complies with the simulation_func interface
Author
RevKit
Since
1.0
bool revkit::swop ( circuit &  circ,
const binary_truth_table &  spec,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

SWOP Synthesis Approach.

This is an implementation of the SWOP (Synthesis with Output Permutation) synthesis approach as introduced in [WGDD09]. Thereby it is generic and can be used with every truth table based synthesis approach, which gets a circuit and a truth table as parameters.

Example

This example used Boost.Bind to make a fitting operator from the transformation_based_synthesis function, taking two parameters, the circuit and the truth table.

#include <boost/bind.hpp>
properties::ptr tbs_settings( new properties() );
// initialize settings for transformation based synthesis
properties::ptr tbs_statistics( new properties() );
circuit circ;
binary_truth_table spec = // obtained from somewhere
properties::ptr settings( new properties() ); // swop settings
settings->set( "synthesis", transformation_based_synthesis_func( settings, statistics ) );
swop( circ, spec, settings );
Parameters
circCircuit, must be empty, is filled with gate by the algorithm
specTruth table used for synthesis
settings
Setting Type Default Value
enable bool true
This setting enables the SWOP algorithm to do swapping of the outputs at all. This is useful, when using SWOP as an additional option to a synthesis approach, only one call is necessary, i.e. using swop with the respective synthesis approach but disabling the swapping. Then the algorithm behaves as called stand-alone.
exhaustive bool false
When set to true, all possible permutations are checked, otherwise sifting is used to find a permutation, which may not be optimal.
synthesis truth_table_synthesis_func transformation_based_synthesis_func()
Synthesis function to be used with the SWOP algorithm.
cost_function cost_function costs_by_circuit_func( gate_costs() )
Cost function to determine which circuit to use.
stepfunc swop_step_func swop_step_func() Empty functor
This functor is called after each iteration.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
truth_table_synthesis_func revkit::swop_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the swop algorithm.

Parameters
settingsSettings (see swop)
statisticsStatistics (see swop)
Returns
A functor which complies with the truth_table_synthesis_func interface
Author
RevKit
Since
1.0
Iterator revkit::target_lines ( const gate &  g,
Iterator  result 
)

Gets the target lines of a gate.

This function stores all target lines of a gate into a container.

Example

gate g = ...;
std::vector<gate::line> targets;
target_lines( g, std::back_inserter( targets ) );
Parameters
gGate
resultIterator to store the lines as gate::line type
Returns
The iterator after adding the lines (pointing after the end)
Author
RevKit
Since
1.0
bool revkit::transformation_based_synthesis ( circuit &  circ,
const binary_truth_table &  spec,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Synthesizes a circuit using the Transformation Based approach.

This function implements the algorithm published in [MMD03].

Parameters
circEmpty Circuit
specFunction Specification (has to be fully specified)
settings
Setting Type Default Value
bidirectional bool true
Use the bidirectional approach as described in [MMD03].
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true if successful, false otherwise
Author
RevKit
Since
1.0
truth_table_synthesis_func revkit::transformation_based_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the transformation_based_synthesis algorithm.

Parameters
settingsSettings (see transformation_based_synthesis)
statisticsStatistics (see transformation_based_synthesis)
Returns
A functor which complies with the truth_table_based_synthesis_func interface
Author
RevKit
Since
1.0
bool revkit::transposition_based_synthesis ( circuit &  circ,
const binary_truth_table &  spec,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

A simple synthesis algorithm based on transpositions.

TODO

Author
RevKit
Since
1.3
truth_table_synthesis_func revkit::transposition_based_synthesis_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the transposition_based_synthesis algorithm.

Parameters
settingsSettings (see transposition_based_synthesis)
statisticsStatistics (see transposition_based_synthesis)
Returns
A functor which complies with the truth_table_based_synthesis_func interface
Author
RevKit
Since
1.3
bool revkit::transposition_to_circuit ( circuit &  circ,
const boost::dynamic_bitset<> &  inputs,
const boost::dynamic_bitset<> &  outputs 
)

Creates a circuit realization for a transposition.

This function takes one line from a reversible truth table (inputs -> outputs) and returns a circuit that will map this input assignment to the output assignment and vice versa by leaving all other input and output assignments unaltered.

Parameters
circAn empty circuit that will be created. The number of lines of the circuit must coincide with the length of the input and output assignments.
inputsInput Assignment
outputsOutput Assignment
Author
RevKit
Since
1.3
unsigned revkit::truth_table_cube_to_number ( const binary_truth_table::cube_type &  cube)

Converts a truth table cube to a number.

The first element in the cube (at index 0) is thereby the most significant bit.

Parameters
cubeThe cube to be converted
Returns
The cube in numerical representation
Author
RevKit
Since
1.0
bool revkit::window_optimization ( circuit &  circ,
const circuit &  base,
properties::ptr  settings = properties::ptr(),
properties::ptr  statistics = properties::ptr() 
)

Window Optimization.

This algorithm implements the window optimization approach as presented in [SWDD10]. The implementation is very generic and depends heavily on the functors defined in settings.

In a loop, a new window is selected using the select_window property, and in case a window was found, the optimization approach using the optimization property is applied.

The resulting new window is compared to the extracted one using the cost metric defined in the cost_function property.

Parameters
circOptimized circuit to be generated
baseOriginal circuit
settings
Setting Type Default Value
select_window select_window_func shift_window_selection()
Functor which is used to select the windows to optimize.
optimization optimization_func resynthesis_optimization()
Functor used to optimize the selected window.
cost_function cost_function costs_by_circuit_func( gate_costs() )
Cost function to determine whether the optimized circuit is cheaper.
statistics
Information Type Description
runtime double Run-time consumed by the algorithm in CPU seconds.
Returns
true on success
Author
RevKit
Since
1.0
optimization_func revkit::window_optimization_func ( properties::ptr  settings = properties::ptr(new properties()),
properties::ptr  statistics = properties::ptr(new properties()) 
)

Functor for the window_optimization algorithm.

Parameters
settingsSettings (see window_optimization)
statisticsStatistics (see window_optimization)
Returns
A functor which complies with the optimization_func interface
Author
RevKit
Since
1.0
void revkit::write_blif ( const circuit &  circ,
std::ostream &  os = std::cout,
const write_blif_settings &  settings = write_blif_settings() 
)

Writes a circuit to a BLIF file.

This function writes the circuit to a BLIF file. Therefore, it is required that the circuit has names for all its inputs and outputs.

Parameters
circCircuit
osOutput stream where to write the result to. Default is STDOUT.
settingsSettings
Author
RevKit
Since
1.0
void revkit::write_realization ( const circuit &  circ,
std::ostream &  os,
const write_realization_settings &  settings = write_realization_settings() 
)

Writes a circuit as RevLib realization to an output stream.

This method takes a circuit and writes it to an output stream. Custom settings can be controlled via the settings parameter, which has default values if not set explicitely.

It may be more convenient to use the write_realization(const circuit&, const std::string&, const write_realization_settings&, std::string*) function which takes a filename as parameter instead of an output stream.

This function can be useful when dumping to e.g. STDOUT.

Example

The following example writes a circuit to STDOUT.

circuit circ;
write_realization( circ, std::cout );
Parameters
circCircuit to write
osOutput stream
settingsSettings (see write_realization_settings)
Author
RevKit
Since
1.0
bool revkit::write_realization ( const circuit &  circ,
const std::string &  filename,
const write_realization_settings &  settings = write_realization_settings(),
std::string *  error = 0 
)

Writes a circuit as RevLib realization to a file.

This is a wrapper function for write_realization(const circuit&, std::ostream&, const write_realization_settings&) and takes a filename as paramter. The forth parameter is a pointer to a string which can contain an error message in case the function call fails. This can only be the case when the file cannot be opened for writing.

Example

The following example reads a realization from an existing file, changes its version and header and writes it back to the the same file.

circuit circ;
std::string filename = "circuit.real";
std::string error;
if ( !read_realization( circ, filename, &error ) )
{
std::cerr << error << std::endl;
exit( 1 );
}
write_realization_settings settings;
settings.version = "2.0";
settings.header = "Reversible Benchmarks\n(c) University";
if ( !write_realization( circ, filename, settings, &error ) )
{
std::cerr << error << std::endl;
}
Parameters
circCircuit to write
filenameFilename of the file to be created. The fill will be overwritten in case it is already existing
settingsSettings (see write_realization_settings)
errorIf not-null, an error message is written to this parameter in case the function fails
Returns
true on success, false otherwise
Author
RevKit
Since
1.0
bool revkit::write_specification ( const binary_truth_table &  spec,
const std::string &  filename,
const write_specification_settings &  settings = write_specification_settings() 
)

Writes a truth table to a RevLib specification file.

Parameters
specSpecification
filenameFile-name to write the specification to
settingsSettings
Returns
true on success, false otherwise
void revkit::write_verilog ( const circuit &  circ,
std::ostream &  os = std::cout,
const write_verilog_settings &  settings = write_verilog_settings() 
)

Writes a circuit to a Verilog file.

This function dumps the circuit as a Verilog file.

Parameters
circCircuit
osOutput Stream to write to
settingsSettings
Author
RevKit
Since
1.1

Generated on Tue Apr 16 2013 08:12:02 for RevKit by doxygen 1.8.3.1