Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Multiplexer Function with Simple C Programming In a project I am working

ID: 657943 • Letter: W

Question

Write a Multiplexer Function with Simple C Programming

In a project I am working on, I have to read an input file with various logic gate commands and perform them on some given inputs. One of the commands I am able to receive is MULTIPLEXER. Here is some more context for what I need help with:

I already an AND and OR function completed.

MULTIPLEXER: This directive represents the multiplexer in logic design. The directive is followed by the number of inputs, names of the inputs, names of the selectors, and the name of the output. The inputs are ordered in gray code sequence. A multiplexer implementing a AND gate (P = A.B) using a 4:1 multiplexer is specified as follows: The above description states that there are 4 inputs to the multiplexer. The four inputs to the multiplexer in gray code sequence are 0 0 10 respectively. The two selector input signals are A and D. The name of the output is P. The circuit description file (hwl-circuit.txt) for the circuit in Figure 1 from Homework 1 is as follows: INPUTVAR 3 A C D OUTPUTVAR 1 Y MULTIPLEXER 4 1 0 1 0 C D w MULTIPLEXER 2 w 1 A Y The input value file (hw1-input.txt) for the circuit is as follow: 1 1 1 1 0 0 0 1 0 When we execute the program the output should be as follows: ./coab hwl-circuit.txt hwl-input.txt 1 1 0

Explanation / Answer

#include<stdio.h>

#include<conio.h>

int AND(int a1,int b1);

int AND2(int b1,intc1);

int NOT(int c1);

int OR(int AND,int AND2);

int main()

{

int a1;

int b1;

int c1;

printf("Enter the value of A");

scanf("%d",&a1);

printf("Enter the value of B");

scanf("%d",&b1);

printf("Enter the value of C");

scanf("%d",&c1);

printf("Value of multiplexer =%d",OR);

getch();

}

int NOT(int c1)

{

int op;

if(c1==0)

op=1

else

op=0

return op;

}

int AND(int a1 ,int NOT)

{

if(a1==1&&NOT==1)

op=1;

else

op=0;

return op;

}

int AND2(int b1,int c1)

{

int op;

if(b1==0&&c1==0)

op=0;

if(b1==1&&c1==0)

op=0;

if(b1==0&&c1==0)

op=0;

if(b1==1&&c1==1)

op=1;

return op;

}

int OR(int AND ,int AND2)

{

int op;

if(AND==0&&AND2==0)

op=0;

if(AND==0&&AND2==1)

op=1;

if(AND==1&&AND2==0)

op=1;

if(AND==1&&AND2==1)

op=1;

return op;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote