基本运算单元的高层次综合: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]
相关文档:
非时尚●2010新款 宫廷复古罗马鞋真皮凉鞋舒适平底鞋女鞋
189.0元
一个由C/C++编译的程序占用的内存分为以下几个部分
1、栈区(stack)— 程序运行时由编译器自动分配,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。程序结束时由编译器自动释放。
2、堆区(h ......
C语言中的运算符及优先级是很重要的,一定要烂熟于心!
优先级 运算符 含义 要求运算对象个数 结合 1 ()
[]
->
. 括号运算符
下标运算符
结构体成员运算符 ......
pid_t pid=fork()
it has 3 situation for the return result pid
0 child
>0 parent process
<0 fork fail
fork create a new process and it parent live alse when the child process had been created ......
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 ......