core.hardware package#
Submodules#
core.hardware.Component module#
- class core.hardware.Component.Component(name: str | None = None)[source]#
Bases:
BooleanFunction
,IOInterface
,DrawInterface
,ABC
core.hardware.Crossbar module#
- class core.hardware.Crossbar.Crossbar(rows: int, columns: int, layers: int = 1, name: str | None = None)[source]#
Bases:
Component
,ABC
An abstract class to represent a crossbar.
- find(literal: LITERAL) Set[Tuple[int, int, int]] [source]#
Returns the positions of the given selectorlines occurring in this crossbar. :param literal: The given literal to find in this crossbar. :return: A list of positions (tuples) at which the literal occurs.
- flip_horizontal(layer: int = 0)[source]#
Flips the nanowire over its axis parallel to the nanowires in its layer (i.e. mirrors). :return:
- flip_vertical()[source]#
Flips the nanowire of its axis parallel to the nanowires in its layer (i.e. mirrors). :param layer: :return:
- static from_string(content: str) BooleanFunction [source]#
- get_area()[source]#
Returns the area (number of wordlines * number of bitlines) of this crossbar. :return: The area of this crossbar.
- get_columns() int [source]#
Returns the number of columns of this crossbar. :return: The number of columns of this crossbar.
- get_input_nanowires() Dict[str, Tuple[int, int]] [source]#
Returns a dictionary mapping the input of this crossbar to the input nanowires. An input nanowire is defined by a tuple of its layer and index. :return: A dictionary mapping an input (str) to a tuple of a layer (int) and an index (int).
- get_memristor(row: int, column: int, layer: int = 0) Memristor [source]#
Returns the memristor at the given row and column. :param row: The given row in this crossbar. :param column: The given column in this crossbar. :param layer: The given layer in this crossbar. :return: The memristor at the given row and column.
- get_memristor_layers() int [source]#
Returns the number of layers (memristors) of this crossbar. :return: The number of layers of memristors in this crossbar.
- get_nanowire_layers() int [source]#
Returns the number of layers (nanowires) of this crossbar. :return: The number of layers of nanowires in this crossbar.
- get_output_nanowire(output_variable: str) Tuple[int, int] [source]#
Returns the output nanowire of the given output variable. :param output_variable: The given output variable. :return: A tuple of the layer and the index.
- get_output_nanowires() Dict[str, Tuple[int, int]] [source]#
Returns a dictionary mapping the output variables of this crossbar to the output nanowire. An output nanowire is defined by a tuple of its layer and index. :return: A dictionary mapping an output variable (str) to a tuple of a layer (int) and an index (int).
- get_rows() int [source]#
Returns the number of rows of this crossbar. :return: The number of rows of this crossbar.
- get_semiperimeter()[source]#
Returns the semiperimeter (number of wordlines + number of bitlines) of this crossbar. :return: The semiperimeter of this crossbar.
- get_volume()[source]#
Returns the volume (area * number of layers of memristors) of this crossbar. :return: The number of layers of this crossbar.
- graph(boolean_expression_representation: bool = False) Graph [source]#
Returns a bipartite_graph representation based on the following analogy: nanowires in the crossbar correspond to nodes in the bipartite_graph, and memristors in the crossbar correspond to edges in the bipartite_graph. The resulting bipartite_graph is a multi-layered bipartite_graph. More specifically, the bipartite_graph is k-layered and bipartite. :param boolean_expression_representation: If true, the edge will be represented as a Boolean expression. Otherwise, as an atom and a truth value. :return: A k-layered bipartite bipartite_graph.
- static read(file_path: Path) BooleanFunction [source]#
- set_memristor(row: int, column: int, literal: LITERAL, layer: int = 0, stuck_at_fault: bool = False)[source]#
Assigns the given literal to the memristor at the given row and column. :param row: The given row in this crossbar. :param column: The given column in this crossbar. :param literal: The given literal to be assigned. :param layer: The given layer in this crossbar. :param stuck_at_fault: :return:
- class core.hardware.Crossbar.MemristorCrossbar(rows: int, columns: int, layers: int = 1, name: str | None = None)[source]#
Bases:
Crossbar
Type of crossbar where are assigned to memristors.
- compress() MemristorCrossbar [source]#
- eval(instance: Dict[str, bool], input_function: str = '1') Dict[str, bool] [source]#
Given the instance, this function returns an evaluation of this multi-output Boolean function. An evaluation is an assignment for each variable to a Boolean truth value (true/false). :param instance: A dictionary mapping the input variables (str) to the Boolean truth values true and false (bool). :return: A dictionary mapping the output variables (str) to the Boolean truth values true and false (bool).
- fix(atom: str, positive: bool) MemristorCrossbar [source]#
- static from_string(content: str) BooleanFunction [source]#
- get_auxiliary_variables() Set[str] [source]#
Returns the set of auxiliary variables of this multi-output Boolean function.
- get_input_variables() Set[str] [source]#
Returns the set of input variables of this multi-output Boolean function.
- get_output_variables() Set[str] [source]#
Returns the set of output variables of this multi-output Boolean function.
- get_ternary_matrix(layer: int = 0) ndarray [source]#
TODO: Adapt to handle all layers, currently only handles one layer (layer 0) :param layer: :return:
- instantiate(instance: dict) MemristorCrossbar [source]#
- static nd_array_to_crossbar(nd_array: ndarray, equivalent_dimension: List[List[int]]) MemristorCrossbar [source]#
- transpose() MemristorCrossbar [source]#
- class core.hardware.Crossbar.SelectorCrossbar(rows: int, columns: int, name: str | None = None)[source]#
Bases:
Crossbar
Type of crossbar where selectorlines are assigned to nanowires.
- eval(instance: Dict[str, bool], input_function: str = '1') Dict[str, bool] [source]#
Given the instance, this function returns an evaluation of this multi-output Boolean function. An evaluation is an assignment for each variable to a Boolean truth value (true/false). :param instance: A dictionary mapping the input variables (str) to the Boolean truth values true and false (bool). :return: A dictionary mapping the output variables (str) to the Boolean truth values true and false (bool).
- static from_string(content: str) BooleanFunction [source]#
- get_auxiliary_variables() Set[str] [source]#
Returns the set of auxiliary variables of this multi-output Boolean function.
- get_input_variables() Set[str] [source]#
Returns the set of input variables of this multi-output Boolean function.
- get_output_variables() Set[str] [source]#
Returns the set of output variables of this multi-output Boolean function.
- instantiate(instance: Dict[str, bool]) SelectorCrossbar [source]#
core.hardware.Memristor module#
- class core.hardware.Memristor.Memristor(row: int, column: int, literal: LITERAL, layer: int = 0, stuck_at_fault: LITERAL | None = None)[source]#
Bases:
BooleanExpression
A memristor is a programmable device with a resistive state. The device can be assigned a Boolean literal, and can consequently be programmed to either a low resistive state (ON/True/1) or a high resistive state (OFF/False/0).
- fix(atom: str, positive: bool) BooleanExpression [source]#
- negate() BooleanExpression [source]#
- simplify() BooleanExpression [source]#
- substitute(original: LITERAL, replacement: BooleanExpression) BooleanExpression [source]#
core.hardware.Topology module#
- class core.hardware.Topology.Topology(graph: MultiDiGraph, file_path: Path | None = None, name: str | None = None)[source]#
Bases:
Component
Class to represent a topology.
- eval(instance: Dict[str, bool], input_function: str = '1') Dict[str, bool] [source]#
Given the instance, this function returns an evaluation of this multi-output Boolean function. An evaluation is an assignment for each variable to a Boolean truth value (true/false). :param instance: A dictionary mapping the input variables (str) to the Boolean truth values true and false (bool). :return: A dictionary mapping the output variables (str) to the Boolean truth values true and false (bool).
- static from_string(content: str) BooleanFunction [source]#
- get_auxiliary_variables() Set[str] [source]#
Returns the set of auxiliary variables of this multi-output Boolean function.
- get_input_variables() Set[str] [source]#
Returns the set of input variables of this multi-output Boolean function.
- get_output_variables() Set[str] [source]#
Returns the set of output variables of this multi-output Boolean function.
- static read(filepath: Path) BooleanFunction [source]#