Error (10200): Verilog HDL Conditional Statement error at ***.v(66): cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct
错误代码
always @(posedge CLK or negedge SYS_RST) begin
if (WEN == 1'b1) begin
if (~SYS_RST) begin
SomeRegister <= 0;
end else begin
SomeRegister <= SomeData;
end
end
end
always @(posedge CLK or negedge SYS_RST) begin
if (~SYS_RST) begin
// 系统复位时的操作
// 这里的逻辑会在复位信号有效时执行
SomeRegister <= 0;
end else if (WEN == 1'b1) begin
// 当 WEN 为高电平时执行的逻辑
// 这里放置需要在 WEN 为高时执行的代码
SomeRegister <= SomeData;
end
end
或者不考虑异步复位,可以将其他信号放在判断的第一层:
always @(posedge CLK) begin
if (WEN == 1'b1) begin
SomeRegister <= SomeData;
end
end