|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
下面是code
module seqdet(clk,reset,x,z);
input clk;
input reset;
input [4:0] x;
output z;
reg [3:0] state;
reg [3:0] next_state;
reg z;
parameter IDLE = 4'd0;
parameter A = 4'd1;
parameter B = 4'd2;
parameter C = 4'd3;
parameter D = 4'd4;
parameter E = 4'd5;
parameter F = 4'd6;
parameter G = 4'd7;
parameter H = 4'd8;
always @ (posedge clk or posedge reset)
if (reset == 1'b1)
state <= IDLE;
else
state <= next_state;
always @ (state or x)
begin
next_state = 4'bxxxx;
case(state)
IDLE: if (x == 5'b11111)
next_state = A;
else if (x == 5'b00000)
next_state = D;
else next_state = IDLE;
A: if (x == 5'b11111)
next_state = B;
else if (x == 5'b00000)
next_state = G;
else next_state = IDLE;
B: if (x == 5'b11111)
next_state = C;
else if (x == 5'b00000)
next_state = G;
else next_state = IDLE;
C: if (x == 5'b00000)
next_state = G;
else
next_state =IDLE;
D: if (x == 5'b00000)
next_state = E;
else if (x == 5'b11111)
next_state = H;
else next_state = IDLE;
E: if (x == 5'b00000)
next_state = F;
else if (x == 5'b11111)
next_state = H;
else state = IDLE;
F: if (x == 5'b11111)
next_state = H;
else
next_state = IDLE;
G: if (x == 5'b00000)
next_state = E;
else if (x == 5'b11111)
next_state = A;
else
next_state = IDLE;
H: if (x == 5'b11111)
next_state = B;
else if (x == 5'b00000)
next_state = D;
else
next_state = IDLE;
default: next_state = IDLE;
endcase
end
always @ (state or x)
begin
case(state)
IDLE: z <= 1'b0;
A: z <= 1'b0;
B: z <= 1'b0;
C: if (x == 5'b11111)
z <= 1'b1;
else z<= 1'b0;
D: z <= 1'b0;
E: z <= 1'b0;
F: if (x == 5 'b00000)
z <= 1'b1;
else z <= 1'b0;
G: z <= 1'b0;
H: z <= 1'b0;
default: z <= 1'b0;
endcase
end
endmodule
就是一个三段式的检测电路,在DC2008中read的时候报错
Error: /home/wqy1985/Desktop/filter/seqdet.v:24: Net 'state[0]' or a directly connected net is driven by more than one source, and not all drivers are three-state. (ELAB-366)
应该是说的我的state被多个驱动了吧??但是我找不出是错在哪里?新人,希望高人指教 |
|