Project documentation - archy-co/l4logic Wiki

Original URL: https://github.com/archy-co/l4logic/wiki/Project-documentation

elements.py

This module contains implementations of logic elements. The following classes were implemented:

Connnection

Represents the connection between the output of some element and the input of another element.

Attributes:

BasicElement

An abstract class for defining the interface of the logic elements. The logic element:

Attributes:
Methods:

BasicLogicGate(BasicElement)

An abstract class for basic logic gates (such as AND, OR, XOR, NAND, NOR). AndGate, OrGate, XorGate, NandGate and NorGate classes inherit from this class. This class provides multi-input variants of the elements mentioned above.

Attributes:
Methods:

AndGate(BasicLogicGate)

AND logic gate with multiple inputs and one output.

Attributes:
Methods:

OrGate(BasicLogicGate)

OR logic gate with multiple inputs and one output.

Attributes:
Methods:

XorGate(BasicLogicGate)

XOR logic gate with multiple inputs and one output.

Attributes:
Methods:

NandGate(BasicLogicGate)

NAND logic gate with multiple inputs and one output.

Attributes:
Methods:

NorGate(BasicLogicGate)

NOR logic gate with multiple inputs and one output.

Attributes:
Methods:

NotGate(BasicElement)

NOT logic gate with one input and one output.

Attributes:
Methods:

Constant(BasicElement)

Constant source of signal.

Attributes:
Methods:

Variable(BasicElement)

Variable source of signal.

Attributes:
Methods:

Multiplexer(BasicElement)

A class for multiplexer element. A multiplexer has n select lines and 2**n input lines. The select lines decide signal from which input line to send to the output.

Attributes:
Methods:

Encoder(BasicElement)

A class for encoder element. An encoder knows the number of the high input line, and outputs this number represented by n output lines. If several input lines are high, this implementation of encoder takes into account the first one that is high. If none of input lines are high, then the all the output lines are low. The interface of the encoder element is the following:

Attributes:
Methods:

Decoder(BasicElement)

A class for decoder element. A decoder reads the number represented by n input lines and based on that turns on one of 2**n output lines. The interface of the encoder element is the following:

Attributes:
Methods:

FullAdder(BasicElement)

A class for full adder element. A full adder element calculates the sum of three bits (2 summands and 1 carry) and outputs the sum and the resulting carry. The interface of the full adder element is the following:

Attributes:
Methods:

AdderSubtractor(BasicElement)

A class for adder-subtractor element. An adder-subtractor element calculates the sum or the difference (based on the state of 'sub') of two n-digit numbers. The interface of an adder-subtractor element is the following:

Attributes:
Methods:

RightShifter(BasicElement)

A class for right shifter element. A right shifter element shifts bits by some number of bits that depends on which shift line is high. In cases when several or zero shift lines are high, the element behaves according to the scheme it implements. The following scheme is implemented in this class: images/schemes/right_shifter.png Note that it is reasonable to use this element with a decoder. The interface of a right shifter element is the following:

Attributes:
Methods:

GatedSRFlipFlop(BasicElement)

A class for Gated SR (set - reset) flip-flop element. A Gated SR flip-flop can store a single bit. It can be either turned on or turned off. If it's turned on then it acts like regular SR latch It it's turned off then is doesn't react to any change of R and S and return saved output state The truth table of this element is the following:

Attributes:
Methods:

GatedDFlipFlop(BasicElement)

A class for gated D (data) flip-flop element. A gated D flip-flop can store a single bit. It behaves exactly as gated SR flip flop but has 2 inputs instead of 3 and it always behaves predictably The truth table of this element is the following:

Attributes:
Methods:

visualize.py

This module visualizes the object of Scheme class.

Visualizer

Visualize scheme elements with schemdraw library.

Attributes:

main.py

This module contains GUI realization and combines all other modules.

SchemeGUI

Encapsulates tkinter widgets and events bound functions.

Methods:

scheme.py

Implements Scheme class and related exceptions

Scheme

Attributes

Methods