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... | |
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... | |
gate & | append_toffoli (circuit &circ, const gate::line_container &controls, const gate::line &target) |
Helper function for appending a Toffoli gate. More... | |
gate & | append_fredkin (circuit &circ, const gate::line_container &controls, const gate::line &target1, const gate::line &target2) |
Helper function for appending a Fredkin gate. More... | |
gate & | append_peres (circuit &circ, const gate::line &control, const gate::line &target1, const gate::line &target2) |
Helper function for appending a Peres gate. More... | |
gate & | append_cnot (circuit &circ, const gate::line &control, const gate::line &target) |
Helper function for appending a CNOT gate. More... | |
gate & | append_v (circuit &circ, const gate::line &control, const gate::line &target) |
Helper function for appending a V gate. More... | |
gate & | append_vplus (circuit &circ, const gate::line &control, const gate::line &target) |
Helper function for appending a V+ gate. More... | |
gate & | append_not (circuit &circ, const gate::line &target) |
Helper function for appending a NOT gate. More... | |
gate & | 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. 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... | |
gate & | prepend_toffoli (circuit &circ, const gate::line_container &controls, const gate::line &target) |
Helper function for prepending a Toffoli gate. More... | |
gate & | prepend_fredkin (circuit &circ, const gate::line_container &controls, const gate::line &target1, const gate::line &target2) |
Helper function for prepending a Fredkin gate. More... | |
gate & | prepend_peres (circuit &circ, const gate::line &control, const gate::line &target1, const gate::line &target2) |
Helper function for prepending a Peres gate. More... | |
gate & | prepend_cnot (circuit &circ, const gate::line &control, const gate::line &target) |
Helper function for prepending a CNOT gate. More... | |
gate & | prepend_v (circuit &circ, const gate::line &control, const gate::line &target) |
Helper function for prepending a V gate. More... | |
gate & | prepend_vplus (circuit &circ, const gate::line &control, const gate::line &target) |
Helper function for prepending a V+ gate. More... | |
gate & | prepend_not (circuit &circ, const gate::line &target) |
Helper function for prepending a NOT gate. More... | |
gate & | 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. 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... | |
gate & | insert_toffoli (circuit &circ, unsigned n, const gate::line_container &controls, const gate::line &target) |
Helper function for inserting a Toffoli gate. More... | |
gate & | 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. More... | |
gate & | 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. More... | |
gate & | insert_cnot (circuit &circ, unsigned n, const gate::line &control, const gate::line &target) |
Helper function for inserting a CNOT gate. More... | |
gate & | insert_v (circuit &circ, unsigned n, const gate::line &control, const gate::line &target) |
Helper function for inserting a V gate. More... | |
gate & | insert_vplus (circuit &circ, unsigned n, const gate::line &control, const gate::line &target) |
Helper function for inserting a V+ gate. More... | |
gate & | insert_not (circuit &circ, unsigned n, const gate::line &target) |
Helper function for inserting a NOT gate. More... | |
gate & | 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. 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 > | |
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... | |
Main namespace.
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
Empty circuit with 3 lines
Sub-circuit from circ
including gates [2,4)
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()
|
Constant input line with value 0 | '0' | constant( 0 )
|
Constant input line with value 1 | '1' | constant( 1 )
|
This example demonstrates how to access the constant values.
typedef boost::variant<costs_by_circuit_func, costs_by_gate_func> cost_function |
Cost Function type.
It can either be a costs_by_circuit_func or a costs_by_gate_func
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.
typedef boost::function<cost_t( const circuit& circ )> costs_by_circuit_func |
Functor for cost function measured by the whole circuit.
typedef boost::function<cost_t( const gate& gate, unsigned lines )> costs_by_gate_func |
Functor for cost function measured by each gate.
typedef std::vector< std::pair < boost::dynamic_bitset<>, boost::dynamic_bitset<> > > counterexample |
Datastructure for counterexamples.
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).
typedef functor<bool(circuit&, const circuit&)> decomposition_func |
Functor for decomposing a reversible circuit into a quantum circuit.
typedef functor<bool(binary_truth_table&, const binary_truth_table&)> embedding_func |
Functor for embedding a binary truth table in place.
typedef functor<bool (circuit const&, circuit const& impl)> equivalence_func |
Functor for equivalence checker functions.
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.
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
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.
Hierarchy Tree.
This tree is used to store the hierarchy of a tree. It is based on the hierarchy_graph
typedef functor<bool(std::vector<boost::dynamic_bitset<> >&, const circuit&, const std::vector<boost::dynamic_bitset<> >& )> multi_step_simulation_func |
Multi step simulation functor.
typedef functor<bool(circuit&, const circuit&)> optimization_func |
Optimization functor.
typedef functor<bool(circuit&, const std::string&)> pla_blif_synthesis_func |
Functor for synthesis based on a file-name (PLA or BLIF)
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.
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.
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.
typedef functor<bool(boost::dynamic_bitset<>&, const circuit&, const boost::dynamic_bitset<>&)> simulation_func |
Simulation functor.
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.
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.
typedef functor<bool(circuit&, const binary_truth_table&)> truth_table_synthesis_func |
Functor for synthesis based on a truth table.
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.
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.
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.
anonymous enum |
Flags for the growth limit in kfdd_synthesis_settings.
anonymous enum |
Flags for the sifting method.
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.
circ | Circuit |
input | Name of the input of the line |
output | Name of the output of the line |
c | Constant value of that line (Default: Not constant) |
g | If true, line is a garbage line |
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.
circ | Optimized circuit to be generated | ||||||||
base | Original circuit | ||||||||
settings |
| ||||||||
statistics |
|
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.
settings | Settings (see adding_lines) |
statistics | Statistics (see adding_lines) |
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
.
circ | Destination circuit |
src | Source circuit |
controls | Controls, which are added to each gate in src (introduced in version 1.1) |
gate& revkit::append_cnot | ( | circuit & | circ, |
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for appending a CNOT gate.
circ | Circuit |
control | Control Line |
target | Target Line |
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.
circ | Circuit |
controls | Control Lines |
target1 | Target Line 1 |
target2 | Target Line 2 |
control_line_adder revkit::append_fredkin | ( | circuit & | circ | ) |
Helper function for appending a Fredkin gate using the control_line_adder.
circ | Circuit |
control_line_adder revkit::append_gate | ( | circuit & | circ, |
const boost::any & | tag | ||
) |
Helper function for appending a generic gate using the control_line_adder.
circ | Circuit |
tag | Gate type tag |
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.
circ | Circuit |
module_name | Name of the module (already added to the circuit) |
controls | Control Lines |
targets | Target Lines (has to be a ordered vector for the mapping to the module lines) |
gate& revkit::append_not | ( | circuit & | circ, |
const gate::line & | target | ||
) |
Helper function for appending a NOT gate.
circ | Circuit |
target | Target Line |
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.
circ | Circuit |
control | Control Line |
target1 | Target Line 1 |
target2 | Target Line 2 |
gate& revkit::append_toffoli | ( | circuit & | circ, |
const gate::line_container & | controls, | ||
const gate::line & | target | ||
) |
Helper function for appending a Toffoli gate.
circ | Circuit |
controls | Control Lines |
target | Target Line |
control_line_adder revkit::append_toffoli | ( | circuit & | circ | ) |
Helper function for appending a Toffoli gate using the control_line_adder.
circ | Circuit |
gate& revkit::append_v | ( | circuit & | circ, |
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for appending a V gate.
circ | Circuit |
control | Control Line |
target | Target Line |
gate& revkit::append_vplus | ( | circuit & | circ, |
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for appending a V+ gate.
circ | Circuit |
control | Control Line |
target | Target Line |
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.
circ | The circuit to be constructed | |||||||||||||||||||||||
filename | A PLA file | |||||||||||||||||||||||
settings |
| |||||||||||||||||||||||
statistics |
|
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.
settings | Settings (see bdd_synthesis_func) |
statistics | Statistics (see bdd_synthesis_func) |
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
.
circ | Circuit |
tree | Hierarchy Tree |
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.
circ | Circuit to be simulated |
spec | Empty truth table to be constructed |
simulation | Simulation function object |
void revkit::clear_circuit | ( | circuit & | circ | ) |
Clears the circuit circ
.
This function clears all lines, gates and meta-data in a circuit.
circ | Circuit |
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.
g | Gate |
result | Iterator to store the lines as gate::line type |
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.
src | Source circuit |
dest | Destination circuit |
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.
spec | Truth Table |
circ | Circuit |
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
.
base | Source circuit |
circ | Destination circuit |
settings | Settings for copy_metadata (since 1.2) |
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.
circ | Circuit |
f | Cost function |
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.
os | Output stream to write the image to |
circ | Circuit |
settings | The settings for painting which provides as well the painting methods |
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.
filename | File-name |
circ | Circuit |
settings | The settings for painting which provides as well the painting methods |
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.
p | Pattern class |
circ | Circuit to be simulated |
sim | Empty vector which is filled with input assignments for every step |
init | Map which contains the initial assignment for state signals |
error | If not null, the string targeted by the pointer is assigned with an error message |
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.
spec | Embedded specification (it can be the same as base to embed in place) | |||||||||||||
base | Specification to be embedded | |||||||||||||
settings |
| |||||||||||||
statistics |
|
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.
settings | Settings (see embed_truth_table) |
statistics | Statistics (see embed_truth_table) |
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].
spec | Circuit (Specification) | |||||||||||||
impl | Circuit to be verified (Implementation) | |||||||||||||
settings |
| |||||||||||||
statistics |
|
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.
settings | Settings (see equivalence_check) |
statistics | Statistics (see equivalence_check) |
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.
circ | Circuit to be generated. | ||||||||||||||||||
filename | A file-name of a function as ESOP PLA representation. | ||||||||||||||||||
settings |
| ||||||||||||||||||
statistics |
|
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.
settings | Settings (see esop_synthesis) |
statistics | Statistics (see esop_synthesis) |
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].
circ | Empty Circuit | ||||||||||||||||||
spec | Function Specification (has to be fully specified) | ||||||||||||||||||
settings |
| ||||||||||||||||||
statistics |
|
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.
settings | Settings (see exact_synthesis) |
statistics | Statistics (see exact_synthesis) |
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
.
base | Base circuit |
circ | Newly created circuit, extended from base . Needs to be empty. |
num_lines | New number of lines |
filter | Mapping for calculating the new line indices. |
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.
base | Base circuit. Needs to be a subcircuit. |
circ | Newly created circuit, extended from base . Needs to be empty. |
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.
spec | Truth table |
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.
src | Gate |
line_size | Number of lines in the gate |
result | Iterator to add empty lines of type gate::line |
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.
src | Gate |
line_size | Number of lines in the gate |
lines | A gate::line_container to insert the empty lines |
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.
first | Begin iterator of the gates (inclusive) |
last | End iterator of the gates (exclusive) |
line_size | Number of lines for the gates |
result | Iterator to add empty lines of type gate::line |
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.
circ | Circuit |
result | Iterator to add empty lines of type gate::line |
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.
src | Gate |
result | Iterator to add non empty lines of type gate::line |
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.
first | Begin iterator of the gates (inclusive) |
last | End iterator of the gates (exclusive) |
result | Iterator to add non empty lines of type gate::line |
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.
circ | Circuit |
result | Iterator to add non empty lines of type gate::line |
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
.
base | Circuit to flatten (with modules) |
circ | Resulting circuit (without modules) |
keep_meta_data | Specifies, whether the RevLib 2.0 meta data such as buses should be kept (since 1.2) |
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.
tt | Truth table |
dc_value | The don't care value for the truth table |
is_reversible | If true, number of outputs has to match number of inputs. Default value is true. |
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.
tt | Truth table |
is_reversible | If true, number of outputs has to match number of inputs. Default value is true. |
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.
settings | A smart pointer to a properties instance or an empty smart pointer |
k | Key of the property to be accessed |
default_value | A default_value as fall back option in case the smart pointer is empty or the key does not exist. |
k
or the default_value
.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
.
circ | Destination circuit |
pos | Position where to insert |
src | Source circuit |
controls | Controls, which are added to each gate in src (introduced in version 1.1) |
gate& revkit::insert_cnot | ( | circuit & | circ, |
unsigned | n, | ||
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for inserting a CNOT gate.
circ | Circuit |
n | Index to insert the gate |
control | Control Line |
target | Target Line |
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.
circ | Circuit |
n | Index to insert the gate |
controls | Control Lines |
target1 | Target Line 1 |
target2 | Target Line 2 |
control_line_adder revkit::insert_fredkin | ( | circuit & | circ, |
unsigned | n | ||
) |
Helper function for inserting a Fredkin gate using the control_line_adder.
circ | Circuit |
n | Index to insert the gate |
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.
circ | Circuit |
n | Index to insert the gate |
tag | Gate type tag |
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.
circ | Circuit |
n | Index to insert the gate |
module_name | Name of the module (already added to the circuit) |
controls | Control Lines |
targets | Target Lines (has to be a ordered vector for the mapping to the module lines) |
gate& revkit::insert_not | ( | circuit & | circ, |
unsigned | n, | ||
const gate::line & | target | ||
) |
Helper function for inserting a NOT gate.
circ | Circuit |
n | Index to insert the gate |
target | Target Line |
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.
circ | Circuit |
n | Index to insert the gate |
control | Control Line |
target1 | Target Line 1 |
target2 | Target Line 2 |
gate& revkit::insert_toffoli | ( | circuit & | circ, |
unsigned | n, | ||
const gate::line_container & | controls, | ||
const gate::line & | target | ||
) |
Helper function for inserting a Toffoli gate.
circ | Circuit |
n | Index to insert the gate |
controls | Control Lines |
target | Target Line |
control_line_adder revkit::insert_toffoli | ( | circuit & | circ, |
unsigned | n | ||
) |
Helper function for inserting a Toffoli gate using the control_line_adder.
circ | Circuit |
n | Index to insert the gate |
gate& revkit::insert_v | ( | circuit & | circ, |
unsigned | n, | ||
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for inserting a V gate.
circ | Circuit |
n | Index to insert the gate |
control | Control Line |
target | Target Line |
gate& revkit::insert_vplus | ( | circuit & | circ, |
unsigned | n, | ||
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for inserting a V+ gate.
circ | Circuit |
n | Index to insert the gate |
control | Control Line |
target | Target Line |
bool revkit::is_fredkin | ( | const gate & | g | ) |
Returns whether a gate is a Fredkin gate.
g | Gate |
g
is a Fredkin gatebool revkit::is_module | ( | const gate & | g | ) |
Returns whether a gate is a module.
g | Gate |
g
is a modulebool revkit::is_peres | ( | const gate & | g | ) |
Returns whether a gate is a Peres gate.
g | Gate |
g
is a Peres gatebool revkit::is_toffoli | ( | const gate & | g | ) |
Returns whether a gate is a Toffoli gate.
g | Gate |
g
is a Toffoli gatebool 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().
operand | A variable of type boost::any |
operand
is of type T
.bool revkit::is_v | ( | const gate & | g | ) |
Returns whether a gate is a V gate.
g | Gate |
g
is a V gatebool revkit::is_vplus | ( | const gate & | g | ) |
Returns whether a gate is a V+ gate.
g | Gate |
g
is a V+ gatebool 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.
circ | Empty circuit, to be constructed by the algorithm | |||||||||||||||||||||||||||||||||
filename | A functional representation as BLIF or PLA file | |||||||||||||||||||||||||||||||||
settings |
| |||||||||||||||||||||||||||||||||
statistics |
|
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.
settings | Settings (see kfdd_synthesis_func) |
statistics | Statistics (see kfdd_synthesis_func) |
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.
circ | Optimized circuit to be created (needs to be empty) | ||||||||||||||||||||||||||||
base | Base circuit which should be optimized | ||||||||||||||||||||||||||||
settings |
| ||||||||||||||||||||||||||||
statistics |
|
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.
settings | Settings (see line_reduction) |
statistics | Statistics (see line_reduction) |
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.
settings | Settings (see lnn_optimization) |
statistics | Statistics (see lnn_optimization) |
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.
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.
number | Number to be converted as a cube |
bw | Bit-width of the cube |
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.
os | The stream to dump the circuit |
circ | Circuit |
os
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
os | The output stream |
spec | The truth table |
os
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.
output | Output pattern | |||||||||||||
circ | Circuit to be simulated | |||||||||||||
input | Input pattern | |||||||||||||
settings |
| |||||||||||||
statistics |
|
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.
settings | Settings (see partial_simulation) |
statistics | Statistics (see partial_simulation) |
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
.
circ | Destination circuit |
src | Source circuit |
controls | Controls, which are added to each gate in src (introduced in version 1.1) |
gate& revkit::prepend_cnot | ( | circuit & | circ, |
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for prepending a CNOT gate.
circ | Circuit |
control | Control Line |
target | Target Line |
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.
circ | Circuit |
controls | Control Lines |
target1 | Target Line 1 |
target2 | Target Line 2 |
control_line_adder revkit::prepend_fredkin | ( | circuit & | circ | ) |
Helper function for prepending a Fredkin gate using the control_line_adder.
circ | Circuit |
control_line_adder revkit::prepend_gate | ( | circuit & | circ, |
const boost::any & | tag | ||
) |
Helper function for prepending a generic gate using the control_line_adder.
circ | Circuit |
tag | Gate type tag |
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.
circ | Circuit |
module_name | Name of the module (already added to the circuit) |
controls | Control Lines |
targets | Target Lines (has to be a ordered vector for the mapping to the module lines) |
gate& revkit::prepend_not | ( | circuit & | circ, |
const gate::line & | target | ||
) |
Helper function for prepending a NOT gate.
circ | Circuit |
target | Target Line |
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.
circ | Circuit |
control | Control Line |
target1 | Target Line 1 |
target2 | Target Line 2 |
gate& revkit::prepend_toffoli | ( | circuit & | circ, |
const gate::line_container & | controls, | ||
const gate::line & | target | ||
) |
Helper function for prepending a Toffoli gate.
circ | Circuit |
controls | Control Lines |
target | Target Line |
control_line_adder revkit::prepend_toffoli | ( | circuit & | circ | ) |
Helper function for prepending a Toffoli gate using the control_line_adder.
circ | Circuit |
gate& revkit::prepend_v | ( | circuit & | circ, |
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for prepending a V gate.
circ | Circuit |
control | Control Line |
target | Target Line |
gate& revkit::prepend_vplus | ( | circuit & | circ, |
const gate::line & | control, | ||
const gate::line & | target | ||
) |
Helper function for prepending a V+ gate.
circ | Circuit |
control | Control Line |
target | Target Line |
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.
circ | Circuit |
settings | Settings (see print_circuit_settings) |
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.
os | Output stream where to print the information |
circ | Circuit to obtain information from |
runtime | Optional, if a run-time has been measured, it will be displayed as well |
settings | Settings for printing the statistics (with templates) |
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.
circ | Circuit to obtain information from |
runtime | Optional, if a run-time has been measured, it will be displayed as well |
settings | Settings for printing the statistics (with templates) |
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.
circ | Quantum circuit to be created | ||||||||||||||||||
base | Reversible circuit | ||||||||||||||||||
settings |
| ||||||||||||||||||
statistics |
|
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.
settings | Settings (see quantum_decomposition) |
statistics | Statistics (see quantum_decomposition) |
bool revkit::read_pattern | ( | pattern & | p, |
const std::string & | filename, | ||
std::string * | error = 0 |
||
) |
I/O routine for reading a pattern (*.sim) file.
p | Empty pattern class |
filename | File-name of the pattern file |
error | If not null, the string targeted by the pointer is assigned with an error message |
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.
spec | The truth table |
filename | File-name to read PLA from |
settings | Settings for read_pla |
error | If not 0, an error message is assigned when the function returns false |
bool revkit::read_pla_to_bdd | ( | BDDTable & | bdd, |
const std::string & | filename | ||
) |
Reads a BDD from a PLA file.
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.
circ | circuit to be constructed |
in | input stream containing the realization |
error | A pointer to a string. In case the parsing fails, and error is not null, a error message is stored |
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.
The following code demonstrates how to read a realization from a file given by its filename into a circuit.
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.
circ | circuit to be constructed |
filename | filename of the realization |
error | A pointer to a string. In case the parsing fails, and error is not null, a error message is stored |
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.
spec | truth table to be constructed |
in | input stream containing the specification |
error | A pointer to a string. In case the parsing fails, and error is not null, a error message is stored |
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.
The following code demonstrates how to read a specification from a file given by its filename into a truth table.
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.
spec | truth table to be constructed |
filename | filename of the specification |
error | A pointer to a string. In case the parsing fails, and error is not null, a error message is stored |
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].
circ | Empty Circuit | ||||||||
spec | Function Specification (has to be fully specified) | ||||||||
settings |
| ||||||||
statistics |
|
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.
settings | Settings (see reed_muller_synthesis) |
statistics | Statistics (see reed_muller_synthesis) |
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.
src | Source circuit |
dest | Destination circuit |
void revkit::reverse_circuit | ( | circuit & | circ | ) |
Reverse a circuit in-place.
This function reverses a circuit circ
in-place.
circ | Circuit to be reversed |
const char* revkit::revkit_version | ( | ) |
Returns RevKit version.
Returns the current RevKit version
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.
in | Input stream containing the file |
reader | An instance of the revlib_processor |
base_directory | A 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 |
error | A pointer to a string. In case the parsing fails, and error is not null, a error message is stored |
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.
g1 | First gate |
g2 | Second gate |
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.
outputs | Output patterns | ||||||||||||||||||
circ | Circuit to be simulated | ||||||||||||||||||
inputs | List of input pattern. In this pattern only the values for all input signals and no constant values or state values are set. | ||||||||||||||||||
settings |
| ||||||||||||||||||
statistics |
|
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.
settings | Settings (see sequential_simulation) |
statistics | Statistics (see sequential_simulation) |
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.
statistics | A smart pointer to a properties instance or an empty smart pointer |
error | An error message, which should be written to the key error if the smart pointer statistics can be de-referenced. |
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.
output | Output pattern. The index of the pattern corresponds to the line index. | |||||||||||||
g | Gate to be simulated | |||||||||||||
input | Input 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 |
| |||||||||||||
statistics |
|
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.
output | Output pattern. The index of the pattern corresponds to the line index. | |||||||||||||
first | Iterator pointing to the first gate. | |||||||||||||
last | Iterator pointing to the last gate (exclusive). | |||||||||||||
input | Input 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 |
| |||||||||||||
statistics |
|
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.
output | Output pattern. The index of the pattern corresponds to the line index. | |||||||||||||
circ | Circuit to be simulated. | |||||||||||||
input | Input 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 |
| |||||||||||||
statistics |
|
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.
settings | Settings (see simple_simulation) |
statistics | Statistics (see simple_simulation) |
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.
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.
circ | Circuit, must be empty, is filled with gate by the algorithm | ||||||||||||||||||||||||||||
spec | Truth table used for synthesis | ||||||||||||||||||||||||||||
settings |
| ||||||||||||||||||||||||||||
statistics |
|
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.
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.
g | Gate |
result | Iterator to store the lines as gate::line type |
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].
circ | Empty Circuit | ||||||||
spec | Function Specification (has to be fully specified) | ||||||||
settings |
| ||||||||
statistics |
|
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.
settings | Settings (see transformation_based_synthesis) |
statistics | Statistics (see transformation_based_synthesis) |
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
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.
settings | Settings (see transposition_based_synthesis) |
statistics | Statistics (see transposition_based_synthesis) |
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.
circ | An empty circuit that will be created. The number of lines of the circuit must coincide with the length of the input and output assignments. |
inputs | Input Assignment |
outputs | Output Assignment |
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.
cube | The cube to be converted |
cube
in numerical representationbool 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.
circ | Optimized circuit to be generated | ||||||||||||||||||
base | Original circuit | ||||||||||||||||||
settings |
| ||||||||||||||||||
statistics |
|
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.
settings | Settings (see window_optimization) |
statistics | Statistics (see window_optimization) |
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.
circ | Circuit |
os | Output stream where to write the result to. Default is STDOUT. |
settings | Settings |
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.
The following example writes a circuit to STDOUT.
circ | Circuit to write |
os | Output stream |
settings | Settings (see write_realization_settings) |
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.
The following example reads a realization from an existing file, changes its version and header and writes it back to the the same file.
circ | Circuit to write |
filename | Filename of the file to be created. The fill will be overwritten in case it is already existing |
settings | Settings (see write_realization_settings) |
error | If not-null, an error message is written to this parameter in case the function fails |
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.
spec | Specification |
filename | File-name to write the specification to |
settings | Settings |
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.
circ | Circuit |
os | Output Stream to write to |
settings | Settings |