Your tasks Task 1: an exclusive-or gate In addition to AND and OR gates, one commonly also needs an XOR gate (meaning eXclusive-OR). Its graphical presentation as well as semantics are given in the following figure: 0 0 1 XOR XOR 0 1 1X09-1 XOR 1x0 XOR Your task is to implement the method buildXOR in gatetasks. scala which should return a gate forming an XOR operation on the two input gates. Task 2: a majority-of-three gate In many safety-critical applications one has to take into account that some of the components may fail for some reason. One way to cope (to a limited degree) with failures is to replicate the component functionality and then select the output value for which the majority of the components agree. For instance, one could implement the same functionality with three different circuits and then take majority value of the output bits. Your task is to implement the method buildMajorityOfThree in gatetasks. scala which should return a "majority of three" selection gate from the three input gates. For example, if the three inputs are 0, 0, and 1, then we must output 0 because 0 occurs in two inputs, which form the majority over the minority of 1, which occurs in only one input.
Your tasks Task 1: an exclusive-or gate In addition to AND and OR gates, one commonly also needs an XOR gate (meaning eXclusive-OR). Its graphical presentation as well as semantics are given in the following figure: 0 0 1 XOR XOR 0 1 1X09-1 XOR 1x0 XOR Your task is to implement the method buildXOR in gatetasks. scala which should return a gate forming an XOR operation on the two input gates. Task 2: a majority-of-three gate In many safety-critical applications one has to take into account that some of the components may fail for some reason. One way to cope (to a limited degree) with failures is to replicate the component functionality and then select the output value for which the majority of the components agree. For instance, one could implement the same functionality with three different circuits and then take majority value of the output bits. Your task is to implement the method buildMajorityOfThree in gatetasks. scala which should return a "majority of three" selection gate from the three input gates. For example, if the three inputs are 0, 0, and 1, then we must output 0 because 0 occurs in two inputs, which form the majority over the minority of 1, which occurs in only one input.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please use Scala to solve this question
package gatetasks
import tinylog._
object factory:
/**
Returns a gate containing the eXclusive OR of the two input gates
*/
def buildXOR(in1 : Gate, in2: Gate) : Gate =
// TASK 1: Return a gate which contains the exclusive or (XOR) of the two
// input gates.
// Hints: - Remember that gates can be combined to create new gates using
// logic operators || and && and negated using !
// - You can NOT check/compare the .value method of the gates as
// values are not set at the time you 'connect' the gates
// (remember that you are building a [very small] circuit)
// Write your formula here:
???
end buildXOR
/**
* Returns the majority state of gates in1, in2, in3
*/
def buildMajorityOfThree(in1 : Gate, in2 : Gate, in3 : Gate) : Gate =
// TASK 2: Return a gate which evaluates to
// false - if two or three are false
// true - if two or three are true
//
// Hint: You are looking for a logic expression involving the three gates
// As always it will help to write the truth table or draw a diagram
// first
// Write your formula here:
???
end buildMajorityOfThree
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Hello, could you please help me to merge these two codes together? We are only allowed to submit one document. Thank you so much
Solution
by Bartleby Expert
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY