Visualization

Visualization of logic networks and FCN layouts.

Layout Printing

Header: fiction/io/print_layout.hpp

template<typename Lyt>
void fiction::print_gate_level_layout(std::ostream &os, const Lyt &layout, const bool io_color = true, const bool clk_color = false)

Writes a simplified 2D representation of a gate-level layout to an output stream.

Template Parameters:

Lyt – Gate-level layout type.

Parameters:
  • os – Output stream to write into.

  • layout – The gate-level layout to print.

  • io_color – Flag to utilize color escapes for inputs and outputs.

  • clk_color – Flag to utilize color escapes for clock zones.

template<typename Lyt>
void fiction::print_cell_level_layout(std::ostream &os, const Lyt &layout, const bool io_color = true, const bool clk_color = false)

Writes a simplified 2D representation of a cell-level layout to an output stream.

Template Parameters:

Lyt – Cell-level layout type.

Parameters:
  • os – Output stream to write into.

  • layout – The cell-level layout to print.

  • io_color – Flag to utilize color escapes for inputs and outputs.

  • clk_color – Flag to utilize color escapes for clock zones.

template<typename Lyt>
void fiction::print_sidb_layout(std::ostream &os, const Lyt &lyt, const bool lat_color = true, const bool crop_layout = false, const bool draw_lattice = true)

Writes a simplified 2D representation of an SiDB layout (SiDB and defect charges are supported) to an output stream.

Template Parameters:

Lyt – SiDB cell-level layout with charge-information based on SiQAD coordinates or defect-information, e.g., a charge_distribution_surface or sidb_defect_surface.

Parameters:
  • os – Output stream to write into.

  • lyt – The layout of which the information is to be printed.

  • lat_color – Flag to utilize color escapes for the lattice, charge states, and atomic defects.

  • crop_layout – Flag to print the 2D bounding box of the layout, while leaving a maximum padding of one dimer row and two columns.

  • draw_lattice – Flag to enable lattice background drawing.

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

A unified printer of the versions above. Depending on the passed layout type, this function will automatically select the appropriate printer to use. This simplifies printing by enabling the statement print_layout(lyt).

Note

This function will use the respective function’s default settings to print the layout.

Template Parameters:

Lyt – Any coordinate layout type.

Parameters:
  • lyt – The coordinate layout.

  • os – The output stream to write into.

Graphviz (DOT) Drawers

Header: fiction/io/dot_drawers.hpp

template<typename Ntk, bool DrawIndexes = false, bool DrawHexTT = false>
class technology_dot_drawer : public mockturtle::gate_dot_drawer<Ntk>

A DOT drawer that extends mockturtle’s one by several additional gate types.

Template Parameters:
  • Ntk – Logic network type.

  • DrawIndexes – Flag to toggle the drawing of node indices.

  • DrawHexTT – Flag to toggle the representation of truth tables for unknown functions in hexadecimal notation.

Subclassed by fiction::simple_gate_layout_tile_drawer< Lyt, false, false >

template<typename Ntk, bool DrawIndexes = false>
class color_view_drawer : public mockturtle::default_dot_drawer<Ntk>

A DOT drawer for networks with colored nodes. Node colors represent their painted color instead of their gate type.

Template Parameters:
  • Ntk – Logic network type.

  • DrawIndexes – Flag to toggle the drawing of node indices.

template<typename Ntk, bool DrawIndexes = false>
class edge_color_view_drawer : public fiction::color_view_drawer<Ntk, false>

A DOT drawer for networks with colored edges. Node colors represent their painted color instead of their gate type.

Template Parameters:
  • Ntk – Logic network type.

  • DrawIndexes – Flag to toggle the drawing of node indices.

template<typename Lyt, bool ClockColors = false, bool DrawIndexes = false>
class simple_gate_layout_tile_drawer : public fiction::technology_dot_drawer<Lyt, false>

Base class for a simple gate-level layout DOT drawer.

Template Parameters:
  • Lyt – Gate-level layout type.

  • ClockColors – Flag to toggle the drawing of clock colors instead of gate type colors.

  • DrawIndexes – Flag to toggle the drawing of node indices.

template<typename Lyt, bool ClockColors = false, bool DrawIndexes = false>
class gate_layout_cartesian_drawer : public fiction::simple_gate_layout_tile_drawer<Lyt, false, false>

An extended gate-level layout DOT drawer for Cartesian layouts.

Template Parameters:
  • Lyt – Cartesian gate-level layout type.

  • ClockColors – Flag to toggle the drawing of clock colors instead of gate type colors.

  • DrawIndexes – Flag to toggle the drawing of node indices.

template<typename Lyt, bool ClockColors = false, bool DrawIndexes = false>
class gate_layout_shifted_cartesian_drawer : public fiction::simple_gate_layout_tile_drawer<Lyt, false, false>

An extended gate-level layout DOT drawer for shifted Cartesian layouts.

Template Parameters:
  • Lyt – Shifted Cartesian gate-level layout type.

  • ClockColors – Flag to toggle the drawing of clock colors instead of gate type colors.

  • DrawIndexes – Flag to toggle the drawing of node indices.

template<typename Lyt, bool ClockColors = false, bool DrawIndexes = false>
class gate_layout_hexagonal_drawer : public fiction::simple_gate_layout_tile_drawer<Lyt, false, false>

An extended gate-level layout DOT drawer for hexagonal layouts.

Template Parameters:
  • Lyt – Hexagonal gate-level layout type.

  • ClockColors – Flag to toggle the drawing of clock colors instead of gate type colors.

  • DrawIndexes – Flag to toggle the drawing of node indices.

template<class Lyt, class Drawer>
void fiction::write_dot_layout(const Lyt &lyt, std::ostream &os, const Drawer &drawer = {})

Writes layout in DOT format into output stream.

An overloaded variant exists that writes the layout into a file.

Required network functions:

  • is_pi

  • foreach_node

  • foreach_fanin

Parameters:
  • lyt – Layout

  • os – Output stream

template<class Lyt, class Drawer>
void fiction::write_dot_layout(const Lyt &lyt, const std::string_view &filename, const Drawer &drawer = {})

Writes layout in DOT format into a file.

Required network functions:

  • is_pi

  • foreach_node

  • foreach_fanin

Parameters:
  • lyt – Layout

  • filename – Filename

SVG Images

Header: fiction/io/write_svg_layout.hpp

struct write_qca_layout_svg_params

Parameters for writing SVG QCA layouts.

Public Members

bool simple = false

Limit details to create smaller file sizes.

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

Writes an SVG representation of a cell-level QCA layout into an output stream. Both tile- and cell-based layouts are supported. For tile-based layouts, QCA layouts of tile size \(5 \times 5\) are supported exclusively so far.

The utilized color scheme is based on the standard scheme used in QCADesigner (https://waluslab.ece.ubc.ca/qcadesigner/).

May throw an unsupported_cell_type_exception.

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_svg(const Lyt &lyt, const std::string_view &filename, write_qca_layout_svg_params ps = {})

Writes an SVG representation of a cell-level QCA layout into a file. Both tile- and cell-based layouts are supported. For tile-based layouts, QCA layouts of tile size \(5 \times 5\) are supported exclusively so far.

The utilized color scheme is based on the standard scheme used in QCADesigner (https://waluslab.ece.ubc.ca/qcadesigner/).

May throw an unsupported_cell_type_exception.

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 .svg extension.

  • ps – Parameters.

template<typename Coordinate>
class unsupported_cell_type_exception : public std::exception