Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS1220 - C++ Programming Homework Assignment:Term Project Objective Make circuit simulator which reads a circuit definition (as described below) and aninput vector definition(also described below)and

CS1220 - C++ Programming

Homework Assignment:Term Project

Objective

Make circuit simulator which reads a circuit definition (as described below) and aninput vector definition(also described below)and simulates the operation of the circuit over time (up to60 timestepsof simulation timeor until the circuit output no longer changes).

Description

The purpose of this assignment is topull together in a singleobject-orientedand *optionally*GUI-basedassignmentallof thecharacteristics of the C++ language which you've learned in this class:file I/O, pointers, classes, containers, inheritance, and polymorphism.

Be aware,for most studentsthis projectis significantly more difficult than previous assignments.It is in your best interest to begin the assignment early;otherwise,youmaynotcomplete iton timeif atall.

Detailed Problem Statement:Develop a digital simulator which readsacircuit descriptionand input vectorfrom files(formatsdescribed below) andperforms the digital simulationbased on these definitions.The simulation is to be visualized usinga console window or*optionally*a GUI viawxWidgets.

Circuit File Format:In general, a circuit definitionhas the following format:

CIRCUIT HEADER

INPUT PAD DEFINITIONS (as many as necessary)

OUTPUT PAD DEFINITIONS (as many as necessary)

GATE DEFINITIONS (as many as necessary)

Where:

a.The CIRCUIT HEADER consists ofthe keyword "CIRCUIT" and a circuit name.You may use this name to label the circuit, orsimpleignore the line.For example:CIRCUIT Circuit1

b.The CIRCUIT HEADER will be followed by an unspecified number ofINPUT PAD DEFINITIONS.An INPUT PAD DEFINITION will consist of the keyword "INPUT" followed by a name label and a wire number.For example,the following line denotes that input pad "A" is associated with wire number two:INPUTA2

NOTE:although theexample circuit filesuse single-letter names, your simulator should accommodate names of more than one letter.

c.The INPUT PAD DEFINITIONS will be followed by anunspecified number of OUTPUT PAD DEFINITIONS.An OUTPUT PAD DEFINITION will have the same format as an INPUT PAD DEFINITION, except the keyword will be "OUTPUT" rather thanINPUT".For example, the following line denotes that output pad "E" is associated with wire number six:OUTPUTE6

d.The OUTPUT PAD DEFINITIONS will be followed by an unspecified number of GATE DEFINITIONS.A GATE DEFINITION consists of the gate type (one of"NOT", "AND", "OR", "XOR","NAND","NOR", and "XNOR") followed by an integer delay value with its nanosecond units, followed by the input wire numbers (two input wires for all gates, except a NOT gate which uses only one), followed finally by an output wire number:For example, the following line defines an AND gate with a 5 nanosecond delay and having wire 1 and 2 for input and wire 4 for output:AND5ns 124

Result:Your program should read the circuit file and produce an in-memory representation of the circuit which can be simulated using the information from the vector file (see below) as the initial starting conditions.

Vector File Format:An input vector definition has the following format:

VECTOR HEADER

INPUT PAD VALUE DEFINITIONS (as many as necessary)

Where:

a.The VECTOR HEADER consists of the keyword "VECTOR" and a vector name.You may use this name to label the simulation output, or you may simply ignore the line.For example:VECTORvector1

b.The VECTOR HEADER will be followed by an unspecified number ofINPUT PAD VALUE DEFINITIONS.An INPUT PAD VALUE DEFINITION consists ofthekeyword "INPUT" followed by a name label,followed bya time stamp at which thewireassociated with the name valuechangesitsvalue, andthen bythe value to whichthe wirechanges.For example, the linebelowindicates that input A changes value at time 0 to a value of 1:INPUTA01

Result:Your program should read the vector file and initialize a priority queue of events (one event for each INPUT PAD VALUE DEFINITION).

Three-valued DigitalLogic:The wires in our digitalcircuitcan take on 3 values: 0, 1, and X(undefined).The outputspadsand all gate outputs should be initialized to X at time zero.Thetruth values for three-valuedANDandORoperationsappearsbelow, from these tables you should be able to determine the remainder of the gate operations.

Three-Value Truth Table

X

Y

X AND Y

X OR Y

0

0

0

0

0

1

0

1

0

x

0

X

1

0

0

1

1

1

1

1

1

x

x

1

X

0

0

X

X

1

x

1

X

x

x

X

Interim Deliverables:To encourage an early start on this assignment, you are required to turn in(as a minimum)uploadedclassspecificationsANDimplementations fortheGateandWireobjectsbythe date shown onthe Canvasweb site.The interimdeliverableis worth 20% of the overall assignment.Please note, these classesarelikelynotall of the classes youwillimplement for your solution.Additional classeswhich youmay use areEvent, Queue, Circuit, etc.

OtherRequirements:Yourprogram must performbasicerror handling on theinput files(however, exception handling isnotrequired).For example, you should gracefully handle "File not found" and detect format errors in input files.Any ill-formed input linescansimply be ignored.You do not have to check that the circuitdescriptionmakes sense; e.g., you don't have to test that circuit inputs canaffect the outputs, etc.

Your program should provide a record of the simulation by showing the input and output pad historiesof thesimulatedcircuitina console window or by drawinginawxWidgetsTextField.If developing the *optional* GUI, please use awxFileDialogto choose the circuit and vector files.NOTE:you donotneed toshow the event queue, change the simulation speed, single step, etc.as demonstrated in the example program.

Sample Programs:To get a better feel for the program, you can copy aworking executablesfor both the console and GUI versions from:

S:\DEPT\EG\Computer Science\CS1220\Circuit Sim (TextVersion)\text circuit sim.exeorS:\DEPT\EG\Computer Science\CS1220\Circuit Sim (GUI Version)\circuit sim gui.exe

If you copy the GUI version of the app to your own computer, please be sure to also copy associated button bitmaps (open.bmp, etc.)

Sample Circuits:Sample circuit and vector definitions are also providedin the aforementioned folders or on our course webhere.

Output:Your simulatorshould have thecapability to display the input and output waveforms.The display can just use text charactersin the console windowto show the waveform.For example:

Input AXXXXX000000000001111111111111111111

Time0510

(or)

Input Axxxxxx_________-------------------------

Time0510

*Optionally* usewxWidgetsto display the waveforms.Please select this optiononly afteryou have completed the basic requirements.You will be given10% (15points) extra credit for usingwxWidgetsforfile selection anddisplaying theoutput (assuming thebasic requirements are also met).

FinalDetails

Required for turn-in(NOTE differences in a. and b.):

a.The completed coversheet for this assignment.Pleaseinclud as part of your electronic zipped submission.

b.Program listingsofyour application source codeare NOT required.

c.Provide an electronic zipped submission of ALL your source files (includingyourmain program)viaCanvas uploaded in the same manner as HW5.Please,doNOT send anyotherfilesin your zipped fileother than .h,.cpp,and.docx.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Primary function of root ?

Answered: 1 week ago

Question

The only phyto hormone which is a gas at ordinary temperature?

Answered: 1 week ago

Question

The two fluids that circular in the body?

Answered: 1 week ago

Question

Eliminated from the body?

Answered: 1 week ago