求教!延时输出的Verilog代码错在哪里,如何解决? 20
moduledelay_release(inputrst_n,inputclk,inputHV_crtl_switch_2,inputHV_interlock,outpu...
module delay_release
(
input rst_n,
input clk,
input HV_crtl_switch_2,
input HV_interlock,
output delay_release
);
reg delay_reg;
reg [27:0] count_reg;
reg out_reg;
always@(posedge clk or negedge rst_n)
begin
if(!rst_n)
delay_reg<=1'b0;
count_reg<=28'b0;
out_reg<=1'b0;
else
delay_reg<=HV_crtl_switch_2 & HV_interlock;
end
always@(posedge clk or negedge rst_n)
begin
if(delay_reg==1'b1)
count_reg<=count_reg+1'b1;
if(count_reg==28'd199_999_999)
out_reg<=delay_reg;
else
count_reg<=1'b0;
end
assign delay_release=out_reg;
endmodule
报错:Error (10170): Verilog HDL syntax error at delay_release.v(20) near text "else"; expecting "@", or "end", or an identifier ("else" is a reserved keyword ), or a system task, or "{", or a sequential statement 展开
(
input rst_n,
input clk,
input HV_crtl_switch_2,
input HV_interlock,
output delay_release
);
reg delay_reg;
reg [27:0] count_reg;
reg out_reg;
always@(posedge clk or negedge rst_n)
begin
if(!rst_n)
delay_reg<=1'b0;
count_reg<=28'b0;
out_reg<=1'b0;
else
delay_reg<=HV_crtl_switch_2 & HV_interlock;
end
always@(posedge clk or negedge rst_n)
begin
if(delay_reg==1'b1)
count_reg<=count_reg+1'b1;
if(count_reg==28'd199_999_999)
out_reg<=delay_reg;
else
count_reg<=1'b0;
end
assign delay_release=out_reg;
endmodule
报错:Error (10170): Verilog HDL syntax error at delay_release.v(20) near text "else"; expecting "@", or "end", or an identifier ("else" is a reserved keyword ), or a system task, or "{", or a sequential statement 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询