打印
[Quartus]

输入输出位宽一致的复数乘法器实现

[复制链接]
2649|9
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
zy7598865|  楼主 | 2012-11-15 19:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
GoldSunMonkey| | 2012-11-15 20:50 | 只看该作者
这个用DSP做应该。我记得。

使用特权

评论回复
板凳
GoldSunMonkey| | 2012-11-15 20:52 | 只看该作者
XILINX 有IP,叫complex multiplier

使用特权

评论回复
地板
Backkom80| | 2012-11-16 08:01 | 只看该作者
恩,呵呵,猴哥,V5

使用特权

评论回复
5
zy7598865|  楼主 | 2012-11-16 08:54 | 只看该作者
3# GoldSunMonkey 但是我不知道最后应该输出哪些bit是最有效的。(要求输出与输入的bit位宽一致)

现在准备不用ip核来做,用了三个乘法器实现的那种方法,就是不知道怎么确定输出的有效bit。  大家怎么看,有什么建议吗?谢谢了

使用特权

评论回复
6
GoldSunMonkey| | 2012-11-16 22:06 | 只看该作者
那你弄成乘法+加法,有效位是你自己定的。

使用特权

评论回复
7
GoldSunMonkey| | 2012-11-16 22:06 | 只看该作者
上面是我的想法

使用特权

评论回复
8
zy7598865|  楼主 | 2012-12-11 12:51 | 只看该作者
en   是的,谢谢了,有段时间没来了,,呵呵

使用特权

评论回复
9
hawksabre| | 2012-12-11 16:52 | 只看该作者
--************************************************************
-- widthDAT 数据的位宽 ; widthRF 为旋转因子的位宽
-- 实现了一个复数和旋转因子的相乘操作 yi+yq*j=(xi+xq*j)*(cos-sin*j)
--************************************************************

-- 修改ccmul,使与旋转因子相乘后数据的位数不发生变化 2007.11.24

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_signed.all;
library lpm;
use lpm.lpm_components.all;

use work.mypackage.all;

-- This entity has an attentuation of 1 bits.
-- This entity has a delay of 2 clock cycles.

entity ccmul is
    generic(widthDAT:NATURAL:=16; widthRF :NATURAL:=16);
    port(
        clk          :in std_logic;
        enable       :in std_logic;
        cos ,sin     :in std_logic_vector(widthRF-1 downto 0);
        X            :in std_logic_vector(2*widthDAT-1 downto 0);  -- 输入复数
        Y            :out std_logic_vector(2*widthDAT-1 downto 0));
end ccmul;

architecture rtl of ccmul is

       constant widthMUL : NATURAL := widthRF+widthDAT;
       signal xi,xq      :std_logic_vector(widthDAT-1 downto 0); -- 两级加法扩展2位
       signal cos_reg,sin_reg:std_logic_vector(widthRF-1 downto 0);
    signal xic,xqs,xqc,xis:std_logic_vector(widthMUL-1 downto 0);
       signal xich,xqsh,xqch,xish:std_logic_vector(widthDAT-1 downto 0);
    signal enable0,enable1:std_logic;

begin
     
    rrmul1:lpm_mult
       generic map(lpm_widtha=>widthDAT,lpm_widthb=>widthRF,
               lpm_widthp=>widthMUL,lpm_widths=>1,
               lpm_representation=>"signed")
    port map(dataa=>xi,datab=>cos_reg,result=>xic);  
    rrmul2:lpm_mult
       generic map(lpm_widtha=>widthDAT,lpm_widthb=>widthRF,
               lpm_widthp=>widthMUL,lpm_widths=>1,
               lpm_representation=>"signed")
    port map(dataa=>xq,datab=>sin_reg,result=>xqs);
    rrmul3:lpm_mult
       generic map(lpm_widtha=>widthDAT,lpm_widthb=>widthRF,
               lpm_widthp=>widthMUL,lpm_widths=>1,
               lpm_representation=>"signed")
    port map(dataa=>xq,datab=>cos_reg,result=>xqc);
    rrmul4:lpm_mult
       generic map(lpm_widtha=>widthDAT,lpm_widthb=>widthRF,
               lpm_widthp=>widthMUL,lpm_widths=>1,
               lpm_representation=>"signed")
    port map(dataa=>xi,datab=>sin_reg,result=>xis);

    process(clk)
       begin
    if(clk'event and clk='1')then
        if(enable='1')then
               xi <= X(2*widthDAT-1 downto widthDAT);
               xq <= X(widthDAT-1 downto 0);
               sin_reg <= sin; cos_reg <= cos;
        end if;
    end if;
    end process;

    process
       begin
        enable0 <= enable;
        -- enable1 <= enable0;
        wait until clk='1';
    end process;   
   
    --process(clk)
       --begin
    --if(clk'event and clk='1')then
        --if(enable0='1')then
               xich <=xic(widthMUL-1 downto widthRF);
            xqsh <=xqs(widthMUL-1 downto widthRF);
            xqch <=xqc(widthMUL-1 downto widthRF);
            xish <=xis(widthMUL-1 downto widthRF);
        --end if;
    --end if;
    --end process;
   
    process(clk)
       begin
    if(clk'event and clk='1')then
        --if(enable0='1')then
               Y(2*widthDAT-1 downto widthDAT) <= signed_add(xich,xqsh);
            Y(widthDAT-1 downto 0) <= signed_sub(xqch,xish);
        --end if;
    end if;
    end process;
   

本文来自:我爱研发网(52RD.com) - R&D大本营
详细出处:http://www.52rd.com/Blog/Archive_Thread.asp?SID=11833

使用特权

评论回复
10
hawksabre| | 2012-12-11 16:53 | 只看该作者
希望对你有帮助   多多努力

使用特权

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

本版积分规则

1

主题

167

帖子

1

粉丝