You are on page 1of 3

Circuit Simulator

Difficulty Level Low
Suggested Language C++
Maximum Team Size 2
Skill Set C++, GUI, graphics

simple ignore the line. For example:
1. Introduction: CIRCUIT Circuit1
b. The CIRCUIT HEADER will be followed
In this project, you will create a circuit by an unspecified number of INPUT PAD
simulator which reads a circuit definition and DEFINITIONS. An INPUT PAD
an input vector definition and simulate the DEFINITION will consist of the keyword
operation of the circuit over time (up to 60 time “INPUT” followed by a name label and a wire
steps of simulation time or until the circuit number. For example, the following line
output no longer changes). denotes that input pad “A” is associated with
wire number two: INPUT A 2
The purpose of this project is to pull together in c. The INPUT PAD DEFINITIONS will be
a single object-oriented and GUI-based project followed by an unspecified number of
all of the characteristics of the C++ language OUTPUT PAD DEFINITIONS. An
which you’ve learned in this class: file I/O, OUTPUT PAD DEFINITION will have the
pointers, classes, containers, inheritance, and same format as an INPUT PAD
polymorphism. DEFINITION, except the keyword will be
“OUTPUT” rather than INPUT”. For
2. Problem Description: example, the following line denotes that
output pad “E” is associated with wire number
Develop a digital simulator which reads a six: OUTPUT E 6
circuit description and input vector from files d. The OUTPUT PAD DEFINITIONS will be
(formats described below) and performs the followed by an unspecified number of GATE
digital simulation based on these definitions. DEFINITIONS. A GATE DEFINITION
The simulation is to be visualized using a GUI consists of the gate type (one of “NOT” (or
window. “INVERTER”), “AND”, “OR”, “XOR”,
“NAND”, “NOR”, and “XNOR”) followed by
Circuit File Format: In general, a circuit an integer delay value with its nanosecond
definition has the following format: units, followed by the input wire numbers
(two input wires for all gates, except a NOT
CIRCUIT HEADER gate which uses only one), followed finally by
INPUT PAD DEFINITIONS (as many as an output wire number: For example, the
necessary) following line defines an AND gate with a 5
OUTPUT PAD DEFINITIONS (as many as nanosecond delay and having wire 1 and 2 for
necessary) input and wire 4 for output: AND 5ns 1 2 4
GATE DEFINITIONS (as many as necessary)
Vector File Format: An input vector efinition
where: has the following format:
a. The CIRCUIT HEADER consists of the
keyword “CIRCUIT” and a circuit name. You VECTOR HEADER
may use this name to label the circuit, or INPUT PAD VALUE DEFINITIONS (as
many as necessary)

etc. You do Y not have to check that the circuit being input 0 0 0 0 makes sense. and then by the value to which the wire FullAdder class changes. The VECTOR HEADER will be followed Device class by an unspecified number of INPUT PAD Gate class VALUE DEFINITIONS. encapsulation.txt and also flipflop. The VECTOR HEADER consists of the Below you are given a list of possible classes keyword “VECTOR” and a vector name. 3. you don’t have to test that 0 1 0 1 circuit inputs can effect the outputs.g. ignore the line. For example: VECTOR and polymorphism. the line below NOR class indicates that input A changes value at time 0 NAND class to a value of 1: INPUT A 0 1 XOR class Wire class Three-valued Digital Logic: The wires in our Input class digital circuit can take on 3 values: 0. For example. 0 x 0 x 1 0 0 1 Your program should provide a record of the 1 1 1 1 simulation by showing the input and output pad 1 x x 1 histories of the simulated circuit by drawing on x 0 0 x a canvas as well as in a console text window.. composition. for the project.txt and flipflop_v. You should arrange the classes You may use this name to label the into an efficient object-oriented design making simulation output. where: Incomplete) a. or you may simply use of inheritance. Solution Design (Tentative. and X Output class (undefined). perform basic error handling on the input files (including exception handling). 1. Three-Value Truth Table you should gracefully handle “File not found” X Y X AND X OR Y and detect format errors in input files. e. vector1 b.txt. x 1 x 1 Sample circuit and vector definitions are also x x x x provided under the names: circuit1. NOTgate class followed by a time stamp at which the wire Circuit class associated with the name value changes its HalfAdder class value. For example. from these tables you should be able to determine the remainder Other Requirements: Your program must of the gate operations.txt and circuit1_v. . Event class The truth values for three-valued AND and OR Simulation class operations appears below. An INPUT PAD ANDgate class VALUE DEFINITION consists of the ORgate class keyword “INPUT” followed by a name label. The outputs pads and all gate TruthTable class Outputs should be initialized to X at time zero.

. For example: Input A XXXXX000000000001111111111111111111 Time 0 5 10 (or) Input A xxxxxx_________------------------------- Time 0 5 10 Also display the waveforms graphically.Output: Your simulator should have the capability to display the input and output waveforms.