subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Which of the following is true of operations within a spreadsheet program’s built-in functions? a. operations within parentheses, then multiplication and division, and then addition and subtraction are computed. b. operations within parentheses, then addition and subtraction, and then multiplication and division are computed. c. multiplication and division, then addition and subtraction, and then operations within parentheses are computed. d. addition and subtraction, then multiplication and division, and then operations within parentheses are computed
Answers: 2
question
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
question
Computers and Technology, 24.06.2019 01:00
Verify each identity[tex] \frac{csc}{cot \: x \: + \: tan \: x} = cos \: x[/tex]
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Which feature of a blog to restore and retrieve older post
Answers: 3
You know the right answer?
Computer architectureprogramming assignment 4: circuit simulatorintroductionyou have to write a cir...
Questions
question
Biology, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Biology, 18.09.2020 14:01
question
Biology, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Biology, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Geography, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
question
Mathematics, 18.09.2020 14:01
Questions on the website: 13722360