3. SimpleBoardElements module - Siromanec/logic_discr GitHub Wiki

SimpleBoardElements(SBE)

This module contains templates for logic gates, switches, clocks, and signal sources. In reality these elements consist of transistors, resistors and elecricity sources. The project doesn't go on a such low level, but we still simulate enough to be able to build logical circuits as one wishes.

AND_Gate

attributes:

inherits attributes from BaseCircuitElement (BCE)

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 2.

operation - performs "and" operation on all inputs and sends the output on output pins

set_reaction_areas_for_pins - used for UI

NAND_Gate

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 2.

operation - performs "and" operation on all inputs and then inverts it with "not" and sends the output on output pins

set_reaction_areas_for_pins - used for UI

OR_Gate

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 2.

operation - performs "or" operation on all inputs and sends the output on output pins

set_reaction_areas_for_pins - used for UI

NOR_Gate

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 2.

operation - performs "or" operation on all inputs and then inverts it with "not" and sends the output on output pins

set_reaction_areas_for_pins - used for UI

XOR_Gate

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 2.

operation - performs "xor" operation on all inputs and sends the output on output pins

set_reaction_areas_for_pins - used for UI

XNOR_Gate

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 2.

operation - performs "xor" operation on all inputs and then inverts it with "not" and sends the output on output pins

set_reaction_areas_for_pins - used for UI

NOT_Gate

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 1.

operation - performs "not" operation on all input and sends the output on output pins

set_reaction_areas_for_pins - used for UI

ZERO_Generator

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 0.

operation - sends logical "0" on output pins

set_reaction_areas_for_pins - used for UI

ONE_Generator

attributes:

inherits attributes from BCE

img_path - path to the texture

methods:

inherits methods from BCE

__init__ - out: 1; in: 0.

operation - sends logical "1" on output pins

set_reaction_areas_for_pins - used for UI

Lamp

attributes:

inherits attributes from BCE

img_path - path to the texture of current state of the object

images - dictionary of texture paths for each state

changes_img = True

methods:

inherits methods from BCE

__init__ - out: 0; in: 1.

operation - shines if has logical "1" as input

set_reaction_areas_for_pins - used for UI

Switch

attributes:

inherits attributes from BCE

img_path - path to the texture of current state of the object

images - dictionary of texture paths for each state

changes_img = True

methods:

inherits methods from BCE

__init__ - out: 1; in: 0.

operation - sends the state of the element on output pins

switch - changes the state of element

set_reaction_areas_for_pins - used for UI

ClockGenerator

attributes:

inherits attributes from BCE

img_path - path to the texture of current state of the object

images - dictionary of texture paths for each state

changes_img = True

methods:

inherits methods from BCE

__init__ - out: 1; in: 0.

generation - switches the state of the element in a set interval

destroy - stops generation

set_reaction_areas_for_pins - used for UI