HIT-Young

导航

QUARTUS II(7.2) 中Memory Initialization File(.mif) 的一些讨论

  这几天想做一个简单的查找表的数控振荡器(NCO),于是自己用C语言写了一个Memory Initialization File(.mif)的生成文件,但是当DATA_RADIX是DEC(有符号整数)的时候,总是出现错误:
  Error: Data at line <number> exceeds the specified width (<number>) in the Memory Initialization File *.mif

  我一直认为DEC肯定是用2补码来编码的,那么它的数据范围应该是-2^(width -1) 到2^(width -1)-1,但是实际发现数据范围只能是-(2^(width -1)-1)到2^(width -1)-1,所以这个到底是什么编码方式呢?难道是1补码吗?但是从lpm_rom的q输出来看,的确是2补码,这样就奇怪了,2补码的范围为什么给限制了,没有-2^(width -1) 呢?

  请求大家帮忙看看以上到底是为什么。我是一个初学者,很多地方还不太明白,请大家多多指点了!

  附录1:ALTERA对这个问题的解释

  http://www.altera.com.cn/support/kdb/solutions/rd11022007_637.html

  解决方案ID: rd11022007_637

  最后修改: 2007 年11 月14 日 

  产品类别: 设计软件

  产品领域: 综合/网表检查

  产品子领域: Quartus II 综合
  问题
  Error: Data at line <number> exceeds the specified width (<number>) in the Memory Initialization File *.mif,

  Error: Memory Initialization File or Hexadecimal (Intel-Format) File *.mif contains illegal syntax at line <number>

  解决方案
  You may encounter this error when you create a Memory Initialization File (.mif) that compiles sucessfully in the Quartus® II software version 7.1 or earlier, and open it in the Quartus II software version 7.2. This problem is fixed beginning with the Quartus II software version 7.2 SP1.
  In the Quartus II software version 7.2, if the initialization file is set to use an unsigned radix, the range of allowable values is from 0 to (2^width). However, if the file is set to use a decimal radix, the maximum value is 2^(width -1) and the minimum is the negative value of 2^(width -1). For example, for a width of 4, unsigned ranges from 0 to 15, while decimal ranges from -7 to +7.
  If your initialization file contains a setting for the decimal radix, you will get this error message in version 7.2 when you try to list data for values outside the allowable range.
  To fix this problem and set the radix to unsigned follow these steps:
  On the File menu, click Open, under Open as select Text.

  Select the MIF you want to edit, and click Open.

  Find the following text:DATA_RADIX =DEC;

  Change the text to: DATA_RADIX = UNS;

posted on 2011-04-17 11:09  HIT-Young  阅读(3027)  评论(0编辑  收藏  举报