badcrossbar.computing package#

Submodules#

badcrossbar.computing.extract module#

class badcrossbar.computing.extract.Currents(output, device, word_line, bit_line)#

Bases: tuple

bit_line#

Alias for field number 3

device#

Alias for field number 1

output#

Alias for field number 0

word_line#

Alias for field number 2

class badcrossbar.computing.extract.Interconnect(word_line, bit_line)#

Bases: tuple

bit_line#

Alias for field number 1

word_line#

Alias for field number 0

class badcrossbar.computing.extract.Solution(currents, voltages)#

Bases: tuple

currents#

Alias for field number 0

voltages#

Alias for field number 1

class badcrossbar.computing.extract.Voltages(word_line, bit_line)#

Bases: tuple

bit_line#

Alias for field number 1

word_line#

Alias for field number 0

badcrossbar.computing.extract.bit_line_currents(extracted_voltages, extracted_device_currents, r_i)[source]#

Extracts currents flowing through interconnect segments along the bit lines.

Parameters
  • extracted_voltages (Voltages) – Crossbar node voltages. It has fields word_line and bit_line that contain the potentials at the nodes on the word and bit lines.

  • extracted_device_currents (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Currents flowing through crossbar devices.

  • r_i (Interconnect) – Interconnect resistances along the word and bit line segments.

Return type

ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]

Returns

Currents flowing through interconnect segments along the bit lines.

badcrossbar.computing.extract.bit_line_voltages(v, resistances)[source]#

Extracts voltages at the nodes on the bit lines.

Parameters
  • v (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Solution to gv = i in a flattened form.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

Return type

ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]

Returns

Voltages at the nodes on the bit lines.

badcrossbar.computing.extract.currents(extracted_voltages, resistances, r_i, applied_voltages, **kwargs)[source]#

Extracts crossbar branch currents in a convenient format.

Parameters
  • extracted_voltages (Voltages) – Crossbar node voltages. It has fields word_line and bit_line that contain the potentials at the nodes on the word and bit lines.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • r_i (Interconnect) – Interconnect resistances along the word and bit line segments.

  • applied_voltages (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Applied voltages.

  • **all_currents – If False, only output currents are returned, while all the other ones are set to None.

Return type

Currents

Returns

Crossbar branch currents. Named tuple has fields output, device, word_line and bit_line that contain output currents, as well as currents flowing through the devices and interconnect segments of the word and bit lines.

badcrossbar.computing.extract.device_currents(extracted_voltages, resistances)[source]#

Extracts currents flowing through crossbar devices.

Parameters
  • extracted_voltages (Voltages) – Crossbar node voltages. It has fields word_line and bit_line that contain the potentials at the nodes on the word and bit lines.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

Returns

Currents flowing through crossbar devices.

badcrossbar.computing.extract.insulating_interconnect_solution(resistances, applied_voltages, **kwargs)[source]#

Extracts solution when all interconnects are perfectly insulating.

Parameters
  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • applied_voltages (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Applied voltages.

  • **all_currents – If False, only output currents are returned, while all the other ones are set to None.

Return type

Solution

Returns

Branch currents and node voltages of the crossbar.

badcrossbar.computing.extract.output_currents(extracted_voltages, extracted_device_currents, r_i)[source]#

Extracts output currents.

Parameters
  • extracted_voltages (Voltages) – Crossbar node voltages. It has fields word_line and bit_line that contain the potentials at the nodes on the word and bit lines.

  • extracted_device_currents (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Currents flowing through crossbar devices.

  • r_i (Interconnect) – Interconnect resistances along the word and bit line segments.

Return type

ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]

Returns

Output currents.

badcrossbar.computing.extract.solution(resistances, r_i_word_line, r_i_bit_line, applied_voltages, **kwargs)[source]#

Extracts branch currents and node voltages of a crossbar in a convenient form.

Parameters
  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • r_i_word_line (float) – Interconnect resistance of the word line segments.

  • r_i_bit_line (float) – Interconnect resistance of the bit line segments.

  • applied_voltages (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Applied voltages.

  • **node_voltages – If False, None is returned instead of node voltages.

Return type

Solution

Returns

Branch currents and node voltages of the crossbar.

badcrossbar.computing.extract.voltages(v, resistances, **kwargs)[source]#

Extracts crossbar node voltages in a convenient format.

Parameters
  • v (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Solution to gv = i in a flattened form.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

Return type

Voltages

Returns

Crossbar node voltages. It has fields word_line and bit_line that contain the potentials at the nodes on the word and bit lines.

badcrossbar.computing.extract.word_line_currents(extracted_voltages, extracted_device_currents, r_i, applied_voltages)[source]#

Extracts currents flowing through interconnect segments along the word lines.

Parameters
  • extracted_voltages (Voltages) – Crossbar node voltages. It has fields word_line and bit_line that contain the potentials at the nodes on the word and bit lines.

  • extracted_device_currents (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Currents flowing through crossbar devices.

  • r_i (Interconnect) – Interconnect resistances along the word and bit line segments.

  • applied_voltages (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Applied voltages.

Return type

ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]

Returns

Currents flowing through interconnect segments along the word lines.

badcrossbar.computing.extract.word_line_voltages(v, resistances)[source]#

Extracts voltages at the nodes on the word lines.

Parameters
  • v (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Solution to gv = i in a flattened form.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

Return type

ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]

Returns

Voltages at the nodes on the word lines.

badcrossbar.computing.fill module#

badcrossbar.computing.fill.g(resistances, r_i)[source]#

Creates and fills matrix g used in equation gv = i.

Parameters
  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • r_i – Interconnect resistances along the word and bit line segments.

Return type

lil_matrix

Returns

Filled matrix g.

badcrossbar.computing.fill.i(applied_voltages, resistances, r_i)[source]#

Creates and fills matrix i used in equation gv = i.

Values are filled by applying nodal analysis at the leftmost nodes on the word lines.

Parameters
  • applied_voltages (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Applied voltages.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • r_i – Interconnect resistances along the word and bit line segments.

Return type

ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]

Returns

Filled matrix i.

badcrossbar.computing.kcl module#

badcrossbar.computing.kcl.apply(g_matrix, resistances, r_i)[source]#

Fills matrix g used in equation gv = i.

Values are filled by applying Kirchhoff’s current law at the nodes on the word and bit lines.

Parameters
  • g_matrix (lil_matrix) – Matrix g used in equation gv = i.

  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • r_i – Interconnect resistances along the word and bit line segments.

Return type

lil_matrix

Returns

Filled matrix g.

badcrossbar.computing.kcl.bit_line_nodes(g_matrix, conductances, r_i)[source]#

Fills matrix g with values corresponding to nodes on the bit lines.

Parameters
  • g_matrix (lil_matrix) – Matrix g used in equation gv = i.

  • conductances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Conductances of crossbar devices.

  • r_i – Interconnect resistances along the word and bit line segments.

Return type

lil_matrix

Returns

Filled matrix g.

badcrossbar.computing.kcl.word_line_nodes(g_matrix, conductances, r_i)[source]#

Fills matrix g with values corresponding to nodes on the word lines.

Parameters
  • g_matrix (lil_matrix) – Matrix g used in equation gv = i.

  • conductances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Conductances of crossbar devices.

  • r_i – Interconnect resistances along the word and bit line segments.

Return type

lil_matrix

Returns

Partially filled matrix g.

badcrossbar.computing.solve module#

badcrossbar.computing.solve.v(resistances, r_i, applied_voltages)[source]#

Solves matrix equation gv = i.

Parameters
  • resistances (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Resistances of crossbar devices.

  • r_i – Interconnect resistances along the word and bit line segments.

  • applied_voltages (ndarray[Any, dtype[TypeVar(ScalarType, bound= generic, covariant=True)]]) – Applied voltages.

Returns

Matrix containing potentials at each of the nodes.

Module contents#