Clocked Layout

Clocking is one of the most important differences between conventional CMOS technologies and the FCN domain. Clocking directs information flow and provides a notion of timing for both combinational and sequential circuits alike. Usually, clocking information is assigned to the coordinates of a layout by the means of a clocking scheme.

The clocked layout can be layered on top of any coordinate (in this context called a clock zone) layout type at compile time to extend its functionality by a notion of FCN clocking. Various pre-defined clocking schemes can be utilized or the clock numbers can be assigned manually.

Header: fiction/layouts/clocked_layout.hpp

template<typename CoordinateLayout>
class clocked_layout : public CoordinateLayout

A layout type to layer on top of a coordinate layout, e.g., cartesian_layout, hexagonal_layout, or tile_based_layout. This type extends the layout by providing a notion of FCN clocking. To this end, it utilizes a clocking scheme that assigns each coordinate in the extended coordinate layout a clock number. These clock numbers can be manually overwritten if necessary.

In the context of this layout type, coordinates are renamed as clock zones.

Template Parameters:

CoordinateLayout – The coordinate layout type whose coordinates should be clocked.

Public Functions

inline explicit clocked_layout(const typename CoordinateLayout::aspect_ratio &ar = {})

Standard constructor. Creates a clocked layout of the given aspect ratio and clocks it via the irregular ‘open’ clocking scheme. This scheme is intended to be used if all clock zones are to be manually assigned.

Parameters:

ar – Highest possible position in the layout.

inline clocked_layout(const typename CoordinateLayout::aspect_ratio &ar, const clocking_scheme_t &scheme)

Standard constructor. Creates a clocked layout of the given aspect ratio and clocks it via the given clocking scheme.

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

  • scheme – Clocking scheme to apply to this layout.

inline explicit clocked_layout(std::shared_ptr<clocked_layout_storage> s)

Copy constructor from another layout’s storage.

Parameters:

s – Storage of another clocked_layout.

inline explicit clocked_layout(const CoordinateLayout &lyt)

Copy constructor from another CoordinateLayout.

Parameters:

lyt – Coordinate layout.

inline clocked_layout clone() const noexcept

Clones the layout returning a deep copy.

Returns:

Deep copy of the layout.

inline void replace_clocking_scheme(const clocking_scheme_t &scheme) noexcept

Replaces the stored clocking scheme with the provided one.

Parameters:

scheme – New clocking scheme.

inline void assign_clock_number(const clock_zone &cz, const clock_number_t cn) noexcept

Overrides a clock number in the stored scheme with the provided one.

Parameters:
  • cz – Clock zone to override.

  • cn – New clock number for cz.

inline clock_number_t get_clock_number(const clock_zone &cz) const noexcept

Returns the clock number for the given clock zone.

Parameters:

cz – Clock zone.

Returns:

Clock number of cz.

inline clock_number_t num_clocks() const noexcept

Returns the number of clock phases in the layout. Each clock cycle is divided into n phases. In QCA, the number of phases is usually 4. In iNML it is 3. However, theoretically, any number >= 3 can be utilized.

Returns:

The number of different clock signals in the layout.

inline bool is_regularly_clocked() const noexcept

Returns whether the layout is clocked by a regular clocking scheme with no overwritten zones.

Returns:

true iff the layout is clocked by a regular scheme and no zones have been overwritten.

inline bool is_clocking_scheme(const std::string_view &name) const noexcept

Compares the stored clocking scheme against the provided name. Names of pre-defined clocking schemes are given in the clock_name namespace.

Parameters:

name – Clocking scheme name.

Returns:

true iff the layout is clocked by a clocking scheme of name name.

inline clocking_scheme_t get_clocking_scheme() const noexcept

Returns a copy of the stored clocking scheme object.

Returns:

A copy of the stored clocking scheme object.

inline bool is_incoming_clocked(const clock_zone &cz1, const clock_zone &cz2) const noexcept

Evaluates whether clock zone cz2 feeds information to clock zone cz1, i.e., whether cz2 is clocked with a clock number that is lower by 1 modulo num_clocks().

Parameters:
  • cz1 – Base clock zone.

  • cz2 – Clock zone to check whether its clock number is lower by 1.

Returns:

true iff cz2 can feed information to cz1.

inline bool is_outgoing_clocked(const clock_zone &cz1, const clock_zone &cz2) const noexcept

Evaluates whether clock zone cz2 accepts information from clock zone cz1, i.e., whether cz2 is clocked with a clock number that is higher by 1 modulo num_clocks().

Parameters:
  • cz1 – Base clock zone.

  • cz2 – Clock zone to check whether its clock number is higher by 1.

Returns:

true iff cz2 can accept information from cz1.

inline auto incoming_clocked_zones(const clock_zone &cz) const noexcept

Returns a container with all clock zones that are incoming to the given one.

Parameters:

cz – Base clock zone.

Returns:

A container with all clock zones that are incoming to cz.

template<typename Fn>
inline void foreach_incoming_clocked_zone(const clock_zone &cz, Fn &&fn) const

Applies a function to all incoming clock zones of a given one.

Template Parameters:

Fn – Functor type.

Parameters:
  • cz – Base clock zone.

  • fn – Functor to apply to each of cz’s incoming clock zones.

inline auto outgoing_clocked_zones(const clock_zone &cz) const noexcept

Returns a container with all clock zones that are outgoing from the given one.

Parameters:

cz – Base clock zone.

Returns:

A container with all clock zones that are outgoing from cz.

template<typename Fn>
inline void foreach_outgoing_clocked_zone(const clock_zone &cz, Fn &&fn) const

Applies a function to all outgoing clock zones of a given one.

Template Parameters:

Fn – Functor type.

Parameters:
  • cz – Base clock zone.

  • fn – Functor to apply to each of cz’s outgoing clock zones.

inline degree_t in_degree(const clock_zone &cz) const noexcept

Returns the number of incoming clock zones to the given one.

Parameters:

cz – Base clock zone.

Returns:

Number of cz’s incoming clock zones.

inline degree_t out_degree(const clock_zone &cz) const noexcept

Returns the number of outgoing clock zones from the given one.

Parameters:

cz – Base clock zone.

Returns:

Number of cz’s outgoing clock zones.

inline degree_t degree(const clock_zone &cz) const noexcept

Returns the number of incoming plus outgoing clock zones of the given one.

Parameters:

cz – Base clock zone.

Returns:

Number of cz’s incoming plus outgoing clock zones.

struct clocked_layout_storage