内容经过我的仿真和测试,若有错漏,请留言指出!
源码:
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
仿真结果: