PyCirc - Python Logic Circuit Modeling
and Simulation Package

Installing the PyCirc package

Loading the PyCirc package

Introduction

Example 1: The Circuit FOO

Circuit libraries

Gates as Cell Instances


The Circuit FRED

The Circuit HAM

Cell Query and Manipulation

4x1 Multiplexer Design

Truth Assignments in PyCirc

Here are some code examples for manipulating an Assign object

How to initialize a PyCirc object?

Getting the circuit output

Assignment Iterator

8x1 Multiplexer Design

3-bits Adder Design

ADDER9 - 9-bits Adder Design

Full Adder

Boolean Operators

def AND(a, output="y"):
    o = Assign(output)
    for x in a:
        if a[x] == 0:
            for y in o: o[y] = 0
            return o
    for y in o: o[y] = 1
    return o

def OR(a, output="y"):
    o = Assign(output)
    for x in a:
        if a[x] == 1:
            for y in o: o[y] = 1
            return o
    for y in o: o[y] = 0
    return o

def NOR(a, output="y"):
    o = Assign(output)
    o1 = OR(a, Assign("y"))
    b = Assign("x", o1["y"])
    return NOT(b, o)

def XOR(a, output="y"):
    o = Assign(output)
    if sum(a[x] for x in a) == 1:
        for y in o: o[y] = 1
        return o
    else:
        for y in o: o[y] = 0
        return o
def ZERO(a=None, output="y"):
    o = Assign(output)
    for y in o: o[y] = 0
    return o

def ONE(a=None, output="y"):
    o = Assign(output)
    for y in o: o[y] = 1
    return o

Creating Cells with the Cell Class

Advanced Topics -- To be Continued ...