# DigiSim Logic Components > Comprehensive reference for all digital logic components available in DigiSim, including their behavior, pin configurations, and usage in circuit design. ## Component Library Overview DigiSim offers 60+ digital logic components organized into categories: - **Input Components**: Switches, clocks, constants - **Basic Logic Gates**: AND, OR, NOT, NAND, NOR, XOR, XNOR, Buffer - **Sequential Logic**: Flip-flops, latches, registers, counters - **Arithmetic**: Adders, comparators, ALU - **Data Routing**: Multiplexers, demultiplexers, encoders, decoders - **Memory**: RAM, ROM - **Output & Display**: LEDs, 7-segment displays, oscilloscopes, pixel screens - **CPU Architecture**: Program counter, instruction register, control unit, accumulator ## Input Components ### INPUT_SWITCH - **Function**: Manual toggle switch for user input - **Pins**: 1 output - **Behavior**: Click to toggle between 0 and 1 - **Usage**: Primary input control for circuit testing ### CLOCK - **Function**: Configurable frequency clock generator - **Pins**: 1 output - **Default Frequency**: 1Hz (adjustable) - **Behavior**: Continuous square wave output - **Usage**: Synchronous circuit timing, flip-flop clocking ### CONSTANT / CONSTANT_ZERO - **Function**: Fixed logic values - **Pins**: 1 output each - **Values**: CONSTANT (1), CONSTANT_ZERO (0) - **Usage**: Tie inputs to known states, enable signals ## Basic Logic Gates ### AND Gate - **Function**: Logical AND operation - **Pins**: 2-8 inputs, 1 output - **Truth Table**: Output = 1 only when all inputs = 1 - **Symbol**: D-shaped gate with flat input side ### OR Gate - **Function**: Logical OR operation - **Pins**: 2-8 inputs, 1 output - **Truth Table**: Output = 1 when any input = 1 - **Symbol**: Curved input side gate ### NOT Gate (Inverter) - **Function**: Logical inversion - **Pins**: 1 input, 1 output - **Truth Table**: Output = opposite of input - **Symbol**: Triangle with circle (bubble) ### NAND Gate - **Function**: Inverted AND operation - **Pins**: 2-8 inputs, 1 output - **Truth Table**: Output = 0 only when all inputs = 1 - **Symbol**: AND gate with output bubble ### NOR Gate - **Function**: Inverted OR operation - **Pins**: 2-8 inputs, 1 output - **Truth Table**: Output = 0 when any input = 1 - **Symbol**: OR gate with output bubble ### XOR Gate - **Function**: Exclusive OR operation - **Pins**: 2-8 inputs, 1 output - **Truth Table**: Output = 1 when odd number of inputs = 1 - **Symbol**: OR gate with curved input line ### XNOR Gate - **Function**: Inverted exclusive OR - **Pins**: 2-8 inputs, 1 output - **Truth Table**: Output = 1 when even number of inputs = 1 - **Symbol**: XOR gate with output bubble ### BUFFER - **Function**: Non-inverting amplifier - **Pins**: 1 input, 1 output - **Purpose**: Signal conditioning, drive strength - **Symbol**: Triangle without bubble ## Sequential Logic Components ### D Flip-Flop - **Function**: Data storage with clock synchronization - **Pins**: D (data), CLK (clock), PRE (preset), CLR (clear), Q, Q̅ - **Behavior**: Captures D input on clock rising edge - **Usage**: Registers, counters, state machines ### JK Flip-Flop - **Function**: Universal flip-flop with toggle capability - **Pins**: J, K, CLK, PRE, CLR, Q, Q̅ - **Behavior**: Set (J=1,K=0), Reset (J=0,K=1), Toggle (J=1,K=1) - **Usage**: Counters, frequency dividers ### T Flip-Flop - **Function**: Toggle flip-flop for frequency division - **Pins**: T (toggle), CLK, CLR, Q, Q̅ - **Behavior**: Toggles output when T=1 and clock edge occurs - **Usage**: Binary counters, frequency division ### SR Latch - **Function**: Basic memory element - **Pins**: S (set), R (reset), Q, Q̅ - **Behavior**: Set (S=1), Reset (R=1), Hold (S=0,R=0) - **Usage**: Basic memory, debouncing circuits ### D Latch - **Function**: Transparent latch with enable - **Pins**: D (data), EN (enable), Q, Q̅ - **Behavior**: Transparent when EN=1, holds when EN=0 - **Usage**: Data storage, address latching ## Memory and Storage Components ### REGISTER_8BIT - **Function**: 8-bit parallel register - **Pins**: D0-D7 (data), CLK, CLR, Q0-Q7 - **Behavior**: Stores 8-bit data on clock edge - **Usage**: Data storage, CPU registers ### SHIFT_REGISTER_8BIT - **Function**: 8-bit shift register with serial I/O - **Pins**: Serial In, D0-D7, CLK, Mode, CLR, Q0-Q7, Serial Out - **Modes**: Shift left/right, parallel load - **Usage**: Serial-to-parallel conversion, delay lines ### COUNTER_8BIT - **Function**: 8-bit binary counter - **Pins**: CLK, CLR, EN, LOAD, Q0-Q7, Carry - **Behavior**: Increments on clock edge when enabled - **Usage**: Address generation, timing circuits ### RAM - **Function**: Random access memory - **Pins**: Address bus, Data bus, WE (write enable), CS (chip select) - **Behavior**: Read/write data at specified addresses - **Usage**: Data storage, program memory ### ROM - **Function**: Read-only memory - **Pins**: Address bus, Data bus, CS (chip select) - **Behavior**: Outputs pre-programmed data - **Usage**: Program storage, lookup tables ## Arithmetic Components ### ALU_8BIT - **Function**: 8-bit arithmetic logic unit - **Pins**: A0-A7, B0-B7 (operands), Op0-Op2 (operation), R0-R7 (result), flags - **Operations**: ADD, SUB, AND, OR, XOR, NOT, shift operations - **Flags**: Zero, Carry, Negative, Overflow - **Usage**: CPU arithmetic operations ### HALF_ADDER - **Function**: Single-bit addition without carry input - **Pins**: A, B inputs, Sum, Carry outputs - **Behavior**: Sum = A ⊕ B, Carry = A ∧ B - **Usage**: Basic arithmetic building block ### FULL_ADDER - **Function**: Single-bit addition with carry input - **Pins**: A, B, Cin inputs, Sum, Cout outputs - **Behavior**: Full binary addition with carry propagation - **Usage**: Multi-bit adder construction ### ADDER - **Function**: Multi-bit binary addition - **Pins**: A0-A3, B0-B3, Cin, Sum0-Sum3, Cout - **Behavior**: 4-bit binary addition with carry - **Usage**: Arithmetic circuits, address calculation ### ADDER_8BIT - **Function**: 8-bit binary addition - **Pins**: A0-A7, B0-B7, Cin, Sum0-Sum7, Cout - **Behavior**: 8-bit binary addition with carry propagation - **Usage**: CPU arithmetic operations, address calculation ### COMPARATOR - **Function**: 4-bit magnitude comparison - **Pins**: A0-A3, B0-B3 inputs, A>B, A=B, AB, A=B, A