poxiaoge 发表于 2013-6-13 17:40:59

求助,关于verilog的问题!

题目要求是利用一位全加器、D锁存器或者D触发器实现8位二进制加法器。
module adder1(x,y,ci,s,co);//一位全加器
input x,y,ci;
output s,co;
assign s=(x&!y&!ci)|(!x&y&!ci)|(!x&!y&ci)|(x&y&ci);
assign co=(x&y)|(x&ci)|(y&ci);
endmodule

module dlatch1(clk,d,q);//这个是d锁存器
input clk,d;
output q;
reg q;
always @(clk)
begin
if(clk) q<=d;
end
endmodule

module adderfull(a,b,clk,sum,cout,en);//这个是顶层模块
input a,b,clk,en;
output sum,cout;
reg cin;
always @(en)
if(en==0) cin<=0
adder1 add (a,b,cin,sum,cout);
dlatch1 temp (clk,cout,cin);
endmodule

然后就编译出错了:
Error (10170): Verilog HDL syntax error at adderfull.v(7) near text "adder1";expecting ";"
Error (10112): Ignored design unit "adderfull" at adderfull.v(1) due to previous errors
请问,我这个代码的问题处在哪里?该怎样改?还有没有其它的错误?

7802848 发表于 2013-6-15 12:21:02

不认识简单英文单词真可悲

poxiaoge 发表于 2013-6-15 12:22:55

7802848 发表于 2013-6-15 12:21 static/image/common/back.gif
不认识简单英文单词真可悲

意思当然明白,但是根本不能按它提示的那样改啊,改了也没用,还会提示有其它的错误。

poxiaoge 发表于 2013-6-16 10:13:42

哎,一直没人啊。那么有偿求改错了。qq707886460

mitchell 发表于 2013-6-16 11:04:14

眼睛瞎了吧

y595906642 发表于 2013-6-16 11:08:25

7802848 发表于 2013-6-15 12:21 static/image/common/back.gif
不认识简单英文单词真可悲

哎,我也看到了。。。

7802848 发表于 2013-6-16 15:32:51

poxiaoge 发表于 2013-6-16 10:13 static/image/common/back.gif
哎,一直没人啊。那么有偿求改错了。qq707886460

1000rmb我帮你改
页: [1]
查看完整版本: 求助,关于verilog的问题!