iNML Layout¶
An iNML layout places in-plane nanomagnets on a planar Cartesian grid. Each position holds a magnet type and, for inputs and outputs, a name. Clock zones are tiles of magnets. Signal crossings are coplanar cross-wire magnets, so the layout has no crossing layer. See Cell Grids and Tile Clocking for the storage and the clock zones that iNML shares with other technologies.
Header: fiction/technology/inml/layout.hpp
-
enum class fiction::inml::magnet_type : uint8_t¶
Types of in-plane Nanomagnet Logic (iNML) magnets. The enumerators carry the symbols of their ASCII representation.
Values:
-
enumerator EMPTY¶
No magnet.
-
enumerator NORMAL¶
Regular magnet.
-
enumerator INPUT¶
Primary input magnet.
-
enumerator OUTPUT¶
Primary output magnet.
-
enumerator SLANTED_EDGE_UP_MAGNET¶
Magnet with an upper slanted edge.
-
enumerator SLANTED_EDGE_DOWN_MAGNET¶
Magnet with a lower slanted edge.
-
enumerator INVERTER_MAGNET¶
Inverter magnet.
-
enumerator CROSSWIRE_MAGNET¶
Magnet of a coplanar cross wire.
-
enumerator FANOUT_COUPLER_MAGNET¶
Coupler (fan-out) magnet.
-
enumerator EMPTY¶
-
class layout : public fiction::layouts::cell_grid<magnet_type>, public fiction::layouts::tile_clocking¶
An iNML layout: in-plane nanomagnets on a planar Cartesian grid. Each position holds a magnet type and, for inputs and outputs, a name. Clock zones are tiles of magnets. Signal crossings are coplanar cross-wire magnets, so the layout has no crossing layer. The layout has value semantics; copies are independent.
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 magnet sizes; a nonzero layer count selects one layer.
name – Layout name.
tile_size_x – Clock-zone width in magnets.
tile_size_y – Clock-zone height in magnets.
- 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 magnet sizes; a nonzero layer count selects one layer.
scheme – Clocking scheme over clock zones.
name – Layout name.
tile_size_x – Clock-zone width in magnets.
tile_size_y – Clock-zone height in magnets.
- Throws:
std::invalid_argument – If a size exceeds the coordinate domain or a clock-zone size is zero.
Public Static Attributes
-
static constexpr double CELL_WIDTH = 50.0¶
Magnet width in nm, the NMLSim default.
-
static constexpr double CELL_HEIGHT = 100.0¶
Magnet height in nm, the NMLSim default.
-
static constexpr double CELL_HSPACE = 10.0¶
Horizontal spacing between two magnets in nm, the NMLSim default.
-
static constexpr double CELL_VSPACE = 25.0¶
Vertical spacing between two magnets in nm, the NMLSim default.
-
inline explicit layout(const extent &size = {}, std::string name = "", const uint16_t tile_size_x = 1u, const uint16_t tile_size_y = 1u)¶
- class inml_magnet_type(*values)¶
Types of in-plane Nanomagnet Logic (iNML) magnets. The enumerators carry the symbols of their ASCII representation.
- EMPTY = 32¶
- NORMAL = 120¶
- INPUT = 105¶
- OUTPUT = 111¶
- SLANTED_EDGE_UP_MAGNET = 117¶
- SLANTED_EDGE_DOWN_MAGNET = 100¶
- INVERTER_MAGNET = 110¶
- CROSSWIRE_MAGNET = 99¶
- FANOUT_COUPLER_MAGNET = 102¶
- class inml_layout¶
- class inml_layout(extent: extent | tuple[int, int] | tuple[int, int, int])
- class inml_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)
An iNML layout: in-plane nanomagnets on a planar Cartesian grid. Each position holds a magnet type and, for inputs and outputs, a name. Clock zones are tiles of magnets. Signal crossings are coplanar cross- wire magnets, so the layout has no crossing layer. The layout has value semantics; copies are independent.
- 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: inml_magnet_type) None¶
Assigns a cell type to a position. Assigning
EMPTYremoves the cell and its name.- 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.
- 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_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]) inml_magnet_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.
- 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.
- 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.