iMackshun

Mus2to1_Testbench.v

Feb 12th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. // The name of this file is Mux2to1.v
  2. // *********************************************************
  3. // This module describes a 2-to-1 MUX. Inputs to the module are two
  4. // data input lines and a control signal; the output is a Data_out.
  5. // *********************************************************
  6. //Marks the beginning of a new module, and it's inputs and outputs.
  7. module mux2to1(Data_in_0,Data_in_1,sel, Data_out);
  8. //Sets the inputs of the module.
  9. input Data_in_0, Data_in_1, sel;
  10. //Sets the output of the module.
  11. output Data_out;
  12. //Creates a register, because registers can...actually. Not quite sure...
  13. reg Data_out;
  14. //Marks the beginning of an always block.
  15. always @(Data_in_0,Data_in_1,sel)
  16. begin
  17. //Selects one of the inputs, and assigns it to the output.
  18. if(sel == 0)
  19. Data_out = Data_in_0;
  20. else
  21. Data_out = Data_in_1;
  22. //Marks the end of the always block.
  23. end
  24. //Marks the end of the module.
  25. endmodule
Advertisement
Add Comment
Please, Sign In to add comment