数字电路中关键路径的选取

发布时间:2015-11-16 10:53    发布者:designapp
关键词: 数字电路 , 关键路径
  所谓关键路径就是,在电路中频繁调用,而且延迟过长,或者产生意外的几率比较大的线路。
  怎样提取关键路径:
  1:组合电路中的关键路径提取:
  q=a&b&c|d&e&b;
  因为b的传输要两级,
  可以简单的提取b作为一级的:
  q=(a&c|d&e)&b;
  2: always——block中的关键路径提取:
  always中关键路径的提取一般用分步法提取,请看下面一个always——block,
  always@(in)
  begin
  if(!a)
  if(c&&(!b&&e))
  out=out1;
  else out=out2;
  else if(b&&e) out =out1;
  end
  这里面e是关键路径,我们可以分两个步骤提取关键路径
  (1) 当e=1的时候有:
  if(!a)
  if(c&&(!b))
  out=out1;
  else out=out2;
  (2)当e=0的时候有:
  if(!a) out=out2;
  因此这个always可以写成这个样子:
  always@(in)
  begin
  if(e)
  if(!a)
  if(c&&(!b))
  out=out1;
  else out=out2;
  else if(!a) out=out2;
  end
  这是中间形式,还要写成最终形式:
  定义两个临时变量,为了在综合时候不被综合掉,要定义他们为输出端口(output)——切记!!!
  output out_temp1,out_temp2;
  out_temp1=a?out:(c&&(!b))?out1:out2;
  out_temp2=a?out:out2;
  assign out=e?out_temp1:out_temp2;
  3。FSM中的关键路径的提取:关于状态机,这是FPGA设计必备的基础,编码方式有很多中比如:one——hot,or one--cool
  还有就是组合电路和时序 电路的写法,这里主要讲关键路径的提取至于状态机的写法,还是查阅一下资料啊!
  FSM中关键路径的提取方法一般是先将要提取的关键路径去掉
  然后将原来FSM中的next-state用另外一个符号代替,作为次FSM 的输入,即有主从两个FSM。
  来看一下这个简单的状态机啊:
  parameter s0=0;
  parameter s1=1;
  parameter s2=2;
  parameter s3=3;
  input in1,in2,in3,set;
  reg[1:0] nextstate,currentstate;
  always@(in1 or in2 or in3 or currentstate)
  begin
  nextstate=s0;// start state
  case(currentstate)
  s0: if(in1&&!set)
  nextstate=s1;
  else if(set) nextstate=s2;
  s1:if(in2&&set)
  nextstate=s3;
  else if(!set) nextstate=s2;
  s2:if(set) nexstate=s3;
  s3:if(in3) nextstate=s0;
  default:nextstate=s0;
  endcase
  end
  好,现在来看第一步,将状态机中的关键路径去掉,这里的关键路径为set,试想如果状态从s0一路到s3,都是set在起作用,如果有一个不小心的毛刺产生,就会执行错误的行为,所以这里的set为关键路径。
  提取后的状态机如下:
  reg[1:0]temp;
  always@(in1 or in2 or in3 or currentstate)
  begin
  nextstate=s0;// start state
  temp=s0;
  case(currentstate)
  s0: if(in1)
  temp=s1;
  s1:if(in2)
  temp=s3;
  s2: temp=temp;
  s3:if(in3) temp=s0;
  default:temp=s0;
  endcase
  end
  第二步:
  always2(temp or currentstate or set)
  begin
  case(currentstate)
  s0:if(!set)
  nextstate=temp
  else nextstate=s2;
  s1: if(set)
  nextstate=temp;
  else nextstate=s2;
  s2:if(set) nextstate=s3;
  else nextstate=temp;
  s3: nextstate=temp;
  default:nextstate=temp;
  endcase
  end
                                
               
本文地址:https://www.eechina.com/thread-156394-1-1.html     【打印本页】

本站部分文章为转载或网友发布,目的在于传递和分享信息,并不代表本网赞同其观点和对其真实性负责;文章版权归原作者及原出处所有,如涉及作品内容、版权和其它问题,我们将根据著作权人的要求,第一时间更正或删除。
您需要登录后才可以发表评论 登录 | 立即注册

厂商推荐

关于我们  -  服务条款  -  使用指南  -  站点地图  -  友情链接  -  联系我们
电子工程网 © 版权所有   京ICP备16069177号 | 京公网安备11010502021702
快速回复 返回顶部 返回列表