你能用类似C语言对FPGA进行编程吗?[英] Can you program FPGAs in C-like languages?

本文是小编为大家收集整理的关于你能用类似C语言对FPGA进行编程吗?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

在大学里,我用类似C的语言编程了FPGA.但是,我也知道,一个通常在Verilog或VHDL中编程的FPGA.这是设计师的选择吗?如果是这样,表现缺点是什么?

我理想地想用类似于C的语言编程FPGA,而不是VHDL.

我正在考虑获得xilinx virtex-5,如果有任何区别?

推荐答案

简短的答案是"是,当然可以".

这是对FPGA和基于FPGA系统的C编译器的出色调查.

c-to-to-hardware编译器(HLL合成)

性能缺点和考虑因素在系统体系结构和通信带宽中找到,而不是在使用C与硬件设计语言(HDL)中找到.使用C和HDL的考虑因素在于编程时间和软件维护问题,而不是在性能上.

其他推荐答案

FPGA不是处理器. C是专为处理器设计的语言.

是的,有C到FPGA编译器.

他们是个好主意吗?我会说的.不,您将要使用的设计是(从我所看到的)通常是一台状态机,该状态机在C中具有每行代码的状态.算法.要么制造该代码或其他类型的Turing Machine.

这是不是在FPGA设计中熟练的人通常会解决问题.这是一个缓慢而有潜在的门饿的方法.

英语是写小说的更好的语言,而不是fortran,vhdl和verilog是描述逻辑电路的更好语言.

如果您认真使用FPGA,请使用旨在描述逻辑电路的语言.这可能是一条陡峭的学习曲线,但结果将是更好的恕我直言.

其他推荐答案

您可以在FPGA逻辑中安装软处理器核心,并在虚拟处理器内运行C代码. Xilinx具有微蓝光(许可)和Picoblaze(免费)核心.您还可以实现其他软芯(MIPS,X86、8051等).

但是,这在很大程度上被认为是"黑客",因为与真实核心相比,芯非常慢.而且我认为任何 c-to-to-fpga转换最终都会开始闻起来像是运行柔软的核心,而不是为您提供在FPGA上运行的效率. FPGA不是图灵机,它们是一袋逻辑大门.您可以在大门上建造一台图灵机,但这不是为什么您买了大门的原因.

它就像购买一袋乐高积木,并用砖头盖住一套钉子.它可能会起作用,但是您最好购买锤子来敲钉子,更好地使用乐高积木的城堡,太空船和消防局.

本文地址:https://www.itbaoku.cn/post/2090959.html

问题描述

At university I programmed a FPGA in a C-like language. However, I also know that one usually programs FPGAs in Verilog or VHDL. Is this a designer choice? If so, what are the performance drawbacks?

I would ideally like to program the FPGA in a C-like language, rather than VHDL.

I was thinking of getting an Xilinx Virtex-5 if it makes any difference?

推荐答案

The short answer is "yes, certainly".

Here's an excellent survey of C compilers for FPGAs and FPGA-based systems.

C-to-hardware compiler (HLL synthesis)

Performance drawbacks and considerations are found in the system architecture and communication bandwidths rather than in using C vs. a hardware design language (HDL). The considerations in using C vs. an HDL lies in programming time and software maintenance issues, not so much in performance.

其他推荐答案

FPGA's are not processors. C is a language designed for processors.

Yes, there are C to FPGA compilers.

Are they a good idea? I'd say No. The design you're going to end up with is (from what I've seen) normally a state machine that has one state per line of code in the C. The state machine then moves through the states performing the algorithm. Either that or some other kind of Turing machine is put in place to execute the code.

This is not how somebody skilled in FPGA design would generally approach a problem. It's a slow, and potentially gate hungry way doing things.

In the same way that English is a better language to write a novel than Fortran, VHDL and Verilog are better languages to describe logic circuits than C.

If you're serious about using FPGAs, use a language that is designed to describe logic circuits. It might be a steep learning curve, but the results will be much better IMHO.

其他推荐答案

You can install a soft processor core inside the FPGA logic, and run your C code inside the virtual processor. Xilinx has Microblaze (licensed) and Picoblaze (free) cores. There are other soft cores you can implement as well (MIPS, x86, 8051, etc).

However, this is largely considered a "hack", as the cores are very slow compared to real cores. And I think that any C-to-FPGA conversion is ultimately going to start smelling like running a soft core, and not give you the efficiency you deserve for running on a FPGA. FPGAs are not Turing machines, they are a sack of logic gates. You can build a Turing machine out of the gates, but that is not why you bought the sack of gates.

Its sort of like buying a bag of Legos, and building a hammer and set of nails out of the bricks. It might work, but you are better off buying a hammer to pound nails, and better off building Castles, Space Ships and Fire Stations with the Legos.