Advertisement
Noah_William

3.1.1

Apr 21st, 2022
1,530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2.  
  3. module lab1_3_1_source(
  4.     input x,
  5.     input y, //x and y are the two inputs to the MUX
  6.     input s, //s is the switch that determines the output
  7.     output reg m //output is a reg as we wish the LED to hold its' state
  8. );
  9.    
  10.     always @ (x or y or s) //sensitivity list contains x, y, and s as they are the operators that determine the output
  11.         if(s==0)
  12.             m=x; //if switch is in position 0 then take value of x to determine m
  13.         else
  14.             m=y; //if switch is in position 1 then take value of y to determine m
  15. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement