打印

流水线加法器的问题

[复制链接]
1786|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wangjun403|  楼主 | 2012-2-18 17:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
数字信号处理的FPGA实现(第三版)的例子
实现了一个31bit流水线加法器。设计运行速度316.46MHz
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity test is
        generic (
                WIDTH        :integer        :=31;
                WIDTH1        :integer        :=15;                --LSB
                WIDTH2        :integer        :=16                --MSB
                        );
        port (
                x,y                :in         std_logic_vector( WIDTH-1 downto 0);
                sum                :out        std_logic_vector( WIDTH-1 downto 0);
                LSBs_Carry        :out        std_logic;
                clk                :in                std_logic
                  );
end entity;

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

begin
        process
        begin
                wait until clk = '1';
        --split LSBs form input x, y
                l1        <= x(WIDTH1-1 downto 0);
                l2        <= y(WIDTH1-1 downto 0);
        --split MSBs from input x,y
                l3        <= x(WIDTH-1  downto WIDTH1);
                l4        <= y(WIDTH-1  downto WIDTH1);
        --first stage of the adder
                r1        <= ('0' & l1) + ('0' & l2);
                r2        <= l3 + l4;
        --second stage of the adder
                s1        <= r1(WIDTH1-1 downto 0);      --这里这句看不出来有什么用处
        --add result von MSBs (x+y) and carry form LSBs
                s2        <= r1(WIDTH1) + r2;
        end process;

        LSBs_Carry        <= r1(WIDTH1);                --add a test signal
       
        sum                <= s1 & s2;
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 | 只看该作者
基本搞明白了,上传个附件,还不明白的可以看看

L09Pipelining.pdf

1.03 MB

感觉是最好的描述流水线的文档了

使用特权

评论回复
5
wangc111| | 2012-2-27 11:25 | 只看该作者
厉害呀!我是看不懂了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

0

主题

629

帖子

1

粉丝