0

我有一个简单的各向异性过滤器 c/c++ 代码,它将处理一个 .pgm 图像,该图像是一个文本文件,每个像素都有灰度信息,完成处理后,它将生成一个应用了过滤器的输出图像。

该程序需要几秒钟才能在运行窗口的 x86 CPU 上进行大约 10 次迭代。

我和一个完成应用计算硕士学位的学者,我们需要在 FPGA(Altera DE2-115)下运行代码,看看直接在处理器(NIOS 2)上运行代码是否有相当大的性能提升。

我们已经成功启动了FPGA下的SO uClinux,但是设备硬件出现了一些错误,导致我们无法访问SD-Card甚至以太网,所以我们无法将代码和图像导入FPGA中为了测试它的性能。

因此,我在这里寻求一种替代方法,将我们的代码性能直接测试到具有文件系统的 CPU 中,以便代码可以读取图像并生成另一个图像。

另一种选择可以是使用成本低且易于使用的产品(我在想树莓派),或者如果我可以将代码上传到自动运行的地方并给我报告。

提前致谢。

4

2 回答 2

2

what you're trying to do is benchmarking some software on a multi GHz x86 Processor vs. a soft-core processor running 50MHz? (as much as I can tell from Altera docs) I can guarantee that it will be even slower on the FPGA! Since it is also running an OS (even embedded Linux) it also has threading overhead and what not. This can not be considered running it "directly" on CPU (whatever you mean by this)

If you really want to leverage the performance of an FPGA you should "convert" your C-Code into a HDL and run it directly in hardware. Accessing the data should be possible. I don't know how it's done with an Altera board but Xilinx has some libraries accessing data from a SD card with FAT.

于 2013-04-22T20:58:02.800 回答
1

您可以使用板载 SRAM 或 DDR2 RAM 来运行操作系统和您的应用程序。FPGA 中的硬件设计必须有内存控制器。在 SOPC 或 Qsys 中选择外部存储器作为复位向量并编译设计。

然后打开 Eclipse 的 NioSII 构建工具。在 Eclipse 中,通过选择 NiosII Application 和 BSP 项目来创建新项目。创建项目后,转到 BSP 属性并在链接器选项卡中键入外部存储器的偏移量并生成 BSP。编译项目并作为 Nios II 硬件运行。这将通过外部存储器运行您的应用程序。您将无法看到图像,但可以在控制台上打印表示内存中图像的二维数组。

于 2013-04-23T01:14:55.760 回答