Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vhdl 使用枚举索引声明和使用有符号复数时出错_Vhdl - Fatal编程技术网

Vhdl 使用枚举索引声明和使用有符号复数时出错

Vhdl 使用枚举索引声明和使用有符号复数时出错,vhdl,Vhdl,我在名为FAT_Lib的公共包文件中声明了以下内容: type complex_field is (re,im); type signed_complex is array(complex_field) of signed; 然后,我以以下方式在实体的端口接口中声明了一个信号: MF: out signed_complex(9 downto 0); Modelsim在编译实体时产生以下错误: 深度1的数组约束中,数组fat\u rtl.fat\u Lib.signed\u复合体已被约束 我知

我在名为FAT_Lib的公共包文件中声明了以下内容:

type complex_field is (re,im);
type signed_complex is array(complex_field) of signed;
然后,我以以下方式在实体的端口接口中声明了一个信号:

MF: out signed_complex(9 downto 0);
Modelsim在编译实体时产生以下错误:

深度1的数组约束中,数组fat\u rtl.fat\u Lib.signed\u复合体已被约束

我知道编译器将
(9到0)
视为约束数组大小,而不是有符号数量字长。有人看到我声明中的错误吗?我的目标是能够像
MF(re)
MF(im)
那样访问
MF
的实部和虚部


谢谢

您需要VHDL 2008。你需要这样的东西:

MF: out signed_complex_array(open)(9 downto 0);

其中
(打开)
用于跳过受约束的维度。

当我使用复杂数量的记录时,Altera的Quartus 13.1合成器出现问题。因此,声明复杂数量的方式有点复杂。我正在使用VHDL-2008

我通过以下方式解决了声明中的问题:

MF: out signed_complex(9 downto 0);
在通用包中:

type complex_field is (re,im);
type signed_complex is array(complex_field range <>) of signed;
我用下面的方法尝试了马修·泰勒的建议,效果也不错

type complex_field is (re,im);
type signed_complex is array(complex_field) of signed;

MF: out signed_complex(open)(9 downto 0);

感谢您的评论。

请参阅Peter Ashenden和Jim Lewis的书VHDL 2008 Just the New Stuff 3.1.2 Subtype Indications and Constraints…在早期版本的VHDL中,我们可以应用于复合子类型的唯一一种约束是索引约束,用于为其他不受约束的数组类型指定索引范围。必须约束数组类型的所有数组元素和子元素。在VHDL-2008中情况有所不同,因为我们可以使用数组和记录类型,其中某些元素或子元素子类型是数组子类型,而没有索引约束……为什么不使用记录
MF.re
MF.im
…Yes@J.H.Bonarius-有记录时,不需要VHDL-2008。不过,具有无约束字段的记录的语法可能会有点疯狂。