mod16c.vl

来自「with this rar file i am sending five sou」· VL 代码 · 共 42 行

VL
42
字号
module mod16c(control,load,clk,out);
	input control,load,clk;
	output [3:0]out;
    reg [3:0]out;
initial out=0000;
	always @(negedge clk or posedge clk)
	begin
		if(load)
			out <= 4'b0000;
		else if(control)
		begin
			if(out<16)
				out <= out+1;
			else
				out <= 4'b0000;
		end
		else
			out <= out;
	end
endmodule


module Test();
	reg control,load,clk;
	wire [3:0]out;
	mod16c m1(control,load,clk,out);
always
	#1 clk=!clk;
initial
	begin
		clk=0;control=0;load=0;
	
	#1	control=1;
	#18	$finish;
	end
initial
		$monitor("clk::%b \t control::%b \t load::%b \tout::%0d",clk,control,load,out);
endmodule



⌨️ 快捷键说明

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