大家好, 我用的是Lidero V9.0,发现综合过程中D触发器的置零端是下降沿触发清零,我想请问能不能调整某个参数使之变成上升沿触发置零的情况,或者有其他办法使之变成综合成上升沿置零。下面是我的代码,我本来是“always @ (posedge clk or posedge rst)”,但是在modlesim后仿真显示错误"$recovery( negedge CLR:499100 ps, posedge CLK:499270 ps, 200ps",后来我改成了“ always @ (negedge clk or posedge rst)“后,modlesim后仿真成功。
module div
(
input clk,//106.5M
input rst,
output reg TurnFlag,
output reg TurnMoment
);
parameter DivFre = 106500;
//parameter CYCLE = 6;
reg[1:0] DivState;
reg[16:0] DivCnt;
reg[9:0] Div1msCnt;
reg[9:0] CYCLE = 9;
/**********************分频计算得到翻转时刻****************************/
always @ (negedge clk or posedge rst)
begin
if(rst)
begin
DivState <= 2'b00;
DivCnt <= 17'b1;
Div1msCnt <= 10'b1;
//CYCLE <= 10'd10;
TurnFlag <= 1'b0;
TurnMoment <= 1'b0;
end
else
begin
case(DivState)
2'b00: //DivCnt 0~DivFre
begin
DivCnt <= DivCnt + 1;
if(DivCnt == DivFre)
DivState <= 2'b01;
else
begin
DivState <= 2'b00;
end
end
2'b01: //DivCnt清零且Div1msCnt+1
begin
DivCnt <= 1;
Div1msCnt <= Div1msCnt + 1;
TurnMoment <= ~TurnMoment;//1ms时间到,波形跳变
if(Div1msCnt == CYCLE)
begin
DivState <= 2'b10;
end
else
begin
DivState <= 2'b00;
end
end
2'b10: //Div1msCnt清零且回到初始状态
begin
Div1msCnt <= 1;
TurnFlag <= ~TurnFlag;//周期时间到,波形跳变
DivState <= 2'b00;
end
default:
begin
DivState <= 2'b00;
end
endcase
end
end
endmodule |