Computers and Technology

Computer architectureprogramming assignment 4: circuit simulatorintroductionyou have to write a circuit simulator. one of the inputs to your program will be a circuit description filethat will describe a circuit using various directives. your program will print the output of the circuit for allpossible input values.1 circuit description directivesthe input variables used in the circuit are provided using theinputvardirective. theinputvardirectiveis followed by the number of input variables and the names of the input variables. all the input variableswill be named with capitalized identifiers. an identifier consists of at least one character (a-z) followed by aseries of zero or many characters (a-z) or digits (0-9). for example, some identifiers arein1,in2, andin3.an example specification of the inputs for a circuit with three input variables: in1,in2,in3is as follows: inputvar 3 in1 in2 in3the outputs produced by the circuit is specified using theoutputvardirective. theoutputvardirective isfollowed by the number of outputs and the names of the outputs. an example specification of the circuit with outputout1is as follows: outputvar 1 out1the circuits used in this assignment will be built using the following building blocks: not, and, or, nand, nor, andxor. the building blocks can produce temporary variables as outputs, and can use either the input variables ortemporary variables as input. output variables will never be used as inputs in a building block. all the temporary variables will also be named with lower case identifiers (i. e.,temp1,temp2,temp3, specification of each building block is as follows: •not: for example, not in1 out1•and: for example, and in1 in2 out1•or: for example, or in1 in2 out1•nand: for example,1 nand in1 in2 out1•nor: for example, nor in1 in2 out1•xor: for example, xor in1 in2 out12 describing circuits using the directivesit is possible to describe any combinational circuit using the above set of directives. for example, the circuitout1 = in1.in2 + in1.in3can be described as follows: inputvar 3 in1 in2 in3outputvar 1 out1and in1 in2 temp1and in1 in3 temp2or temp1 temp2 out1note thatout1is the output variable. in1,in2, andin3are input variables. temp1andtemp2are temporaryvariables. a circuit description is a sequence of directives. you can assume that every temporary variable occurs as aoutput variable in the sequence before occurring as an input variable. note: a temporary variable can occur as an output variable in at most one directive.3 format of the input filesyour program will be given one file as input, containing the description of a circuit using the directivesdescribed above. for example: inputvar 3 in1 in2 in3outputvar 1 out1and in1 in2 temp1and in1 in3 temp2or temp1 temp2 out14 the problemyou have to write a program calledfirstas described above. you are guaranteed that the circuit descriptionsgiven as input to your program will be sorted. let’s look at an example we have encountered before. example executionsuppose a circuit description file named circuit. txt has the description for the circuitout1 = in1.in2 + in1.in32 inputvar 3 in1 in2 in3outputvar 1 out1and in1 in2 temp1and in1 in3 temp2or temp1 temp2 out1then, on executing the program with the above circuit description file, your program should produce thefollowing output: ./first circuit. txt0 0 0 00 0 1 00 1 0 00 1 1 01 0 0 01 0 1 11 1 0 11 1 1 1the output of the first three columns areinputvar in1,in2, andin3respectively. and the last columndenotes theoutputvar out1.note: the values of the input and output variables should be space separated and be in the same order as theoutput variables in , e. g., if the circuit description file has the directiveinputvar 3 in1 in2 in3, andoutputvar 3 out1 out2 out3, then the first values should be those of theinput variablesin1,in2, andin3, and output variableout1, followed by that ofout2, and then that ofout3.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, IHeartDarkSide03
Which is a false statement considering copyright law? a. when people upload something to the internet they automatically receive a copyright for the work b. the work does not have to contain a copyright notice to be considered having a copyright c. copyright is legal term describing rights given to the creators for literary and artistic works d. personal pictures are always covered by copyrights
Answers: 1
image
Computers and Technology, 22.06.2019 18:00, jabezslade22
What is the first view you place in your drawing?
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, bowmanari2154
What is used to analyze and summarize your data without graphical support
Answers: 1
image
Computers and Technology, 23.06.2019 15:30, Dweath50
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
Do you know the correct answer?
Computer architectureprogramming assignment 4: circuit simulatorintroductionyou have to write a cir...

Questions in other subjects:

Konu
Mathematics, 01.03.2020 22:04