搜索
bottom↓
回复: 1

写了一段CLC的滤波器,但是出来的波形怎么是矩形波?

[复制链接]

出0入0汤圆

发表于 2013-5-12 20:26:47 | 显示全部楼层 |阅读模式
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

--  Uncomment the following lines to use the declarations that are
--  provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;

entity hb is
    Port (  sysclk : in std_logic;
--            ena : in std_logic;
            enclk : out std_logic;
            daclk : out std_logic;
                datain : in std_logic_vector(7 downto 0);
                --dataine : out std_logic_vector(15 downto 0);
        --  sampleclk1  : in std_logic;              ------------------------------------------
--sampleclk1 is 10.28K

  --       sampleclk2  : in std_logic;                ---------------------------------------------
--sampleclk2 is 10.28*256=2.63
           dataout : out std_logic_vector(11 downto 0));   -------------------------------15
end hb;
     
     
  
architecture Behavioral of hb is
component pll is
   PORT
        (
                areset                : IN STD_LOGIC  := '0';
                inclk0                : IN STD_LOGIC  := '0';
                c0                : OUT STD_LOGIC ;
                locked                : OUT STD_LOGIC
        );
end component;

---------------rclock signals is added here



----------------
signal  datainext : std_logic_vector(27 downto 0);--29
signal  acca  : std_logic_vector(27 downto 0);  ---29
signal  enclk_temp: std_logic;
signal  daclk_temp: std_logic;
signal clk_50M    : STD_LOGIC;


signal  accb  : std_logic_vector(27 downto 0);--24
--signal  accb_delay  : std_logic_vector(27 downto 0);
signal  accc  : std_logic_vector(27 downto 0);
--signal  accc_delay :std_logic_vector(27 downto 0);
signal  accd  : std_logic_vector(27 downto 0);
signal  accd_delay :std_logic_vector(27 downto 0);

signal  comb1:         std_logic_vector(27 downto 0);--
--signal  comb1e:         std_logic_vector(17 downto 0);--
signal  comb1_delay:         std_logic_vector(27 downto 0);--13
signal  comb2:         std_logic_vector(27 downto 0);  ---
signal  comb2_delay:         std_logic_vector(27 downto 0);--12
signal  comb3:         std_logic_vector(27 downto 0);--12
signal  comb3_delay:         std_logic_vector(27 downto 0);
signal  comb4:         std_logic_vector(27 downto 0);
signal  comb4_delay:         std_logic_vector(27 downto 0);
signal  decimate_count: std_logic_vector(3 downto 0);
                               
begin          

--------------------produce sampleclk1 and sampleclk2

---------------------------------
-----------------rcic filter
--------------------------------
        datainext(27)<=datain(7);
        datainext(26)<=datain(7);
                datainext(25)<=datain(7);
                datainext(24)<=datain(7);
                datainext(23)<=datain(7);
                datainext(22)<=datain(7);
                datainext(21)<=datain(7);
                datainext(20)<=datain(7);
                datainext(19)<=datain(7);
                datainext(18)<=datain(7);
                datainext(17)<=datain(7);
                datainext(16)<=datain(7);
                datainext(15)<=datain(7);
                datainext(14)<=datain(7);
                datainext(13)<=datain(7);
                datainext(12)<=datain(7);
                datainext(11)<=datain(7);
                datainext(10)<=datain(7);
                datainext(9)<=datain(7);
                datainext(8)<=datain(7);
                datainext(7 downto 0)<=datain(7 downto 0);
               
               
               
       
            dataout<=comb4(27 downto 16);---(29 downto 14);
            
            --enclk_temp<=sysclk;
            --daclk_temp<=sysclk;
            enclk     <= clk_50M;
            daclk     <= clk_50M;
       
             --dataine<=datain&"0000";
  process (clk_50M)
begin       
   if clk_50M='1' and clk_50M'event then
        decimate_count<=decimate_count+1;
--      if sampleclk2='1' then
       acca<=acca+datainext;
--     acca_delay<=acca;
       accb<=accb+acca;
       accc<=accc+accb;
       accd<=accd+accc;
       if decimate_count="1111" then  ---Decimation Ratio=16
       accd_delay<=accd;
       comb1_delay<=comb1;
       comb2_delay<=comb2;
       comb3_delay<=comb3;
       comb1<=accd-accd_delay;
       comb2<=comb1-comb1_delay;
       comb3<=comb2-comb2_delay;
       comb4<=comb3-comb3_delay;
               end if;
         end if;
                     end process;
        u1:pll port map (inclk0=>sysclk,c0=>clk_50M);                                 
         end Behavioral;

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

 楼主| 发表于 2013-5-12 20:31:31 来自手机 | 显示全部楼层
图。。。。。。

本帖子中包含更多资源

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

x
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-24 07:21

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表