Physical Simulation

Write cell-level layouts into physical simulator files for various technologies.

QCADesigner

Header: fiction/io/write_qca_layout.hpp

struct write_qca_layout_params

Parameters for writing QCADesigner layouts.

Public Members

bool create_inter_layer_via_cells = true

Create via cells in between each layer.

template<typename Lyt>
void fiction::write_qca_layout(const Lyt &lyt, std::ostream &os, write_qca_layout_params ps = {})

Writes a cell-level QCA layout to a qca file that is used by QCADesigner (https://waluslab.ece.ubc.ca/qcadesigner/), a physical simulator for the QCA technology platform.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Cell-level QCA layout type.

Parameters:
  • lyt – The layout to be written.

  • os – The output stream to write into.

  • ps – Parameters.

template<typename Lyt>
void fiction::write_qca_layout(const Lyt &lyt, const std::string_view &filename, write_qca_layout_params ps = {})

Writes a cell-level QCA layout to a qca file that is used by QCADesigner (https://waluslab.ece.ubc.ca/qcadesigner/), a physical simulator for the QCA technology platform.

This overload uses a file name to create and write into.

Template Parameters:

Lyt – Cell-level QCA layout type.

Parameters:
  • lyt – The layout to be written.

  • filename – The file name to create and write into. Should preferably use the .qca extension.

  • ps – Parameters.

QCA-STACK

Header: fiction/io/write_fqca_layout.hpp

struct write_fqca_layout_params

Parameters for writing FQCA layouts.

Public Members

bool create_inter_layer_via_cells = false

Create via cells in between each layer.

template<typename Lyt>
void fiction::write_fqca_layout(const Lyt &lyt, std::ostream &os, write_fqca_layout_params ps = {})

Writes a cell-level QCA layout to an fqca file provided as an output stream. The format is used by QCA-STACK by Willem Lambooy (https://github.com/wlambooy/QCA-STACK).

Might throw an out_of_cell_names_exception in case there are more I/O cells in the layout than lowercase + uppercase letters in the English alphabet.

Template Parameters:

Lyt – The layout type to be written. Must be a clocked cell-level QCA layout.

Parameters:
  • lyt – The cell-level QCA layout.

  • os – The output stream to write into.

  • ps – Parameters.

template<typename Lyt>
void fiction::write_fqca_layout(const Lyt &lyt, const std::string_view &filename, write_fqca_layout_params ps = {})

Writes a cell-level QCA layout to an fqca file provided as a file name. The format is used by QCA-STACK by Willem Lambooy (https://github.com/wlambooy/QCA-STACK).

Might throw an out_of_cell_names_exception in case there are more I/O cells in the layout than lowercase + uppercase letters in the English alphabet.

Template Parameters:

Lyt – The layout type to be written. Must be a clocked cell-level QCA layout.

Parameters:
  • lyt – The cell-level QCA layout.

  • filename – The file name to create and write into. Should preferably use the .fqca extension.

  • ps – Parameters.

class out_of_cell_names_exception : public std::out_of_range

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

ToPoliNano

Header: fiction/io/write_qcc_layout.hpp

struct write_qcc_layout_params

Parameters for writing QCC layouts.

Public Members

bool use_filename_as_component_name = false

Use the given filename as the component name inside the QCC file.

std::string_view filename = {}

Filename of the QCC file.

template<typename Lyt>
void fiction::write_qcc_layout(const Lyt &lyt, std::ostream &os, write_qcc_layout_params ps = {})

Writes a cell-level iNML layout to a qcc file that is used by ToPoliNano & MagCAD (https://topolinano.polito.it/), an EDA tool and a physical simulator for the iNML technology platform.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Cell-level iNML layout type.

Parameters:
  • lyt – The layout to be written.

  • os – The output stream to write into.

  • ps – Parameters.

template<typename Lyt>
void fiction::write_qcc_layout(const Lyt &lyt, const std::string_view &filename, write_qcc_layout_params ps = {})

Writes a cell-level iNML layout to a qcc file that is used by ToPoliNano & MagCAD (https://topolinano.polito.it/), an EDA tool and a physical simulator for the iNML technology platform.

This overload uses a file name to create and write into.

Template Parameters:

Lyt – Cell-level iNML layout type.

Parameters:
  • lyt – The layout to be written.

  • filename – The file name to create and write into. Should preferably use the .qcc extension.

  • ps – Parameters.

MagCAD & SCERPA

Header: fiction/io/write_qll_layout.hpp

template<typename Lyt>
void fiction::write_qll_layout(const Lyt &lyt, std::ostream &os)

Writes a cell-level QCA or iNML layout to a qll file that is used by ToPoliNano & MagCAD (https://topolinano.polito.it/), an EDA tool and a physical simulator for the iNML technology platform as well as SCERPA (https://ieeexplore.ieee.org/document/8935211), a physical simulator for the mQCA technology platform.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Cell-level QCA or iNML layout type.

Parameters:
  • lyt – The layout to be written.

  • os – The output stream to write into.

  • ps – Parameters.

template<typename Lyt>
void fiction::write_qll_layout(const Lyt &lyt, const std::string_view &filename)

Writes a cell-level QCA or iNML layout to a qll file that is used by ToPoliNano & MagCAD (https://topolinano.polito.it/), an EDA tool and a physical simulator for the iNML technology platform as well as SCERPA (https://ieeexplore.ieee.org/document/8935211), a physical simulator for the mQCA technology platform.

This overload uses a file name to create and write into.

Template Parameters:

Lyt – Cell-level iNML layout type.

Parameters:
  • lyt – The layout to be written.

  • filename – The file name to create and write into. Should preferably use the .qll extension.

  • ps – Parameters.

SiQAD

Header: fiction/io/write_sqd_layout.hpp

template<typename Lyt>
void fiction::write_sqd_layout(const Lyt &lyt, std::ostream &os)

Writes a cell-level SiDB or QCA layout to an sqd file that is used by SiQAD (https://github.com/siqad/siqad), a physical simulator for the SiDB technology platform.

If the provided cell-level layout type can represent SiDB defects, they will be written to the file as well.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Cell-level SiDB or QCA layout type.

Parameters:
  • lyt – The layout to be written.

  • os – The output stream to write into.

template<typename Lyt>
void fiction::write_sqd_layout(const Lyt &lyt, const std::string_view &filename)

Writes a cell-level SiDB or QCA layout to an sqd file that is used by SiQAD (https://github.com/siqad/siqad), a physical simulator for the SiDB technology platform.

If the provided cell-level layout type can represent SiDB defects, they will be written to the file as well.

This overload uses a file name to create and write into.

Template Parameters:

Lyt – Cell-level SiDB or QCA layout type.

Parameters:
  • lyt – The layout to be written.

  • filename – The file name to create and write into. Should preferably use the .sqd extension.

Header: fiction/io/write_sqd_sim_result.hpp

template<typename Lyt>
void fiction::write_sqd_sim_result(const sidb_simulation_result<Lyt> &sim_result, std::ostream &os)

Writes an SiDB simulation result to an XML file that is used by SiQAD (https://github.com/siqad/siqad), a physical simulator for the SiDB technology platform.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Cell-level SiDB layout type.

Parameters:
  • sim_result – The simulation result to write.

  • os – The output stream to write into.

template<typename Lyt>
void fiction::write_sqd_sim_result(const sidb_simulation_result<Lyt> &sim_result, const std::string_view &filename)

Writes an SiDB simulation result to an XML file that is used by SiQAD (https://github.com/siqad/siqad), a physical simulator for the SiDB technology platform.

This overload uses a file name to create and write into.

Template Parameters:

Lyt – Cell-level SiDB layout type.

Parameters:
  • sim_result – The simulation result to write.

  • filename – The file name to create and write into. Should preferably use the .xml extension.

Header: fiction/io/write_location_and_ground_state.hpp

template<typename Lyt>
void fiction::write_location_and_ground_state(const sidb_simulation_result<Lyt> &sim_result, std::ostream &os)

Writes the coordinates of all SiDBs of a layout together with the charge distribution of the ground state(s) to a file.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Cell-level SiDB layout type.

Parameters:
  • sim_result – The simulation result to write.

  • os – The output stream to write into.

template<typename Lyt>
void fiction::write_location_and_ground_state(const sidb_simulation_result<Lyt> &sim_result, const std::string_view &filename)

Writes the coordinates of all SiDBs of a layout together with the charge distribution of the ground state(s) to a file.

This overload uses a file name to create and write into.

Template Parameters:
  • Lyt – Cell-level SiDB layout type.

  • sim_result – The simulation result to write.

Parameters:

filename – The file name to create and write into.

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.

SiDB Operational Domain

Header: fiction/io/write_operational_domain.hpp

struct write_operational_domain_params

Parameters for writing an operational domain to a CSV file.

Public Members

std::string_view operational_tag = "operational"

The tag used to represent the operational value of a parameter set.

std::string_view non_operational_tag = "non-operational"

The tag used to represent the non-operational value of a parameter set.

inline void fiction::write_operational_domain(const operational_domain &opdom, std::ostream &os, const write_operational_domain_params &params = {})

Writes a CSV representation of an operational domain to the specified output stream. The data are written as rows, each corresponding to one set of simulation parameters and their corresponding operational status.

The output CSV format is as follows: X_DIMENSION, Y_DIMENSION, OPERATIONAL STATUS … subsequent rows for each set of simulation parameters.

The operational status is a binary value represented by specified tags in params indicating whether the simulation parameters are within the operational domain or not.

Parameters:
  • opdom – The operational domain to be written. It contains a mapping from sets of simulation parameters (represented as a pair of sweep parameters for the X and Y dimensions) to their operational status.

  • os – The output stream where the CSV representation of the operational domain is written to.

  • params – The parameters used for writing, including the operational and non-operational tags. Defaults to an empty write_operational_domain_params object, which provides standard tags.

inline void fiction::write_operational_domain(const operational_domain &opdom, const std::string_view &filename, const write_operational_domain_params &params = {})

Writes a CSV representation of an operational domain to the specified file. The data are written as rows, each corresponding to one set of simulation parameters and their corresponding operational status.

The output CSV format is as follows: X_DIMENSION, Y_DIMENSION, OPERATIONAL STATUS … subsequent rows for each set of simulation parameters.

The operational status is a binary value represented by specified tags in params indicating whether the simulation parameters are within the operational domain or not.

Parameters:
  • opdom – The operational domain to be written. It contains a mapping from sets of simulation parameters (represented as a pair of sweep parameters for the X and Y dimensions) to their operational status.

  • filename – The filename where the CSV representation of the operational domain is written to.

  • params – The parameters used for writing, including the operational and non-operational tags. Defaults to an empty write_operational_domain_params object, which provides standard tags.

Technology-independent Gate-level Layouts

Can be used to generate gate-level layout files (.fgl) as offered by MNT Bench.

Header: fiction/io/write_fgl_layout.hpp

template<typename Lyt>
void fiction::write_fgl_layout(const Lyt &lyt, std::ostream &os)

Writes an FGL layout to a file.

This overload uses an output stream to write into.

Template Parameters:

Lyt – Layout.

Parameters:
  • lyt – The layout to be written.

  • os – The output stream to write into.

template<typename Lyt>
void fiction::write_fgl_layout(const Lyt &lyt, const std::string_view &filename)

Writes an FGL layout to a file.

This overload uses a file name to create and write into.

Template Parameters:

Lyt – Layout.

Parameters:
  • lyt – The layout to be written.

  • filename – The file name to create and write into. Should preferably use the .fgl extension.

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.

Public Functions

inline explicit fgl_parsing_error(const std::string_view &msg) noexcept

Constructs a fgl_parsing_error object with the given error message.

Parameters:

msg – The error message describing the parsing error.