Cell-level Layout

The cell-level layout can be layered on top of any clocked layout type at compile time to extend its functionality by a notion of FCN cells that can be assigned to its clock zones. In contrast to gate_level_layout, this layout type does not abstract from a technology implementation but embraces it. The cell-level layout requires a cell technology as a template parameter that specifies the types and properties of cells available to it. These could for instance be QCA, iNML, or SiDB.

Cell-level layouts merely represent structural information of the FCN circuit but do not inherently possess any knowledge of their implemented functionality.

A cell-level layout can be obtained from a gate_level_layout by the application of a gate library.

Header: fiction/layouts/cell_level_layout.hpp

template<typename Technology, typename ClockedLayout>
class cell_level_layout : public ClockedLayout

A layout type to layer on top of a clocked layout that allows the assignment of individual cells to clock zones in accordance with an FCN technology, e.g., QCA, iNML, or SiDB. This type, thereby, represents layouts on a cell-accurate abstraction without a notion of logic functions. Gate libraries can be used to transform gate-level layouts into cell-level ones. Furthermore, cell-level layouts can be written to files for various physical simulators like QCADesigner, ToPoliNano & MagCAD, SiQAD, etc.

In this layout, each coordinate, i.e., clock zone has the dimensions of a single cell. Clock numbers can, however, be assigned in a way, that they form larger zones, e.g., of \(5 \times 5\) cells. These dimensions can be specified in the constructor. They affect the way, clock numbers are fetched from the underlying clocked layout.

The de-facto standard of cell-level FCN design is to group multiple cells into tiles large enough to be addressable by individual clocking electrodes buried in the layout substrate. Cell-based clocking, i.e., clock zones of size \(1 \times 1\) cells are not recommended as they are most likely not fabricable in reality.

On the implementation side, this layout distinguishes between cell, cell_type, and cell_mode. A cell is a coordinate, i.e., a position on the layout where a cell_type can be assigned. A cell_type is a concrete variation of a fabricated cell and depends on the given technology. QCA offers regular and constant cell types while SiDB only provides regular ones. Cell types can also include primary input and output cells if they are being treated differently in a simulator for instance. A cell_mode, on the other hand, is a variation of a cell (thus far only known from QCADesigner) that provides further attributes like its functionality as a crossing or via cell.

Template Parameters:
  • Technology – An FCN technology that provides notions of cell types.

  • ClockedLayout – The clocked layout that is to be extended by cell positions.

Public Functions

inline explicit cell_level_layout(const typename ClockedLayout::aspect_ratio &ar = {}, const std::string &name = "", const uint16_t tile_size_x = 1u, const uint16_t tile_size_y = 1u)

Standard constructor. Creates a named cell-level layout of the given aspect ratio. To this end, it calls ClockedLayout’s standard constructor.

Parameters:
  • ar – Highest possible position in the layout.

  • name – Layout name.

  • tile_size_x – Clock zone size in x-dimension in cells.

  • tile_size_y – Clock zone size in y-dimension in cells.

inline cell_level_layout(const typename ClockedLayout::aspect_ratio &ar, const clocking_scheme<cell> &scheme, const std::string &name = "", const uint16_t tile_size_x = 1u, const uint16_t tile_size_y = 1u)

Standard constructor. Creates a named cell-level layout of the given aspect ratio and clocks it via the given clocking scheme. To this end, it calls ClockedLayout’s standard constructor.

Parameters:
  • ar – Highest possible position in the layout.

  • scheme – Clocking scheme to apply to this layout.

  • name – Layout name.

  • tile_size_x – Clock zone size in x-dimension in cells.

  • tile_size_y – Clock zone size in y-dimension in cells.

inline explicit cell_level_layout(std::shared_ptr<cell_level_layout_storage<cell>> s)

Copy constructor from another layout’s storage.

Parameters:

s – Storage of another cell_level_layout.

inline explicit cell_level_layout(const ClockedLayout &lyt)

Copy constructor from another ClockedLayout.

Parameters:

lyt – Clocked layout.

inline cell_level_layout clone() const noexcept

Clones the layout returning a deep copy.

Returns:

Deep copy of the layout.

inline void assign_cell_type(const cell &c, const cell_type &ct) noexcept

Assigns a cell type ct to a cell position c in the layout. If ct is the empty cell, a potentially stored cell type is being erased. If ct is a primary input or output type, the number of primary inputs or outputs in the layout is increased respectively.

Parameters:
  • c – Cell position.

  • ct – Cell type to assign to c.

inline cell_type get_cell_type(const cell &c) const noexcept

Returns the cell type assigned to cell position c.

Parameters:

c – Cell position whose assigned cell type is desired.

Returns:

Cell type assigned to cell position c.

inline bool is_empty_cell(const cell &c) const noexcept

Returns true if no cell type is assigned to cell position c or if the empty type was assigned.

Parameters:

c – Cell position to check for emptiness.

Returns:

true iff no cell type was assigned to cell position c.

inline void assign_cell_mode(const cell &c, const cell_mode &m) noexcept

Assigns a cell mode m to a cell position c in the layout. If m is the normal cell mode, a potentially stored cell mode is being erased.

Parameters:
  • c – Cell position to assign cell mode m to.

  • m – Cell mode to assign to cell position c.

inline cell_mode get_cell_mode(const cell &c) const noexcept

Returns the cell mode assigned to cell position c. If no cell mode is assigned, the default mode is returned.

Parameters:

c – Cell position whose assigned cell mode is desired.

Returns:

Cell mode assigned to cell position c.

inline void assign_cell_name(const cell &c, const std::string &n) noexcept

Assigns a cell name n to a cell position c in the layout. If n is the empty string, a potentially stored cell name is being erased.

Parameters:
  • c – Cell position to assign cell name n to.

  • n – Cell name to assign to cell position c.

inline std::string get_cell_name(const cell &c) const noexcept

Returns the cell name assigned to cell position c. If no cell name is assigned, the empty string is returned.

Parameters:

c – Cell position whose assigned cell name is desired.

Returns:

Cell name assigned to cell position c.

inline void set_layout_name(const std::string &name) noexcept

Assigns or overrides the layout name.

Parameters:

name – Layout name to assign.

inline std::string get_layout_name() const noexcept

Returns the assigned layout name.

Returns:

The layout name.

inline uint64_t num_cells() const noexcept

Returns the number of non-empty cell types that were assigned to the layout.

Returns:

Number of non-empty cell types in the layout.

inline bool is_empty() const noexcept

Checks whether there are no cells assigned to the layout’s coordinates.

Returns:

true iff the layout is empty.

inline uint32_t num_pis() const noexcept

Returns the number of primary input cells in the layout.

Returns:

Number of primary input cells.

inline uint32_t num_pos() const noexcept

Returns the number of primary output cells in the layout.

Returns:

Number of primary output cells.

inline bool is_pi(const cell &c) const noexcept

Checks whether a given cell position is marked as primary input. This function does not check against the assigned cell type but whether the cell position is stored in the list of PIs. Assigning a cell position the primary input cell type automatically enlists it there.

Parameters:

c – Cell position to check.

Returns:

true iff cell position c is marked as primary input.

inline bool is_po(const cell &c) const noexcept

Checks whether a given cell position is marked as primary output. This function does not check against the assigned cell type but whether the cell position is stored in the list of POs. Assigning a cell position the primary output cell type automatically enlists it there.

Parameters:

c – Cell position to check.

Returns:

true iff cell position c is marked as primary output.

inline auto get_tile_size_x() const noexcept

Returns the underlying clock zone x-dimension size. That is, if this cell-level layout was obtained from the application of a gate library, this function returns the cell size in x-dimension of each gate in the library.

Returns:

The clock zone size in cells in the x-dimension.

inline void set_tile_size_x(const uint16_t tile_size_x) noexcept

Sets the underlying clock zone x-dimension size.

Parameters:

tile_size_x – Tile size in the x-dimension in number of cells.

inline auto get_tile_size_y() const noexcept

Returns the underlying clock zone y-dimension size. That is, if this cell-level layout was obtained from the application of a gate library, this function returns the cell size in y-dimension of each gate in the library.

Returns:

The clock zone size in cells in the y-dimension.

inline void set_tile_size_y(const uint16_t tile_size_y) noexcept

Sets the underlying clock zone y-dimension size.

Parameters:

tile_size_y – Tile size in the y-dimension in number of cells.

inline ClockedLayout::clock_number_t get_clock_number(const cell &c) const noexcept

Returns the clock number of cell position c by accessing ClockedLayout’s underlying clocking scheme and respecting this layout’s clock zone size.

Parameters:

c – Cell position whose clock number is desired.

Returns:

Clock number of cell position c.

bool is_incoming_clocked(const typename ClockedLayout::clock_zone &cz1, const typename ClockedLayout::clock_zone &cz2) const noexcept = delete

Function is deleted for cell-level layouts.

bool is_outgoing_clocked(const typename ClockedLayout::clock_zone &cz1, const typename ClockedLayout::clock_zone &cz2) const noexcept = delete

Function is deleted for cell-level layouts.

template<typename Fn>
inline void foreach_cell(Fn &&fn) const

Applies a function to all cell positions in the layout that have non-empty cell types assigned.

Template Parameters:

Fn – Functor type that has to comply with the restrictions imposed by mockturtle::foreach_element_transform.

Parameters:

fn – Functor to apply to each non-empty cell position.

template<typename Fn>
inline void foreach_cell_position(Fn &&fn) const

Applies a function to all cell positions in the layout, even empty ones. This function, thereby, renames ClockedLayout::foreach_coordinate.

Template Parameters:

Fn – Functor type that has to comply with the restrictions imposed by the functor type in ClockedLayout::foreach_coordinate.

Parameters:

fn – Functor to apply to each cell position.

template<typename Fn>
inline void foreach_pi(Fn &&fn) const

Applies a function to all primary input cell positions in the layout.

Template Parameters:

Fn – Functor type that has to comply with the restrictions imposed by mockturtle::foreach_element_transform.

Parameters:

fn – Functor to apply to each primary input cell.

template<typename Fn>
inline void foreach_po(Fn &&fn) const

Applies a function to all primary output cells in the layout.

Template Parameters:

Fn – Functor type that has to comply with the restrictions imposed by mockturtle::foreach_element_transform.

Parameters:

fn – Functor to apply to each primary output cell.

template<typename Cell>
struct cell_level_layout_storage