作业帮 > 综合 > 作业

Verilog 语法问题

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/11 01:51:13
Verilog 语法问题
按键消抖程序的一部分
reg [2:0] key_r;
always@(posedge clk or negedge r_est)
begin
if(!r_est) key_r
你是不是错误提示:Error (10200):Verilog HDL Conditional Statement error at ……: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 r_est)”表明在clk上升沿或r_est下降沿这两个敏感事件发生时always语句块得以触发;而always中的if条件语句必须至少有一个条件指向其中一个敏感事件(边界标识符);所以写成“if(r_est)...else...”就会出错.
你可以把“always@(posedge clk or negedge r_est)”改为“always@(posedge clk or posedge r_est)”再编译试试,应该就没问题了.
你右键该错误点击“Help”里是这么说的:
CAUSE:In a conditional statement at the specified location in a Verilog Design File (.v),you specified a condition that Quartus II Integrated Synthesis cannot use to classify the edges in the enclosing always construct's event control.When an event control contains multiple edges,Quartus II Integrated Synthesis distinguishes the asynchronous control signals from the clock by analyzing the conditional statements in the always construct.For example,the following code fragment contains an always construct whose event control contains three edges---two asynchronous resets and a clock.
always @ (posedge clk or posedge rst1 or posedge rst2)
begin
if ( rst1 || rst2 )
q