学习一例子,按照书上打入:
------------compare.v-------------------------
module compare(equal,a,b);
input a,b;
output equal;
assign equal=(a==b)?1:0;
endmodule
----------------test.v-----------------------------
------set top level entity------------------------
`timescale 1ns/1ns
`include "./compare.v"
module comparetest;
reg a,b;
wire equal;
initial //
begin
a=0;
b=0;
#100 a=0; b=1;
#100 a=1; b=1;
#100 a=1; b=0;
#100 $stop; //ϵͳÈÎÎñ£¬ÔÝÍ£·ÂÕæÒÔ±ã¹Û²ì·ÂÕæ²¨ÐΡ£
end
compare compare1(.equal(equal),.a(a),.b(b));
endmodule
在QuartusII中编译,但编译不能通过,出现的错误信息是:
Error (10228): Verilog HDL error at compare.v(1): module "compare" cannot have duplicate definition
Error: Entity "compare" in file Test1.v already exists in file compare.v
请高手指点一下。 |