流水线加法器的问题

[复制链接]
 楼主| wangjun403 发表于 2012-2-18 17:24 | 显示全部楼层 |阅读模式
数字信号处理的FPGA实现(第三版)的例子
实现了一个31bit流水线加法器。设计运行速度316.46MHz
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_arith.all;
  4. use ieee.std_logic_unsigned.all;

  5. entity test is
  6.         generic (
  7.                 WIDTH        :integer        :=31;
  8.                 WIDTH1        :integer        :=15;                --LSB
  9.                 WIDTH2        :integer        :=16                --MSB
  10.                         );
  11.         port (
  12.                 x,y                :in         std_logic_vector( WIDTH-1 downto 0);
  13.                 sum                :out        std_logic_vector( WIDTH-1 downto 0);
  14.                 LSBs_Carry        :out        std_logic;
  15.                 clk                :in                std_logic
  16.                   );
  17. end entity;

  18. architecture rtl of test is
  19.        
  20.         signal l1,l2,s1                :std_logic_vector(WIDTH1-1 downto 0);                --LSBs of inputs
  21.         signal r1                        :std_logic_vector(WIDTH1   downto 0);                --LSBs of inputs
  22.         signal l3,l4,r2,s2        :std_logic_vector(WIDTH2-1 downto 0);                --MSBs of inputs

  23. begin
  24.         process
  25.         begin
  26.                 wait until clk = '1';
  27.         --split LSBs form input x, y
  28.                 l1        <= x(WIDTH1-1 downto 0);
  29.                 l2        <= y(WIDTH1-1 downto 0);
  30.         --split MSBs from input x,y
  31.                 l3        <= x(WIDTH-1  downto WIDTH1);
  32.                 l4        <= y(WIDTH-1  downto WIDTH1);
  33.         --first stage of the adder
  34.                 r1        <= ('0' & l1) + ('0' & l2);
  35.                 r2        <= l3 + l4;
  36.         --second stage of the adder
  37.                 s1        <= r1(WIDTH1-1 downto 0);      --这里这句看不出来有什么用处
  38.         --add result von MSBs (x+y) and carry form LSBs
  39.                 s2        <= r1(WIDTH1) + r2;
  40.         end process;

  41.         LSBs_Carry        <= r1(WIDTH1);                --add a test signal
  42.        
  43.         sum                <= s1 & s2;
  44. end rtl;

综合后的时序报告

看上面的结果,最大也就252.91MHz。和他说的316.46MHz还有一段差距呢。(不最大我看的对不对?)
请问这红色的地方该如何修改?

综合过的RTL图如下
如何能看出这是流水线呢?
第一个clk,将输入分成2部分
第二个clk,分别得到低位和高位的和
第三个clk,得到和

这样用三个周期才能得到结果,怎么还会更快呢?
如果直接用altera的IP一个周期就可以得到结果了

希望各位可以赐教!
lwq030736 发表于 2012-2-19 14:01 | 显示全部楼层
你用的什么器件?
采用流水线能使速度更快是指寄存器之间的时序余量更足
采用流水线后虽然得到结果需要延迟几个周期,但是每个周期都能得到一个结果
 楼主| wangjun403 发表于 2012-2-19 15:55 | 显示全部楼层
EP2C35
怎么看出来提高吞吐量了呢?
 楼主| wangjun403 发表于 2012-2-22 19:38 | 显示全部楼层
基本搞明白了,上传个附件,还不明白的可以看看

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
wangc111 发表于 2012-2-27 11:25 | 显示全部楼层
厉害呀!我是看不懂了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:数学才不是浮云

0

主题

629

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部
个人签名:数学才不是浮云

0

主题

629

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部