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

Verilog design problem: using ANDs and ORs, create a module that performs the ex

ID: 1715735 • Letter: V

Question

Verilog design problem: using ANDs and ORs, create a module that performs the exclusive OR (XOR) function on two input (slider switches). Wire the result to an LED, but only show the result when the center pushbutton is depressed. The LED should be OFF otherwise. then write a program using module: ( with comments)

example:

module main (s0, s1, LED);

input s0;

inputs1;

output wire LED;

always @ (posedge s0, s1)

begin

if (s1==0 && s0==0)

LED <+0;

else if (S1==1 && s0==0)

end

end module

Explanation / Answer

module main (s0, s1, p1LED);

input s0; //switch 1

input s1;//switch 2

input p1; //push button

output wire LED;

and (g,s1,s2); // and between s1 and s2 and store in g

not (k,g); // not g and store in k

or (f, s1, s2); //or between s1 and s2

and (LED, k,f, p1) // and between, the out denied of the and and the or, with the push button

end

end module

X Y Out 0 0 0 0 1 1 1 0 1 1 1 0