mux2.v

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

V
23
字号
// Multiplexor example 2

module mux2(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. */
	case (sel)
		1'b1: out = a;
		1'b0: out = b;
		default: out = 'bx;
	endcase
end

endmodule

⌨️ 快捷键说明

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