Circuit Simulator
Circuit Simulator
Circuit Simulator
a. The VECTOR HEADER consists of the Below you are given a list of possible classes
keyword VECTOR and a vector name. for the project. You should arrange the classes
You may use this name to label the into an efficient object-oriented design making
simulation output, or you may simply use of inheritance, encapsulation, composition,
ignore the line. For example: VECTOR and polymorphism.
vector1
b. The VECTOR HEADER will be followed Device class
by an unspecified number of INPUT PAD Gate class
VALUE DEFINITIONS. An INPUT PAD ANDgate class
VALUE DEFINITION consists of the ORgate class
keyword INPUT followed by a name label, NOTgate class
followed by a time stamp at which the wire Circuit class
associated with the name value changes its HalfAdder class
value, and then by the value to which the wire FullAdder class
changes. For example, 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, 1, and X Output class
(undefined). The outputs pads and all gate TruthTable class
Outputs should be initialized to X at time zero. Event class
The truth values for three-valued AND and OR Simulation class
operations appears below, from these tables
you should be able to determine the remainder Other Requirements: Your program must
of the gate operations. perform basic error handling on the input files
(including exception handling). For example,
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. You do
Y not have to check that the circuit being input
0 0 0 0 makes sense; e.g., you dont have to test that
0 1 0 1 circuit inputs can effect the outputs, etc.
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.
x 1 x 1
Sample circuit and vector definitions are also
x x x x
provided under the names: circuit1.txt and
circuit1_v.txt and also flipflop.txt and
flipflop_v.txt.
Output: Your simulator should have the
capability to display the input and output
waveforms. For example:
Input A
XXXXX000000000001111111111111111111
Time
0 5 10
(or)
Input A
xxxxxx_________-------------------------
Time
0 5 10