Compilation VHDL-仅在架构标头中使用的函数是否占用FPGA逻辑?
如果我有这样的代码:Compilation VHDL-仅在架构标头中使用的函数是否占用FPGA逻辑?,compilation,vhdl,fpga,xilinx,Compilation,Vhdl,Fpga,Xilinx,如果我有这样的代码: ... architecture behaviour of ExampleEntity is -- type definitions type Matrix is array(0 to 1,0 to 1) of signed(NumOfBitsForSignals_1 downto 0); -- function definitions function TransposeMatrix(MatrixArg : Matrix) return Matrix
...
architecture behaviour of ExampleEntity is
-- type definitions
type Matrix is array(0 to 1,0 to 1) of signed(NumOfBitsForSignals_1 downto 0);
-- function definitions
function TransposeMatrix(MatrixArg : Matrix) return Matrix is
-- variable decleration
variable Result : Matrix;
begin
-- behaviour
for columnNo in Result'range loop
for rowNo in Result'range loop
Result(columnNo, rowNo) := MatrixArg(rowNo, columnNo);
end loop;
end loop;
return Result;
end function;
-- constant definitions
constant A00 : std_logic_vector(NumOfBitsForSignals_1 downto 0) := "A00Value";
constant A01 : std_logic_vector(NumOfBitsForSignals_1 downto 0) := "A01Value";
constant A10 : std_logic_vector(NumOfBitsForSignals_1 downto 0) := "A10Value";
constant A11 : std_logic_vector(NumOfBitsForSignals_1 downto 0) := "A11Value";
constant A : Matrix := ((signed(A00), signed(A01)),
constant A_Transpose : Matrix := TransposeMatrix(A);
...
TransposSematrix函数只在这里使用一次,这个函数是否仍然被合成,或者编译器是否会给一个_转置赋值并从合成中删除这个函数?如果情况并非如此,并且它合成了转置函数,那么最好删除此函数并手动转置矩阵并输入它?作为一般规则,合成工具将尽最大努力降低生成的网络列表的复杂性。这包括计算具有恒定输入的函数的结果,即使这些输入本身是由其他函数生成的,也取决于
通用
参数等。这些工具在这一过程中非常擅长,以至于代码中的一个简单错误可能导致设计的整个部分被优化
在这种情况下,函数是否只在声明性区域中调用实际上并不重要;无论在何处调用函数,任何可能的简化或优化都将由合成工具执行
有些工具确实有限制,例如,如果函数从文件中读取,或者在某些情况下,如果它包含一个循环,其边界由参数确定。然而,这将导致错误或警告,与网络列表中的额外逻辑相反。IEEE Std 1076-2008 6.4.2.2常量声明,第3段“如果分配符号”:常量声明中出现表达式后,表达式指定常量的值;表达式的类型应为常量的类型。在详细说明声明后,不能修改常量的值。“a_转置是全局静态的,请参见9.4静态表达式,9.4.1,9.4.2-e)TransportSematrix(A)调用不是局部静态的(9.4.3-i),而是带有全局静态参数的纯函数调用。不涉及逻辑。