(VHDL)奇数或偶数分频器如何设计?还有占空比怎么设计的啊?

[复制链接]
 楼主| Death格雷尔 发表于 2013-7-9 21:08 | 显示全部楼层 |阅读模式
这个程序对么 是奇分频还是偶分频啊?
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fpq is
port(
     clk:in std_logic;
     clkout:out std_logic);
end entity fpq;
architecture one of fqp is
signal cnt:std_logic_vector(1 downto 0);
begin
process(clk)
veriable cnt:integer range 0 to 3;
begin
if rising_edge(clk) then
  if cnt=3
    then cnt :=0;
    else cnt :=cnt+1;
end if;
if cnt< 2
  then clkout< ='0';
else clkout<='1';
end if;
end if;
end process;
end architecture one;
下面这个是占空比50%的  请问占空比怎么更改啊?
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fpq is
port(
     clk:in std_logic;
     clkout:out std_logic);
end entity fpq;
architecture one of fqp is
signal cnt:std_logic_vector(1 downto 0);
begin
process(clk)
begin
if rising_edge(clk) then
  if cnt="11"
    then clkout<="00";
    else cnt <=cnt+1;
end if;
if cnt="00"or cnt="01"
  then clkout< ='0';
else clkout<='1';
eng if;
end if;
end process;
end architecture one;
谢谢大家 帮个忙哦 嘿嘿
GoldSunMonkey 发表于 2013-7-9 23:19 | 显示全部楼层
GoldSunMonkey 发表于 2013-7-9 23:19 | 显示全部楼层
请看这篇**
GoldSunMonkey 发表于 2013-7-9 23:20 | 显示全部楼层
占空比不好设计,靠代码是不能任意占空比的。
 楼主| Death格雷尔 发表于 2013-7-10 20:01 | 显示全部楼层
GoldSunMonkey 发表于 2013-7-9 23:20
占空比不好设计,靠代码是不能任意占空比的。

非常感谢
GoldSunMonkey 发表于 2013-7-10 20:33 | 显示全部楼层
Death格雷尔 发表于 2013-7-10 20:01
非常感谢

别客气,亲
您需要登录后才可以回帖 登录 | 注册

本版积分规则

9

主题

27

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部