夏宇聞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

仿真結果:

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