夏宇闻verilog第十章答案_练习一

内容经过我的仿真和测试,若有错漏,请留言指出!

源码:

module Com(a,b,out);
input [7:0] a,b;
output out;
assign out = (a > b)? 1:0;

endmodule

测试代码:

`timescale 1ns/1ns
module com8;
reg [7:0]a,b;
wire out;
initial
begin
	a = 8'h0;
	b = 8'h0;
	repeat(20)//总共仿真时间来200ns就够了
	begin
		#10
		a = ($random)%8'hff;
		b = ($random)%8'hff;
	end
end
Com Com0(
			.a(a),
			.b(b),
			.out(out)
		);
endmodule

仿真结果:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章