Digital Circuit Simulator - DigiLab

Abstract

An Object Oriented Digital Circuit Simulator (DigiLab), capable of simulating almost any digital circuit on the amateur and professional levels. The code was implemented using the simulation powers of Object Oriented Programming (OOP) via Borland's C++ ver. 3.1 compiler. For more information about the project please find the document "Project Briefing". You can download DigiLab and source code by clicking here. Digilab is an open source project bound by the GNU General Public License. You can contribute to the project at Source Forge.

Project Briefing:

Project Subject: Emphasizing the power of OOP through a practical project.

Project Application: DigiLab a Digital Circuit Simulation software package.

Project Supervisor: Dr. Mohsen Rashwan.

Project represented by: Amr A. Awadallah, Magdi Omar Amer, Nael F. Osman.

Project Summary:

This project was selected at first place to show the power of using OOP in programming a large scale project. OOP stands for Object Oriented Programing. There is no one single clear definition of OOP, but the following definitions may help clarify your conception of OOP. OOP is a new revolutionary technique of modeling software based on real-world objects, i.e. it is a programming style that mimics the way all of us get things done. OOP in it self is not a programming language, rather, it is a programming style that could be used with any of the programming languages present today, to simplify the software life-cycle of any project (specially large projects). In simple words OOP is a new way of organizing programs, that makes life much more easier for the serious ambitious professional programmer.

Loosely speaking, OOP refers to a new way of organizing programs into objects that encapsulates data with a set of well-defined operations and that share code with other objects in a predefined hierarchy by inheritance. Although OOP techniques can be implemented in any programming language (C being a good example), it is easier when the language has the features necessary to support objects. OOP is a direct response to the complexity of modern applications, complexity that has often made many programmers throw up their hands in despair. Inheritance and encapsulation are extremely effective means for managing complexity.

Far more than structured programming, object orientation imposes a rational order on software structures that, like a taxonomy chart, imposes order without imposing limits. Add to that the promise of the extendibility and reusability of existing code, and the whole thing begins to sound almost too good to be true. It's a whole new world.

C++ is a superset of C designed to support OOP through its class data type, the concept of overloading functions, operators and virtual functions. The class type with overloaded functions and operators support Data Abstraction and Inheritance, the virtual functions provide the mechanism for implementing Polymorphism. C++ is one of the best languages (at the present time) that supports OOP to its full extent. C++ offers the programmer the base for realizing all his dreams through one of the best structured languages ever devised.

We decided to use Borland's C++ as the compiler to write the project on, because it has all features required for serving an OOP programmer. The project it self is a Digital Circuit Simulator that simplifies the design and testing of any small scale to medium scale hard-ware project. We call this simulator DigiLab.

DigiLab forced us to use OOP, because it is not just a large scale project, but it is a simulation one as well. Thus it is very suitable for emphasizing the powers of OOP, where an AND-gate is realized as AND-object within the conceptual supreme data abstraction programming level of OOP.

DigiLab it self is not a simple program. We thought so at first, but DigiLab's size and capabilities inflated largely while we went on programming it, to a degree which makes DigiLab stand as one of the simplest, but powerful, Digital Circuit Simulation software packages present at the time. DigiLab is recommended for students studying electronics, specially those studying digital circuits. It has a lot of features that make life easier for the beginner and professional logic circuit designer. Starting from simple draw and run options to complicated timing diagrams debugging and creation of new macros1 .

DigiLab has the following features:

  • An easy to use interactive menu driven User Interface.
  • An easy to draw method, with an intelligent drawing mechanism.
  • A predefined library of 37 digital elements.
  • The ability of the user to create new digital elements known as Macros.
  • Combinational, as well as Sequential, logical circuits support.
  • Feed-Back Simulation and compensation.
  • More than one circuit can be drawn and tested on the same board.
  • Simple Connection and Bit Flow Strategy.
  • Draw and Go option.
  • Change parameters of elements while running.
  • Step by Step debugging option.
  • Create Timing Diagrams.
  • Run with or without Timing Diagrams.
  • Divide and Conquer Design support.
  • The capability to open more than one circuit simultaneously.
  • On-Line circuit save and load compression to reduce the size of the circuit on back storage.
  • Detection of trivial circuit errors.
  • DigiLab is a program designed to efficiently run digital circuit simulations. It is not a drafting program, i.e. you do not use it to draw nice circuit diagrams for digital circuits. On the other hand it is a design program which helps you in designing your own digital circuits and trying them out on the computer first. If you found that your implementation works well on the computer, then you could go ahead and start realizing it as hardware. Otherwise, you should go on debugging the logic of your design on the computer, with the powerful debugging features of our program, until finally your circuit works. After that you could start realizing the logic circuit as hardware.

    This doesn't only cut down the time required for building a logical circuit, it also makes the testing process easy and straight forward. Because, if after testing the circuit on DigiLab and realizing it as hardware, if a bug occurred and the hardware circuit didn't work, you will know that the error is somewhere in the connections or in one of the ICs, but not in the logic. Because you already tested the logic of the circuit on the computer and know that it is correct, i.e. DigiLab limits the bugs that could occur during a hardware realization to those of wrong connections and faulty ICs. Not just that, after trying DigiLab you will find that debugging a logical circuit on it is much more easier than debugging the hardware directly. This is because DigiLab offers you a better view of the circuit, where you are as near as 100% sure of all of the connections, due to its simple connection and bit flow strategy.

    To aid the debugging process, DigiLab has the facility to observe the Timing Diagrams (wave forms) of any part in the circuit. This feature is not only useful for debugging, but also it simplifies the testing process, where hazards can be spotted right away on the Step-by-Step timing diagrams.

    For the professional logical circuit designer we added the feature of creating Macros. A Macro is simply a new IC which the user of DigiLab could build from scratch. You could simply draw a circuit and assign to it input pins and output pins, then ask DigiLab to learn this circuit as a new predefined IC (or macro) and add it to the library. Since usually large digital circuit projects are designed by the Divide and Conquer technique, they are broke into modules, therefore you could convert these modules in to macros, and finally collect them all in a single circuit just as you have drawn them on paper.

    Concluding, we may say that DigiLab is one of the best and cheapest digital circuit simulators at the time, that support from simple logic circuits to most complicated ones, to satisfy the needs of professional and amateur logic designers, at a level that both could enjoy and understand. DigiLab is equipped by debugging aids that reduce the logical design cycle of any medium scale project to nearly half the time needed to complete this cycle by realizing the logic circuit as hardware directly.

    M.A.N. July 1992

    _______________________________

    1 A Macro is a modular structure similar to the IC, that allows the user to define new elements and add them to DigiLab's library.

    Page maintained by Amr A. Awadallah (If you have comments or suggestions, email me at aaa@cs.stanford.edu)