QCA Layout¶
A QCA layout places QCA cells on a Cartesian grid with a ground layer and a crossing layer. Each cell has a type, a mode as known from QCADesigner (regular, rotated, via, or crossover), and, for inputs and outputs, a name. Clock zones are tiles of cells, and each clock zone can be a synchronization element that extends its Hold phase. See Cell Grids and Tile Clocking for the cell storage and the clock zones that QCA shares with other technologies.
A QCA layout can be obtained from a gate-level layout by applying the QCA ONE library.
Header: fiction/technology/qca/layout.hpp
-
enum class fiction::qca::cell_type : uint8_t¶
Types of Quantum-dot Cellular Automata (QCA) cells. The enumerators carry the symbols of their ASCII representation.
Values:
-
enumerator EMPTY¶
No cell.
-
enumerator NORMAL¶
Regular cell.
-
enumerator INPUT¶
Primary input cell.
-
enumerator OUTPUT¶
Primary output cell.
-
enumerator CONST_0¶
Cell with a fixed polarization of logic 0.
-
enumerator CONST_1¶
Cell with a fixed polarization of logic 1.
-
enumerator EMPTY¶
-
enum class fiction::qca::cell_mode : uint8_t¶
Modes of QCA cells as known from QCADesigner.
Values:
-
enumerator NORMAL¶
Regular cell.
-
enumerator ROTATED¶
Cell rotated by 45°.
-
enumerator VERTICAL¶
Via cell that connects the ground and the crossing layer.
-
enumerator CROSSOVER¶
Cell of a multilayer crossing.
-
enumerator NORMAL¶
-
constexpr bool fiction::qca::is_constant(const cell_type ct) noexcept¶
Whether a QCA cell has a fixed polarization.
- Parameters:
ct – Cell type.
- Returns:
trueiffctisCONST_0orCONST_1.
-
class layout : public fiction::layouts::cell_grid<cell_type>, public fiction::layouts::tile_clocking¶
A QCA layout: QCA cells on a Cartesian grid with a ground layer (
z = 0) and crossing layers (z > 0). Cells carry a type, a mode, and, for inputs and outputs, a name. Clock zones are tiles of cells, and each clock zone can be a synchronization element that extends its Hold phase. The layout has value semantics; copies are independent.Public Types
-
using sync_elem_t = layouts::clocking::state::sync_elem_t¶
Hold-phase extension in full clock cycles.
Public Functions
-
inline explicit layout(const extent &size = {}, std::string name = "", const uint16_t tile_size_x = 1u, const uint16_t tile_size_y = 1u)¶
Creates an empty layout with open clocking.
- Parameters:
size – Half-open cell sizes; layers beyond the ground layer hold crossing cells.
name – Layout name.
tile_size_x – Clock-zone width in cells.
tile_size_y – Clock-zone height in cells.
- Throws:
std::invalid_argument – If a size exceeds the coordinate domain or a clock-zone size is zero.
-
inline layout(const extent &size, const clocking_scheme_t &scheme, std::string name = "", const uint16_t tile_size_x = 1u, const uint16_t tile_size_y = 1u)¶
Creates an empty layout clocked by the given scheme.
- Parameters:
size – Half-open cell sizes; layers beyond the ground layer hold crossing cells.
scheme – Clocking scheme over clock zones.
name – Layout name.
tile_size_x – Clock-zone width in cells.
tile_size_y – Clock-zone height in cells.
- Throws:
std::invalid_argument – If a size exceeds the coordinate domain or a clock-zone size is zero.
-
inline bool operator==(const layout &other) const noexcept¶
Compares two layouts: same cells, names, modes, tile size, and clocking scheme name.
- Parameters:
other – Right-hand side layout.
- Returns:
trueiff both layouts are identical.
-
inline void assign_cell_type(const cell &c, const cell_type ct)¶
Assigns a cell type to a position. Assigning
EMPTYremoves the cell with its name and mode.- Parameters:
c – Cell position.
ct – Cell type.
-
inline void assign_cell_mode(const cell &c, const cell_mode m)¶
Assigns a mode to a cell.
cell_mode::NORMALremoves a stored mode.- Parameters:
c – Cell position.
m – Cell mode.
-
inline cell_mode get_cell_mode(const cell &c) const noexcept¶
The mode of a cell.
- Parameters:
c – Cell position.
- Returns:
Mode of the cell at
c,cell_mode::NORMALif none is stored.
-
inline void assign_synchronization_element(const clock_zone &cz, const sync_elem_t se)¶
Turns a clock zone into a synchronization element.
- Parameters:
cz – Clock zone.
se – Number of full clock cycles to extend the Hold phase of
czby; 0 turnsczback into a normal clock zone.
- Throws:
std::bad_alloc – If allocation fails.
-
inline bool is_synchronization_element(const cell &c) const noexcept¶
Whether the clock zone that contains a cell is a synchronization element.
- Parameters:
c – Cell position.
- Returns:
trueiffget_clock_zone(c)is a synchronization element.
-
inline sync_elem_t get_synchronization_element(const cell &c) const noexcept¶
The Hold-phase extension of the clock zone that contains a cell.
- Parameters:
c – Cell position.
- Returns:
Hold-phase extension of
get_clock_zone(c)in full clock cycles.
-
inline uint32_t num_se() const noexcept¶
Number of synchronization elements.
- Returns:
Number of clock zones with a nonzero Hold-phase extension.
Public Static Attributes
-
static constexpr double CELL_WIDTH = 18.0¶
Cell width in nm, the QCADesigner default.
-
static constexpr double CELL_HEIGHT = 18.0¶
Cell height in nm, the QCADesigner default.
-
static constexpr double CELL_HSPACE = 2.0¶
Horizontal spacing between two cells in nm, the QCADesigner default.
-
static constexpr double CELL_VSPACE = 2.0¶
Vertical spacing between two cells in nm, the QCADesigner default.
-
using sync_elem_t = layouts::clocking::state::sync_elem_t¶
- class qca_cell_type(*values)¶
Types of Quantum-dot Cellular Automata (QCA) cells. The enumerators carry the symbols of their ASCII representation.
- EMPTY = 32¶
- NORMAL = 120¶
- INPUT = 105¶
- OUTPUT = 111¶
- CONST_0 = 48¶
- CONST_1 = 49¶
- class qca_cell_mode(*values)¶
Modes of QCA cells as known from QCADesigner.
- NORMAL = 0¶
- ROTATED = 1¶
- VERTICAL = 2¶
- CROSSOVER = 3¶
- class qca_layout¶
- class qca_layout(extent: extent | tuple[int, int] | tuple[int, int, int])
- class qca_layout(extent: extent | tuple[int, int] | tuple[int, int, int], clocking_scheme: str = '2DDWave', layout_name: str = '', tile_size_x: int = 1, tile_size_y: int = 1)
A QCA layout: QCA cells on a Cartesian grid with a ground layer (
z = 0) and crossing layers (z > 0). Cells carry a type, a mode, and, for inputs and outputs, a name. Clock zones are tiles of cells, and each clock zone can be a synchronization element that extends its Hold phase. The layout has value semantics; copies are independent.- assign_cell_mode(c: coordinate | tuple[int, int] | tuple[int, int, int], m: qca_cell_mode) None¶
Assigns a mode to a cell.
cell_mode::NORMALremoves a stored mode.- Parameters:
c – Cell position.
m – Cell mode.
- assign_cell_name(c: coordinate | tuple[int, int] | tuple[int, int, int], n: str) None¶
Assigns a name to a cell. The empty string removes the name.
- Parameters:
c – Cell position.
n – Cell name.
- assign_cell_type(c: coordinate | tuple[int, int] | tuple[int, int, int], ct: qca_cell_type) None¶
Assigns a cell type to a position. Assigning
EMPTYremoves the cell with its name and mode.- Parameters:
c – Cell position.
ct – Cell type.
- assign_clock_number(cz: coordinate | tuple[int, int] | tuple[int, int, int], cn: int) None¶
Overrides the clock number of a clock zone.
- Parameters:
cz – Clock zone.
cn – Clock number.
- Raises:
MemoryError – If allocation fails.
- assign_synchronization_element(cz: coordinate | tuple[int, int] | tuple[int, int, int], se: int) None¶
Turns a clock zone into a synchronization element.
- Parameters:
cz – Clock zone.
se – Number of full clock cycles to extend the Hold phase of
czby; 0 turnsczback into a normal clock zone.
- Raises:
MemoryError – If allocation fails.
- bounding_box() tuple[coordinate | None, coordinate | None]¶
Returns the minimum and maximum corner of the bounding box. A 2D bounding box object computes a minimum-sized box around all non-empty coordinates in a given layout. Layouts can be of arbitrary size and, thus, may be larger than their contained elements. Sometimes, it might be necessary to know exactly which space the associated layout internals occupy. A bounding box computes coordinates that span a minimum-sized rectangle that encloses all non- empty layout coordinates.
- Returns:
The minimum and maximum enclosing coordinate in the associated layout.
- cells() list[coordinate]¶
Returns the positions of all cells, in unspecified order.
- get_cell_mode(c: coordinate | tuple[int, int] | tuple[int, int, int]) qca_cell_mode¶
The mode of a cell.
- Parameters:
c – Cell position.
- Returns:
Mode of the cell at
c,cell_mode::NORMALif none is stored.
- get_cell_name(c: coordinate | tuple[int, int] | tuple[int, int, int]) str¶
The name of a cell.
- Parameters:
c – Cell position.
- Returns:
Name of the cell at
c, or the empty string if it has none.
- get_cell_type(c: coordinate | tuple[int, int] | tuple[int, int, int]) qca_cell_type¶
The cell type at a position.
- Parameters:
c – Cell position.
- Returns:
Cell type at
c,EMPTYif no cell is there.
- get_clock_number(c: coordinate | tuple[int, int] | tuple[int, int, int]) int¶
The clock number of the clock zone that contains a cell.
- Parameters:
c – Cell position.
- Returns:
Clock number of
get_clock_zone(c).
- get_clock_zone(c: coordinate | tuple[int, int] | tuple[int, int, int]) coordinate¶
The clock zone that contains a cell: its tile on layer 0. Negative axes use floor division.
- Parameters:
c – Cell position.
- Returns:
Clock zone of
c.
- get_clocking_scheme_name() str¶
Returns the name of the layout’s clocking scheme, e.g.,
2DDWaveorUSE.
- get_synchronization_element(c: coordinate | tuple[int, int] | tuple[int, int, int]) int¶
The Hold-phase extension of the clock zone that contains a cell.
- Parameters:
c – Cell position.
- Returns:
Hold-phase extension of
get_clock_zone(c)in full clock cycles.
- is_clocking_scheme(name: str) bool¶
Compares the clocking scheme against a name. Predefined names are constants in
fiction::layouts::clocking.- Parameters:
name – Clocking scheme name.
- Returns:
trueiff the scheme is calledname.
- is_empty_cell(c: coordinate | tuple[int, int] | tuple[int, int, int]) bool¶
Whether no cell sits at a position.
- Parameters:
c – Cell position.
- Returns:
trueiffcholds no cell.
- is_pi(c: coordinate | tuple[int, int] | tuple[int, int, int]) bool¶
Whether a cell is a primary input, i.e., of type
INPUT.- Parameters:
c – Cell position.
- Returns:
trueiffcholds an input cell.
- is_po(c: coordinate | tuple[int, int] | tuple[int, int, int]) bool¶
Whether a cell is a primary output, i.e., of type
OUTPUT.- Parameters:
c – Cell position.
- Returns:
trueiffcholds an output cell.
- is_regularly_clocked() bool¶
Whether a regular scheme clocks the layout with no overridden zones.
- Returns:
trueiff the clocking is regular.
- is_synchronization_element(c: coordinate | tuple[int, int] | tuple[int, int, int]) bool¶
Whether the clock zone that contains a cell is a synchronization element.
- Parameters:
c – Cell position.
- Returns:
trueiffget_clock_zone(c)is a synchronization element.
- num_se() int¶
Number of synchronization elements.
- Returns:
Number of clock zones with a nonzero Hold-phase extension.
- pis() list[coordinate]¶
Returns the positions of all input cells, in unspecified order.
- pos() list[coordinate]¶
Returns the positions of all output cells, in unspecified order.
- replace_clocking_scheme(name: str) None¶
Replaces the clocking scheme by the predefined scheme of the given name. Clock-number overrides are discarded. Raises ValueError for an unknown name.
- set_tile_size_x(size: int) None¶
Sets the tile width.
- Parameters:
size – Tile width in cells.
- Raises:
ValueError – if
sizeis zero.
- set_tile_size_y(size: int) None¶
Sets the tile height.
- Parameters:
size – Tile height in cells.
- Raises:
ValueError – if
sizeis zero.