共1条
1/1 1 跳转至页
FPGA节省资源设计的一个例子(vhdl)

fpga的结构化特点导致近似的设计会产生交大差别的MAPING(综合之后)之结果,
因此,设计时应充分学习FPGA之结构,才可以充分利用资源。
现举例如下:
设计方法1:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter is
port (
inti : in std_logic;
clock : in std_logic;
reset : in std_logic;
bout : out std_logic_vector(4 downto 0));
end counter;
architecture behavior of counter is
signal counter : std_logic_vector(4 downto 0);
begin
counter_machine:process(clock)
begin
if clock'event and clock='1' then
if inti='0' then
counter<="00001";
*****************
elsif reset='1' then
if counter=19 then
counter<=(others=>'0');
else
counter<=counter+1;
end if;
else
counter<=(others=>'0');
end if;
end if;
end process;
bout<=counter;
end behavior;
设计方法2
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter is
port (
inti : in std_logic;
clock : in std_logic;
reset : in std_logic;
bout : out std_logic_vector(4 downto 0));
end counter;
architecture behavior of counter is
signal counter : std_logic_vector(4 downto 0);
begin
counter_machine:process(clock)
begin
if clock'event and clock='1' then
if inti='0' then
counter<="00000";
*****************
elsif reset='1' then
if counter=19 then
counter<=(others=>'0');
else
counter<=counter+1;
end if;
else
counter<=(others=>'0');
end if;
end if;
end process;
bout<=counter;
end behavior;
对于设计1,由于init和reset的counter置位是不同的,所以额外的LE完成
组合逻辑。
而对于设计2,
由于inti和reset可以用LE中的LUT和cascade_in和cascade_out实现计数器
的加,用programable register实现计数器的状态,所以资源利用率是比较
高的。
二者的速度几乎没有差别。
好了,该干活了。
关键词: 节省 资源 设计 一个 例子
共1条
1/1 1 跳转至页
回复
打赏帖 | |
---|---|
汽车电子中巡航控制系统的使用被打赏10分 | |
分享汽车电子中巡航控制系统知识被打赏10分 | |
分享安全气囊系统的检修注意事项被打赏10分 | |
分享电子控制安全气囊计算机知识点被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】【OZONE】使用方法总结被打赏20分 | |
【分享开发笔记,赚取电动螺丝刀】【S32K314】芯片启动流程分析被打赏40分 | |
【分享开发笔记,赚取电动螺丝刀】【S32K146】S32DS RTD 驱动环境搭建被打赏12分 | |
【分享开发笔记,赚取电动螺丝刀】【IAR】libc标注库time相关库函数使用被打赏23分 | |
LP‑MSPM0L1306开发版试用结果被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】【LP-MSPM0L1306】适配 RT-Thread Nano被打赏23分 |