zoukankan      html  css  js  c++  java
  • 数字电路中关键路径的选取

    所谓关键路径就是,在电路中频繁调用,而且延迟过长,或者产生意外的几率比较大的线路
    怎样提取关键路径:
    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

  • 相关阅读:
    JAVA基础——编程练习(二)
    JAVA基础——面向对象三大特性:封装、继承、多态
    JVM内存
    50. Pow(x, n) (JAVA)
    47. Permutations II (JAVA)
    46. Permutations (JAVA)
    45. Jump Game II (JAVA)
    43. Multiply Strings (JAVA)
    42. Trapping Rain Water (JAVA)
    41. First Missing Positive (JAVA)
  • 原文地址:https://www.cnblogs.com/lueguo/p/3301203.html
Copyright © 2011-2022 走看看