Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The name of this file is Mux2to1.v
- // *********************************************************
- // This module describes a 2-to-1 MUX. Inputs to the module are two
- // data input lines and a control signal; the output is a Data_out.
- // *********************************************************
- //Marks the beginning of a new module, and it's inputs and outputs.
- module mux2to1(Data_in_0,Data_in_1,sel, Data_out);
- //Sets the inputs of the module.
- input Data_in_0, Data_in_1, sel;
- //Sets the output of the module.
- output Data_out;
- //Creates a register, because registers can...actually. Not quite sure...
- reg Data_out;
- //Marks the beginning of an always block.
- always @(Data_in_0,Data_in_1,sel)
- begin
- //Selects one of the inputs, and assigns it to the output.
- if(sel == 0)
- Data_out = Data_in_0;
- else
- Data_out = Data_in_1;
- //Marks the end of the always block.
- end
- //Marks the end of the module.
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment