易截截图软件、单文件、免安装、纯绿色、仅160KB

基本运算单元的高层次综合:C/C++ to RTL

本文以加法为例:[code]
//----------------------------------------------------
//adder.c
//---------------------------------------------------
void adder(int a, int b, int *sum)
{
        *sum = a + b;
}
[/code][size=3]
[/size]
HLS工具(AutoPilot)综合之后的结果:[code]
//---------------------------------------------------
//adder.v
//--------------------------------------------------
`timescale 1 ns / 1 ps
module adder (
        a,
        b,
        sum
);
input  [31:0] a;
input  [31:0] b;
output  [31:0] sum;
assign sum = (b + a);
endmodule //adder
[/code][size=3]
[/size][code]
//---------------------------------------------------
//adder.vhd
//---------------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
library work;
use work.AESL_components.all;
entity adder is
port (
    a : IN STD_LOGIC_VECTOR (31 downto 0);
    b : IN STD_LOGIC_VECTOR (31 downto 0);
    sum : OUT STD_LOGIC_VECTOR (31 downto 0) );
end;
architecture behav of adder is
begin
    sum <= esl_add(b, a);
end behav;
[/code][size=3]
[/size]
备注:加减乘除、位运算、逻辑运算等等基本的C/C++运算都可以很方便的用AutoPilot综合成对应的RTL代码(verilog/vhdl)[/size]


相关文档:

【C/C++】static和const的比较和解释


载自http://www.builder.com.cn/
 
       static
是c++中很常用的修饰符,它被用来控制变量的存储方式和可见性,下面我将从 static 修饰符的产生原因、作用谈起,全面分析static
修饰符的实质。
  static 的两大作用:
  一、控制存储方式:
  static被引入以告知编译器,将变 ......

关于 extern "C"

当这个世界还只有C的时候,是不需要extern "C"的。
但是,当C++出现之后,有时候,我们就需要extern "C"了。
那究竟是在什么样的情况下,我们需要用extern "C"呢?
有人说,是为了C能够调用C++,有人说是为了在C++中能调用C的库函数。是不是把你弄糊涂了?
先说说extern "C"是啥作用吧。
extern "C" 是告诉C++编译器, ......

Can C beat RTL?


http://www.edn.com/article/457428-Can_C_beat_RTL_.php 
With the appearance of higher speeds and more DSP macrocells in low-cost FPGAs, more and more design teams are seeing the configurable chips not as glue but as a way to accelerate the inner loops of numerical algorithms, either in conjun ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号