当接收到a时,开始定时发送数据,只有当接收到b时定时发送才停止,接收到其他的数据时依然保持定时发送,怎么写呢?
我是这样写的:
reg timer_flag;
always @(posedge clk)
if(rst)
timer_flag <= 0;
else
if(addr == a)
timer_flag <= 1;
else
if(addr == b)
timer_flag <= 0;
always @(posedge clk)
if(timer_flag)
......(定时发送代码)
else
.....(定时发送停止时的其他操作)
|