微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > DC逻辑综合求助

DC逻辑综合求助

时间:10-02 整理:3721RD 点击:

希望各位大神给点建议(已解决)
部分代码如下:
always@(posedge clk or posedge rst) begin
        if(rst) begin     
            fetch1 = 0;
            fetch2 = 0;
            fetch3 = 0;
            add1 = 0;
            add2 = 0;
            and1 = 0;
            and2 = 0;
            jmp = 0;
            mov = 0;            
        end
        case(counter_out)
           0:begin    //fetch the first beat
                fetch1 = 1;
                fetch2 = 0;
                fetch3 = 0;
                add1 = 0;
                add2 = 0;
                and1 = 0;
                and2 = 0;
                jmp = 0;
                mov = 0;
            end
           ......
      endcase
end
用DC逻辑综合时报以下错误(42行就是always块开始的地方):
Error:  /home/onear/digitalIC/simplecpu/code/cu.v:42: The statements in this 'always' block are outside the scope of the synthesis policy. Only an 'if' statement is allowed at the top level in this always block. (ELAB-302)
*** Presto compilation terminated with 1 errors. ***

1. 用<=不用=;
2. if begin end后加else。


always@(posedge clk or posedge rst) begin
         if(rst) begin     
             fetch1 = 0;
             fetch2 = 0;
             fetch3 = 0;
             add1 = 0;
             add2 = 0;
             and1 = 0;
             and2 = 0;
             jmp = 0;
             mov = 0;            
         end
      else  begin      
case(counter_out)
            0:begin    //fetch the first beat
                 fetch1 = 1;
                 fetch2 = 0;
                 fetch3 = 0;
                 add1 = 0;
                 add2 = 0;
                 and1 = 0;
                 and2 = 0;
                 jmp = 0;
                 mov = 0;
             end
            ......
       endcase
end
end

if(rst ) begin ... end里是异步复位;
后面的else begin ... end里是时钟clk上升沿处理的逻辑;
如楼上所说,不建议在电路中使用=,如果对它的运用不熟练的话;
另外,上面的case ... endcase可以放在always外面,而寄存器的赋值在always里面。
上面的代码,感觉要实现一个简单的指令译码和执行。



    在case前加了else问题就解决了。多谢!

我感觉小编应该感谢一下3楼、他说的挺有道理的、



    说的很有道理,谢谢。不过在这个设计中,如果将阻塞赋值改为非阻塞赋值,对逻辑功能会有一定的影响。



  你这样子加else,逻辑就不是原来的逻辑了,要想好了



    我用modelsim仿真了下,和之前的逻辑一样,没有变化。还是非常感谢

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top