使用枚举索引声明和使用有符号复数时出错
Error declaring and using signed complex quantity using enumerated indices
我在一个名为 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在实体编译时产生如下错误:
In array constraint at depth 1 the array fat_rtl.FAT_Lib.signed_complex has already been constrained.
我知道编译器将 (9 downto 0)
作为数组大小而不是有符号数字长的约束。有没有人看到我的声明中的错误?我的目标是能够访问 MF
的实部和虚部,如 MF(re)
和 MF(im)
.
谢谢
您需要 VHDL 2008。您需要这样的东西:
MF: out signed_complex_array(open)(9 downto 0);
其中 (open)
用于跳过 constrained 维度。
当我对复数使用记录时,Altera 的 Quartus 13.1 合成器出现问题。因此,声明复数的方式有点复杂。我正在使用 VHDL-2008。
我设法通过以下方式解决了声明中的问题:
在普通包中:
type complex_field is (re,im);
type signed_complex is array(complex_field range <>) of signed;
在实体端口接口中:
MF: out signed_complex(re to im)(9 downto 0);
我按照以下方式尝试了 Matthew Taylor 的建议,效果也不错。
type complex_field is (re,im);
type signed_complex is array(complex_field) of signed;
MF: out signed_complex(open)(9 downto 0);
感谢评论。
我在一个名为 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在实体编译时产生如下错误:
In array constraint at depth 1 the array fat_rtl.FAT_Lib.signed_complex has already been constrained.
我知道编译器将 (9 downto 0)
作为数组大小而不是有符号数字长的约束。有没有人看到我的声明中的错误?我的目标是能够访问 MF
的实部和虚部,如 MF(re)
和 MF(im)
.
谢谢
您需要 VHDL 2008。您需要这样的东西:
MF: out signed_complex_array(open)(9 downto 0);
其中 (open)
用于跳过 constrained 维度。
当我对复数使用记录时,Altera 的 Quartus 13.1 合成器出现问题。因此,声明复数的方式有点复杂。我正在使用 VHDL-2008。
我设法通过以下方式解决了声明中的问题:
在普通包中:
type complex_field is (re,im);
type signed_complex is array(complex_field range <>) of signed;
在实体端口接口中:
MF: out signed_complex(re to im)(9 downto 0);
我按照以下方式尝试了 Matthew Taylor 的建议,效果也不错。
type complex_field is (re,im);
type signed_complex is array(complex_field) of signed;
MF: out signed_complex(open)(9 downto 0);
感谢评论。