打印

3选1出问题了

[复制链接]
1251|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
hlhfootbal|  楼主 | 2012-6-13 08:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
XGA_PLL 产生3个 clocks.
CLK0 : 24MHz
CLK1 : 48MHz
CLK2 : 96MHz
根据FORMATDAT,从3个 clocks中选一个时钟输出。
但是结果出错,FORMATCLK输出的是4MHz,不是 96MHz.
请教下问题出在哪里了。
谢谢!

library ieee;
use ieee.STD_LOGIC_1164.all;
library ieee;
use ieee.STD_LOGIC_ARITH.all;
library ieee;
use ieee.STD_LOGIC_UNSIGNED.all;

entity XGA_PLL is
port(
CLB : out std_logic;
CLK0 : out std_logic;
CLK1 : out std_logic;
CLK2 : out std_logic
);
end;

architecture XGA_PLL of XGA_PLL is
constant CLK0_CYCLE : TIME := 41.667 ns ;--24MHz
constant CLK1_CYCLE : TIME := 20.833 ns ;--48MHz
constant CLK2_CYCLE : TIME := 10.416 ns ;--96MHz

signal ICLK0 : std_logic;
signal ICLK1 : std_logic;
signal ICLK2 : std_logic;
signal ICLB : std_logic;

begin

process
begin
ICLK0 <= '1' ;wait for CLK0_CYCLE / 2;
ICLK0 <= '0' ;wait for CLK0_CYCLE / 2;
end process;
CLK0 <= ICLK0;

process
begin
ICLK1 <= '1' ;wait for CLK1_CYCLE / 2;
ICLK1 <= '0' ;wait for CLK1_CYCLE / 2;
end process;
CLK1 <= ICLK1;

process
begin
ICLK2 <= '1' ;wait for CLK2_CYCLE / 2;
ICLK2 <= '0' ;wait for CLK2_CYCLE / 2;
end process;
CLK2 <= ICLK2;

process
begin
ICLB <= '0' ;wait for CLK0_CYCLE * 16;
ICLB <= '1' ;wait;
end process;
CLB <= ICLB;

end;


library ieee;
use ieee.STD_LOGIC_1164.all;
library ieee;
use ieee.STD_LOGIC_ARITH.all;
library ieee;
use ieee.STD_LOGIC_UNSIGNED.all;


entity SSTC_TEST_TOP is
port(
-- CLB : in std_logic ;
-- CLK : in std_logic ;
FORMATCLK : out std_logic
-- locked : out std_logic
);
end;

architecture SSTC_TEST_TOP of SSTC_TEST_TOP is
signal ICLK : std_logic;
-- signal IQ : std_logic_vector(3 downto 0);
signal CLK_XGA1 : std_logic;
signal CLK_XGA2 : std_logic;
signal CLK_XGA3 : std_logic;
signal FORMATDAT : std_logic_vector(7 downto 0);
signal ICLB : std_logic;

component XGA_PLL
port (
CLB : out std_logic;
CLK0 : out std_logic;
CLK1 : out std_logic;
CLK2 : out std_logic
);
end component;

begin
C1: XGA_PLL
port map (
CLB => ICLB,
CLK0 => CLK_XGA1,
CLK1 => CLK_XGA2,
CLK2 => CLK_XGA3
);

process(ICLK)
begin
if ICLK'event and ICLK = '1' then
if ICLB = '0' then
FORMATCLK <= '0';
else
case FORMATDAT(7 downto 0) is
when "00000000" => FORMATCLK <= CLK_XGA1;
when "00000001" => FORMATCLK <= CLK_XGA2;
when "00000010" => FORMATCLK <= CLK_XGA3;
when others => FORMATCLK <= '0';
end case;
end if;
end if;
end process;

process(ICLK)
begin
if ICLK'event and ICLK = '1' then
if ICLB = '0' then
FORMATDAT <= "00000000";
else FORMATDAT <= "00000010";
end if;
end if;
end process;

ICLK <= CLK_XGA1;

end SSTC_TEST_TOP;

相关帖子

沙发
drentsi| | 2012-6-16 11:49 | 只看该作者
process(ICLK)

begin

if ICLK'event and ICLK = '1' then

if ICLB = '0' then

FORMATCLK <= '0';

else

case FORMATDAT(7 downto 0) is

when "00000000" => FORMATCLK <= CLK_XGA1;

when "00000001" => FORMATCLK <= CLK_XGA2;

when "00000010" => FORMATCLK <= CLK_XGA3;

when others => FORMATCLK <= '0';

end case;

end if;

end if;

end process;

-----------------------------------------------------------------
FORMATCLK 不要放在process里面选择
而应放在process外面,用这样的方式
FORMATCLK <= CLK_XGA1 when FORMATDAT(7 downto 0) =***
else CLK_XGA2 when ***
else CLK_XGA3 when ***
else '0';

使用特权

评论回复
板凳
lwq030736| | 2012-6-16 13:55 | 只看该作者
看下你的锁相环参数设置对不对
你那些wait for什么的其实只在testbench里面有用
不会给你综合成能够实现的电路的

使用特权

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

本版积分规则

133

主题

417

帖子

1

粉丝