TA的每日心情 | 难过 2019-8-5 22:11 |
---|
新手入门
- 积分
- 13
|
module test(clk,rst_n,dv,data,num);
input clk;
input rst_n;
input dv;
input [7:0]data;
output [3:0]num;
reg [3:0]cnt;//寄存器类型变量
reg [2:0]state;//寄存器类型变量
always@(posedge clk or negedge rst_n)
if(!rst_n)begin
state<=3'd0;
cnt<=4'd0;
end
else begin
case(state)
if(data=="w")
state<=3'd1;
else
state<=3'd0;
if(data=="e")
state<=3'd2;
else if (data=="w")
state<=3'd1;
else
state<=3'd0;
if(data=="l")
state<=3'd3;
else if (data=="w")
state<=3'd1;
else
state<=3'd0;
if(data=="c")
state<=3'd4;
else if (data=="w")
state<=3'd1;
else
state<=3'd0;
if(data=="o")
state<=3'd5;
else if (data=="w")
state<=3'd1;
else
state<=3'd0;
if(data=="m")
state<=3'd0;
cnt<=cnt+1'd1;
else if (data=="w")
state<=3'd1;
else
state<=3'd0;
default:state<=3'd0;
endcase
end
endmodule
仿真报错:Error (10170): Verilog HDL syntax error at test.v(21) near text "if"; expecting an operand
请问是哪里出问题了呢?
|
|