mux3.v

来自「多个Verilog和vhdl程序例子」· Verilog 代码 · 共 23 行

V
23
字号
// Multiplexor example 3

module mux3(out, a, b, sel);
output out;
input a, b, sel;
reg out;

/* changes on a, b, and sel trigger the 
always block to execute */
always @(a or b or sel)
begin
	/* check the value of the sel input. 
	If sel is true, set out to a, otherwise
	set out to b. */
	if (sel) begin
		out = a; 
	end else begin
		out = b;
	end
end

endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?