Input Parsing
Read logic networks, truth tables, or FCN layouts from file into data types.
Logic Networks
Header: fiction/io/network_reader.hpp
-
template<typename NtkPtr>
class network_reader Helper class to read directories of mockturtle networks of certain types.
- Template Parameters:
NtkPtr – Pointer type to a logic network.
Public Functions
-
inline network_reader(const std::string_view &filename, std::ostream &o)
Standard constructor. Reads and constructs logic networks. May throw.
- Parameters:
filename – Path to the file or folder of files to read.
out – Output stream to write status updates into.
- mnt.pyfiction.read_technology_network(filename: str) mnt.pyfiction.pyfiction.technology_network
Truth Tables
Header: fiction/io/tt_reader.hpp
-
template<typename TT = kitty::dynamic_truth_table>
class tt_reader Simple reader to parse truth tables from files. The files must be organized as follows: Each line consists of a truth table in hexadecimal form plus its corresponding Boolean expression. The two are separated by a space.
This format is used by, e.g., Alan Mishchenko for his DSD functions: https://people.eecs.berkeley.edu/~alanmi/temp5/
Public Functions
-
inline explicit tt_reader(std::istream &stream)
Standard constructor. Reads the given stream into a vector of lines.
- Parameters:
stream – Stream to parse.
-
inline explicit tt_reader(const std::string &filename)
Standard constructor. Reads the given file into a vector of lines.
- Parameters:
filename – File to parse.
-
inline explicit tt_reader(std::istream &stream)
Gate-level Layouts
Can be used to read gate-level layout files (.fgl
) as offered by MNT Bench.
Header: fiction/io/read_fgl_layout.hpp
-
template<typename Lyt>
Lyt fiction::read_fgl_layout(std::istream &is, const std::string_view &name = "") Reads a gate-level layout from an FGL file provided as an input stream.
May throw an
fgl_parsing_error
if the FGL file is malformed.- Template Parameters:
Lyt – The layout type to be created from an input.
- Parameters:
is – The input stream to read from.
name – The name to give to the generated layout.
-
template<typename Lyt>
void fiction::read_fgl_layout(Lyt &lyt, std::istream &is) Reads a gate-level layout from an FGL file provided as an input stream.
May throw an
fgl_parsing_error
if the FGL file is malformed.This is an in-place version of
read_fgl_layout
that utilizes the given layout as a target to write to.- Template Parameters:
Lyt – The layout type to be used as input.
- Parameters:
lyt – The layout to write to.
is – The input stream to read from.
-
template<typename Lyt>
Lyt fiction::read_fgl_layout(const std::string_view &filename, const std::string_view &name = "") Reads a gate-level layout from an FGL file provided as a file name.
May throw an
fgl_parsing_error
if the FGL file is malformed.- Template Parameters:
Lyt – The layout type to be created from an input.
- Parameters:
filename – The file name to open and read from.
name – The name to give to the generated layout.
-
template<typename Lyt>
void fiction::read_fgl_layout(Lyt &lyt, const std::string_view &filename) Reads a gate-level layout from an FGL file provided as a file name.
May throw an
fgl_parsing_error
if the FGL file is malformed.This is an in-place version of
read_fgl_layout
that utilizes the given layout as a target to write to.- Template Parameters:
Lyt – The layout type to be used as input.
- Parameters:
lyt – The layout to write to.
filename – The file name to open and read from.
-
class fgl_parsing_error : public std::runtime_error
Exception thrown when an error occurs during parsing of a .fgl file containing a gate-level layout.
- mnt.pyfiction.read_cartesian_fgl_layout(filename: str, layout_name: str = '') mnt.pyfiction.pyfiction.cartesian_gate_layout
Reads a gate-level layout from an FGL file provided as a file name.
May throw an fgl_parsing_error if the FGL file is malformed.
- Template parameter
Lyt
: The layout type to be created from an input.
- Parameter
filename
: The file name to open and read from.
- Parameter
name
: The name to give to the generated layout.
- Template parameter
- mnt.pyfiction.read_shifted_cartesian_fgl_layout(filename: str, layout_name: str = '') mnt.pyfiction.pyfiction.shifted_cartesian_gate_layout
Reads a gate-level layout from an FGL file provided as a file name.
May throw an fgl_parsing_error if the FGL file is malformed.
- Template parameter
Lyt
: The layout type to be created from an input.
- Parameter
filename
: The file name to open and read from.
- Parameter
name
: The name to give to the generated layout.
- Template parameter
- mnt.pyfiction.read_hexagonal_fgl_layout(filename: str, layout_name: str = '') mnt.pyfiction.pyfiction.hexagonal_gate_layout
Reads a gate-level layout from an FGL file provided as a file name.
May throw an fgl_parsing_error if the FGL file is malformed.
- Template parameter
Lyt
: The layout type to be created from an input.
- Parameter
filename
: The file name to open and read from.
- Parameter
name
: The name to give to the generated layout.
- Template parameter
- class mnt.pyfiction.fgl_parsing_error
Cell-level Layouts
Header: fiction/io/read_sqd_layout.hpp
-
template<typename Lyt>
Lyt fiction::read_sqd_layout(std::istream &is, const std::string_view &name = "") Reads a cell-level SiDB layout from an sqd file provided as an input stream. The format is used by SiQAD (https://github.com/siqad/siqad).
If the provided cell-level layout type can represent SiDB defects, they will be parsed from the sqd file as well.
May throw an
sqd_parsing_exception
if the sqd file is malformed.- Template Parameters:
Lyt – The layout type to be created from an input. Must be an SiDB lattice cell-level SiDB layout.
- Parameters:
is – The input stream to read from.
name – The name to give to the generated layout.
- Returns:
The cell-level SiDB layout read from the sqd file.
-
template<typename Lyt>
void fiction::read_sqd_layout(Lyt &lyt, std::istream &is) Reads a cell-level SiDB layout from an sqd file provided as an input stream. The format is used by SiQAD (https://github.com/siqad/siqad).
If The provided cell-level layout type can represent SiDB defects, they will be parsed from the sqd file as well.
May throw an
sqd_parsing_exception
if the sqd file is malformed.This is an in-place version of read_sqd_layout that utilizes the given layout as a target to write to.
- Template Parameters:
Lyt – The layout type to be created from an input. Must be an SiDB lattice cell-level SiDB layout.
- Parameters:
lyt – The layout to write to.
is – The input stream to read from.
-
template<typename Lyt>
Lyt fiction::read_sqd_layout(const std::string_view &filename, const std::string_view &name = "") Reads a cell-level SiDB layout from an sqd file provided as a file name. The format is used by SiQAD (https://github.com/siqad/siqad).
If The provided cell-level layout type can represent SiDB defects, they will be parsed from the sqd file as well.
May throw an
sqd_parsing_exception
if the sqd file is malformed.- Template Parameters:
Lyt – The layout type to be created from an input. Must be an SiDB lattice cell-level SiDB layout.
- Parameters:
filename – The file name to open and read from.
name – The name to give to the generated layout.
-
template<typename Lyt>
void fiction::read_sqd_layout(Lyt &lyt, const std::string_view &filename) Reads a cell-level SiDB layout from an sqd file provided as a file name. The format is used by SiQAD (https://github.com/siqad/siqad).
If The provided cell-level layout type can represent SiDB defects, they will be parsed from the sqd file as well.
May throw an
sqd_parsing_exception
if the sqd file is malformed.This is an in-place version of
read_sqd_layout
that utilizes the given layout as a target to write to.- Template Parameters:
Lyt – The layout type to be created from an input. Must be an SiDB lattice cell-level SiDB layout.
- Parameters:
lyt – The layout to write to.
filename – The file name to open and read from.
-
class sqd_parsing_error : public std::runtime_error
Exception thrown when an error occurs during parsing of an SQD file.
- mnt.pyfiction.read_sqd_layout_100(filename: str, layout_name: str = '') mnt.pyfiction.pyfiction.sidb_100_lattice
Reads a cell-level SiDB layout from an sqd file provided as a file name. The format is used by SiQAD (https://github.com/siqad/siqad).
If The provided cell-level layout type can represent SiDB defects, they will be parsed from the sqd file as well.
May throw an sqd_parsing_exception if the sqd file is malformed.
- Template parameter
Lyt
: The layout type to be created from an input. Must be an SiDB lattice cell-level SiDB layout.
- Parameter
filename
: The file name to open and read from.
- Parameter
name
: The name to give to the generated layout.
- Template parameter
- mnt.pyfiction.read_sqd_layout_111(filename: str, layout_name: str = '') mnt.pyfiction.pyfiction.sidb_111_lattice
Reads a cell-level SiDB layout from an sqd file provided as a file name. The format is used by SiQAD (https://github.com/siqad/siqad).
If The provided cell-level layout type can represent SiDB defects, they will be parsed from the sqd file as well.
May throw an sqd_parsing_exception if the sqd file is malformed.
- Template parameter
Lyt
: The layout type to be created from an input. Must be an SiDB lattice cell-level SiDB layout.
- Parameter
filename
: The file name to open and read from.
- Parameter
name
: The name to give to the generated layout.
- Template parameter
- class mnt.pyfiction.sqd_parsing_error
Header: fiction/io/read_fqca_layout.hpp
-
template<typename Lyt>
Lyt fiction::read_fqca_layout(std::istream &is, const std::string_view &layout_name = "") Reads a cell-level QCA layout from an fqca file provided as an input stream. The format is used by QCA-STACK by Willem Lambooy (https://github.com/wlambooy/QCA-STACK).
May throw an unsupported_character_exception, undefined_cell_label_exception, or unrecognized_cell_definition_exception.
- Template Parameters:
Lyt – The layout type to be created from an input. Must be a clocked cell-level QCA layout.
- Parameters:
is – The input stream to read from.
layout_name – The name to give to the generated layout.
-
template<typename Lyt>
Lyt fiction::read_fqca_layout(const std::string_view &filename, const std::string_view &layout_name = "") Reads a cell-level QCA layout from an fqca file provided as a file name. The format is used by QCA-STACK by Willem Lambooy (https://github.com/wlambooy/QCA-STACK).
May throw an unsupported_character_exception, undefined_cell_label_exception, or unrecognized_cell_definition_exception.
- Template Parameters:
Lyt – The layout type to be created from an input. Must be a clocked cell-level QCA layout.
- Parameters:
filename – The file name to open and read from.
layout_name – The name to give to the generated layout.
-
class unsupported_character_exception : public std::exception
-
class undefined_cell_label_exception : public std::exception
-
class unrecognized_cell_definition_exception : public std::exception
- mnt.pyfiction.read_fqca_layout(filename: str, layout_name: str = '') mnt.pyfiction.pyfiction.qca_layout
Reads a cell-level QCA layout from an fqca file provided as an input stream. The format is used by QCA-STACK by Willem Lambooy (https://github.com/wlambooy/QCA-STACK).
May throw an unsupported_character_exception, undefined_cell_label_exception, or unrecognized_cell_definition_exception.
- Template parameter
Lyt
: The layout type to be created from an input. Must be a clocked cell-level QCA layout.
- Parameter
is
: The input stream to read from.
- Parameter
layout_name
: The name to give to the generated layout.
- Template parameter
SiDB Surface Defects
Header: fiction/io/read_sidb_surface_defects.hpp
-
template<typename Lyt>
sidb_defect_surface<Lyt> fiction::read_sidb_surface_defects(std::istream &is, const std::string_view &name = "") Reads a defective SiDB surface from a text file provided as an input stream. The format is rudimentary and consists of a simple 2D array of integers representing defect indices printed by Python.
May throw a
missing_sidb_position_exception
or anunsupported_defect_index_exception
.Note
For testing purposes, a Python script that generates defective surfaces is provided in the
experiments/defect_aware_physical_design
directory.- Template Parameters:
Lyt – The layout type underlying the SiDB surface. Must be a cell-level SiDB layout.
- Parameters:
is – The input stream to read from.
name – The name to give to the generated layout.
-
template<typename Lyt>
sidb_defect_surface<Lyt> fiction::read_sidb_surface_defects(const std::string_view &filename, const std::string_view &name = "") Reads a defective SiDB surface from a text file provided as a file name. The format is rudimentary and consists of a simple 2D array of integers representing defect indices printed by Python.
May throw a
missing_sidb_position_exception
or anunsupported_defect_index_exception
.Note
For testing purposes, a Python script that generates defective surfaces is provided in the
experiments/defect_aware_physical_design
directory.- Template Parameters:
Lyt – The layout type underlying the SiDB surface. Must be a cell-level SiDB layout.
- Parameters:
filename – The file name to open and read from.
name – The name to give to the generated layout.
-
class unsupported_defect_index_exception : public std::exception
Exception thrown when an unsupported defect index is encountered in the parsed file.
-
class missing_sidb_position_exception : public std::exception
Exception thrown when a missing SiDB position is encountered in the parsed file.