简体   繁体   English

在FPGA的VHDL中实现以下操作/功能有多困难?

[英]how hard is it to implement the following operations/functions in VHDL for an FPGA?

As a firmware engineer, how do you compare the computation cost of the following operations (maybe amount of resources needed) 作为固件工程师,您如何比较以下操作的计算成本(可能需要多少资源)

  • addition/subtraction 加/减
  • multiplication 乘法
  • division
  • trigonometric functions such as cosine 三角函数,例如余弦
  • square root 平方根

For FLOATING point with 32 bits calculation. 对于具有32位计算的浮点。

Answer from a hardware (not firmware) point of view: unfortunately there is no simple answer to your question. 从硬件(而非固件)的角度回答:不幸的是,您的问题没有简单的答案。 Each function you listed has many different hardware implementations, usually between small-slow and large-fast. 您列出的每个功能都有许多不同的硬件实现,通常在小到慢和大到快之间。 Moreover it depends on your target FPGA because some of them embed these functions as hard macros, so the question is not any more what do they cost , but do I have enough of them in this FPGA ? 此外,它取决于您的目标FPGA,因为其中一些将这些功能嵌入到硬宏中,因此问题不再是它们的成本是多少 ,但是我在此FPGA中是否有足够的功能

As a partial answer you can take this: with the most straightforward, combinatorial implementation, not using any hard macro, an integer or fixed-point N -bits adder/subtracter costs O(N) while a N x N -bits multiplier costs O(NxN) . 作为部分答案,您可以这样做:在最直接的组合实现中,不使用任何硬宏,整数或定点N加法器/减法器的成本为O(N)N x N乘法器的成本为O(NxN) Roughly. 大致。

For the other functions, it is extremely difficult to answer, there are far too many variants to consider (fixed/floating point, latency, throughput, accuracy, range...). 对于其他功能,很难回答,要考虑的变量太多(固定/浮点,等待时间,吞吐量,准确性,范围...)。 Assuming you make similar choices for all of them, I would say: add < mul < div < sqrt < trig . 假设您对所有这些都做出了类似的选择,我会说: add < mul < div < sqrt < trig But honestly, do not take this for granted. 但老实说,不要认为这是理所当然的。 If you are working with floating point numbers, for instance, the adder might be closer or even larger than the multiplier because it requires mantissas alignment, that is a barrel shifter. 例如,如果使用浮点数,则加法器可能比乘法器更近甚至更大,因为它需要尾数对齐,即桶形移位器。

A firmware engineer with a little hardware design knowledge would likely use premade cores for each of those functions. 具有少量硬件设计知识的固件工程师可能会为每个功能使用预制内核。 Xilinx, Altera, and others provide parametrizeable cores that can perform most of the functions that you specified. Xilinx,Altera和其他公司提供可参数化的内核,这些内核可以执行您指定的大多数功能。 The parameters for the core will likely include input size and number of cycles taken for the specified operation, among many others. 内核的参数可能包括输入大小和指定操作所用的周期数等。 The resources used by each of these cores will vary significantly based on the configuration and also what vendor and corresponding FPGA family that the core is being created for ( for instance Altera Cyclone 5 or Xilinx Artix 7). 这些内核中的每个内核所使用的资源会因配置以及内核所针对的供应商和相应的FPGA系列(例如Altera Cyclone 5或Xilinx Artix 7)而异。 The latency that the cores will have will need to be a factor in your decision as well, higher speed families of FPGAs can operate at faster clock rates decreasing the time that operations take. 内核所具有的延迟也将成为您决定的一个因素,高速FPGA系列可以以更快的时钟速率运行,从而减少了运行时间。 The way to get real estimates is to install the vendors tools ( for instance Xilinx's Vivado or Altera's Quartus) and use those tools to generate each of the types of cores required. 进行实际估算的方法是安装供应商工具(例如Xilinx的Vivado或Altera的Quartus),然后使用这些工具生成所需的每种核心类型。 You will need pick an exact FPGA part, in the family that you are evaluating. 您需要在要评估的系列中选择一个精确的FPGA部件。 Choose one with many pins to avoid running out of I/O on the FPGA. 选择一个具有许多引脚的引脚,以避免FPGA的I / O耗尽。 Then synthesize and implement a design for every of the cores you are evaluating. 然后针对要评估的每个核心综合并实施设计。 The simplest design will have just the core that you are evaluating and map it's inputs and outputs to the FPGAs I/O pins. 最简单的设计将只有您要评估的核心,并将其输入和输出映射到FPGA I / O引脚。 The implementation results will give you the number of resources that the design takes and also the maximum clock frequency that the design can run at. 实施结果将为您提供设计所需的资源数量,以及设计可以运行的最大时钟频率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM