搜索
bottom↓
回复: 3

我想用EPM240T实现DPLL,网上参考的辨认的代码。好像调试不成功!能给分析下吗?

[复制链接]

出0入0汤圆

发表于 2010-12-2 17:02:45 | 显示全部楼层 |阅读模式
先看代码:
library ieee;

use ieee.std_logic_1164.all;
Use IEEE.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity pll1 is

port (

v1,CP,en,d,c,b,a:in std_logic;

vout:out std_logic

);

end pll1;

architecture pll_arch of pll1 is

signal temp1,temp2: std_logic;--a_bxulie
signal tout1,tout2: std_logic;--a_bxulie
signal v2: std_logic;--v2<=VOUT
signal vd:std_logic;--clk<=CP
signal updn,up,dn:std_logic;--updn<=vd
signal cq,k,m:std_logic_vector(15 downto 0); --开始
signal out1,out2:std_logic;
signal dir:std_logic_vector(3 downto 0); --以上kcount信号
signal inc,dec:std_logic;
signal count : integer range 0 to 63; --开始
signal fin   : std_logic;
signal addtemp,dectemp: std_logic;--以上ncount信号


begin

dir<=d&c&b&a;

with dir select

m<="0000000000000111"when"0001",

"0000000000001111"when"0010",

"0000000000011111"when"0011",

"0000000000111111"when"0100",

"0000000001111111"when"0101",

"0000000011111111"when"0110",

"0000000111111111"when"0111",

"0000001111111111"when"1000",

"0000011111111111"when"1001",

"0000111111111111"when"1010",

"0001111111111111"when"1011",

"0011111111111111"when"1100",

"0111111111111111"when"1101",

"1111111111111111"when"1110",

"0000000000000111"when others;

  
  process(v1,v2)   --EXOR

begin
   
   VD<=V1 xor V2;

   updn<=VD;   

end process;   
   
  process(CP,en,updn,k,cq) --kcount

begin

if CP'event and CP='1' then

    k<=m;

  if en='1' then

    if updn='0' then

      if cq<k then cq<=cq+1;

         else cq<=(others=>'0');

      end if;
    else

      if cq>0 then cq<=cq-1;

         else cq<=k;

      end if;

    end if;

  else cq<=(others=>'0');

  end if;

end if;

end process;

process(en,updn,cq,k)

begin

  if en='1' then

      if updn='0' then

          if cq=k then out1<='1';

             else out1<='0';

          end if;

          out2 <='0';

      else

         if cq="00000000000000000"then out2<='1';

             else out2<='0';

         end if;

         out1<='0';

      end if;

  else out1<='0';out2<='0';

  end if;

up<=out1;dn<=out2;

end process;

process(cp)--2分频
begin
if cp'event and cp='1' then
temp1<=not temp1;
end if;
end process;

process(cp)--2分频
begin
if cp'event and cp='0' then
temp2<=not temp2;
end if;
end process;
tout2<=temp1 and temp2;
tout1<=(not temp1) and (not temp2);
--clkao<=tout1;
--clkbo<=tout2;

  process (tout1)--脉冲加减控制

begin

addtemp<=up and tout1;

end process;

  process(tout2)

begin

dectemp<=(not dn) and tout2;

end process;

FIN<=addtemp or dectemp;--是ctrl的fout,ncounter的fin

  process (FIN)

begin

   if rising_edge(FIN) then

          count<=count+1;

     if count>=31 then
         
              v2<='1';

         else v2<='0';

     end if;

   end if;

vout<=v2;

end process;

end pll_arch;


再看仿真图

(原文件名:12.jpg)

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

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

出0入0汤圆

 楼主| 发表于 2010-12-2 17:22:03 | 显示全部楼层
相关的论文ourdev_601851PNWCB1.pdf(文件大小:183K) (原文件名:VHDLDPLL.pdf)

出0入0汤圆

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

本版积分规则

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

GMT+8, 2024-7-24 15:18

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

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