//设计描述<br />`timescale 1ns / 1ps<br /><br />module compare(equal,a,b);<br />input a,b;<br />output equal;<br />assign equal=(a==b)?1:0;<br /><br />endmodule<br /><br />//测试代码<br />`timescale 1ns / 1ps<br />`include "./compare.v"<br />module testcompare_v;<br /><br />reg a,b;<br />wire equal;<br />compare m(.equal(equal),.a(a),.b(b)); <br />initial<br />begin <br />a=0;<br />b=0;<br />#100 a=0;b=1;<br />#100 a=1;b=1;<br />#100 a=1;b=0;<br />#100 a=0;b=0;<br />#100 $stop;<br />end<br /> <br />endmodule<br /><br />语法没有错,可出来的波形不对,谁知道是什么原因? |
|