微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > ISE编译,出现警告“WARNING:Xst:1467...."原因

ISE编译,出现警告“WARNING:Xst:1467...."原因

时间:10-02 整理:3721RD 点击:
我是新手。结合网上资料,我用ISE写了一个SPI控制接口,其中接收数据代码如下:

  1. module spi_receive_module(
  2.         input clk,
  3.         input rst,
  4.         input mosi,
  5.         input cs,
  6.         input sck_p,
  7.        
  8.         output reg rxc_flag,
  9.         output reg [7:0]rx_data
  10.     );
  11.          
  12.          reg[1:0] rx_state;
  13.          reg[7:0] byte_receive;
  14.          reg[2:0] bit_re_cnt;
  15.          reg[2:0] rxc_flag_width;
  16.          
  17.          always@(posedge clk or negedge rst or posedge cs)
  18.          begin
  19.                 if(!rst)
  20.                         begin
  21.                                 rxc_flag<=1'b0;
  22.                                 rx_data<=8'd0;
  23.                                 rx_state<=2'b00;
  24.                                 bit_re_cnt<=3'b000;
  25.                                 rxc_flag_width<=3'b000;
  26.                         end
  27.                        
  28.                 else if(cs)
  29.                         begin
  30.                                 rx_state<=2'b00;
  31.                                 bit_re_cnt<=3'd0;
  32.                         end
  33.                
  34.                
  35.                 else begin
  36.                                 case(rx_state)
  37.                                         2'b00:begin
  38.                                                 //byte_receive={byte_receive[6:0],mosi};
  39.                                                 if(sck_p && !cs)
  40.                                                         begin
  41.                                                                         byte_receive={byte_receive[6:0],mosi};
  42.                                                                         rxc_flag<=1'b0;
  43.                                                                         if(bit_re_cnt==3'd7)
  44.                                                                                 begin
  45.                                                                                         bit_re_cnt<=3'd0;
  46.                                                                                         rx_state<=2'b01;
  47.                                                                                         rxc_flag<=1'b1;
  48.                                                                                 end
  49.                                                                         else
  50.                                                                                 begin
  51.                                                                                         bit_re_cnt<=bit_re_cnt+1'b1;
  52.                                                                                 end
  53.                                                         end  
  54.                                                 else
  55.                                                         begin
  56.                                                                         rx_state<=2'b00;
  57.                                                         end
  58.                                         end
  59.                                         2'b01:begin
  60.                                                 rx_data<=byte_receive;
  61.                                                 //rxc_flag<=1'b1;
  62.                                                 if(rxc_flag_width==3'b100)
  63.                                                         begin
  64.                                                                 rxc_flag_width<=3'b000;
  65.                                                                 rx_state<=2'b10;
  66.                                                         end
  67.                                                 else
  68.                                                         begin
  69.                                                                 rxc_flag_width<=rxc_flag_width+1'b1;
  70.                                                         end
  71.                                         end
  72.                                         2'b10:begin
  73.                                                 rxc_flag<=1'b0;
  74.                                                 rx_state<=2'b00;
  75.                                         end
  76.                                         default:rx_state<=2'b00;
  77.                                 endcase
  78.                         end
  79.          end
  80. endmodule

复制代码


编译时出现如下警告:
WARNING:Xst:1467 - "spi_receive_module.v" line 56: Reset or set value is not constant in <byte_receive>. It could involve simulation mismatches
WARNING:Xst:1467 - "spi_receive_module.v" line 56: Reset or set value is not constant in <byte_receive>. It could involve simulation mismatches
WARNING:Xst:1467 - "spi_receive_module.v" line 41: Reset or set value is not constant in <rxc_flag>. It could involve simulation mismatches
WARNING:Xst:1467 - "spi_receive_module.v" line 42: Reset or set value is not constant in <rx_data>. It could involve simulation mismatches
WARNING:Xst:1467 - "spi_receive_module.v" line 45: Reset or set value is not constant in <rxc_flag_width>. It could involve simulation mismatches

请各位前辈指点一二,小弟非常感谢

我将敏感信号negedge rst or posedge cs 去掉警告消失了,但是原因我不是太清楚,希望对遇到相似情况的网友有所帮助,同时也希望得到高手们的指教

posedge clk or negedge rst or posedge cs
no such flip flop, please rework to use only posedge xx, or negedge xx   - not both


谢谢你的提醒,我看过的例程中的确也没有这种写法!

The signal "CS" should be level controling signal. So I personally think it is not suitable to use edge to trigger series operation.

(posedge clk or negedge rst) 可以这样写

每个case中的信号赋值不全吧


嗯,加三个触发信号就会有警告,功能仿真没问题,但是程序烧到板子里就有问题(没信号)

这样写always(posedge clk or negedge rstn),三个敏感变量时compile没有对应的寄存器

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

网站地图

Top