verilog HDL子模块调用子模块 100
我做的是数字时钟,在clk=50Mhz下扫描三个状态,有一个是在clk1hz下计时,另外两个是调整小时和分钟的,always@(posedgeclk)begincase(...
我做的是数字时钟,在clk=50Mhz下扫描三个状态,有一个是在clk1hz下计时,另外两个是调整小时和分钟的,always@(posedge clk)
begin
case(state2)
countime: begin
timing z1(clk1hz,hour,min,sec);
end
chour: begin
if(inc1)
begin
if(hour==8'd23)
begin hour<=8'd00;end
else
begin hour<=hour+1;end
end
end
cmin: begin
if(inc1)
begin
if(min==8'd59)
begin min<=8'd0;end
else
begin min<=min+1;end
end
end
endcase
end
计时的话我又调用了另外一个模块
module timing(clk1hz,hour,min,sec);
input clk1hz;
output hour,min,sec;
reg[7:0] hour,min,sec;
always@(posedge clk1hz)
begin
if(sec==8'd59)
begin sec<='d0;
if(min==8'd59)
begin min<='d0;
if(hour==8'd23)
hour<=8'd0;
else
hour<=hour+1;
end
else
min<=min+1;
end
else
sec<=sec+1;
end
endmodule
可是编译起来有错误在这行
timing z1(clk1hz,hour,min,sec);
错误是Error (10170): Verilog HDL syntax error at inchange.v(16) near text "("; expecting ";", or ","自己改不了了,我想问问是不是可以这样实现,之前使用1hz的信号扫描按键的,烧进去之后按键不好用,现在改成这样不知道可不可以???急,在线等。
如果有人回答继续悬赏 展开
begin
case(state2)
countime: begin
timing z1(clk1hz,hour,min,sec);
end
chour: begin
if(inc1)
begin
if(hour==8'd23)
begin hour<=8'd00;end
else
begin hour<=hour+1;end
end
end
cmin: begin
if(inc1)
begin
if(min==8'd59)
begin min<=8'd0;end
else
begin min<=min+1;end
end
end
endcase
end
计时的话我又调用了另外一个模块
module timing(clk1hz,hour,min,sec);
input clk1hz;
output hour,min,sec;
reg[7:0] hour,min,sec;
always@(posedge clk1hz)
begin
if(sec==8'd59)
begin sec<='d0;
if(min==8'd59)
begin min<='d0;
if(hour==8'd23)
hour<=8'd0;
else
hour<=hour+1;
end
else
min<=min+1;
end
else
sec<=sec+1;
end
endmodule
可是编译起来有错误在这行
timing z1(clk1hz,hour,min,sec);
错误是Error (10170): Verilog HDL syntax error at inchange.v(16) near text "("; expecting ";", or ","自己改不了了,我想问问是不是可以这样实现,之前使用1hz的信号扫描按键的,烧进去之后按键不好用,现在改成这样不知道可不可以???急,在线等。
如果有人回答继续悬赏 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询