|
|||||||||||
| 技術交流 | 電路欣賞 | 工控天地 | 數字廣電 | 通信技術 | 電源技術 | 測控之家 | EMC技術 | ARM技術 | EDA技術 | PCB技術 | 嵌入式系統 驅動編程 | 集成電路 | 器件替換 | 模擬技術 | 新手園地 | 單 片 機 | DSP技術 | MCU技術 | IC 設計 | IC 產業(yè) | CAN-bus/DeviceNe |
貼兩個小數分頻的程序,呵呵 |
| 作者:ISeeYou 欄目:EDA技術 |
r 分別是我前幾天發(fā)的帖求助大家的題目的程序,總算給做出來了,大家有興趣的話幫忙改進一下^_^ 1:實現241/28分頻的,我出來的是98989 98989 98989 98989 98989 989 然后依次循環(huán) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity hehe1 is PORT ( f_in:in std_logic; f_out: out std_logic); end; architecture b of hehe1 is signal counter :integer range 0 to 42; signal i :integer range 0 to 5; begin PROCESS(f_in) begin if (f_in'event and f_in='1') then if ( (0<=counter and counter<=4) or (9<=counter and counter<=12) or (17<=counter and counter<=21) or (26<=counter and counter<=29) or (34<=counter and counter<=38 ) ) then f_out<='1'; else f_out<='0'; end if; counter<=counter+1; if counter=25 then i<=i+1; end if; if (counter=25 and i=5) then counter<=0;i<=0; end if; if counter=42 then counter<=0; end if; end if; end PROCESS; end; 2:用累加器實現241/28分頻的,要求精度在10**(-8) library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity hehe2 is PORT ( f_in:in std_logic; f_out: out std_logic); end; architecture a of hehe2 is constant step :integer :=249500174; --constant step :integer :=998000699; signal counter :std_logic_vector(30 downto 0); begin PROCESS(f_in) begin if (f_in'event and f_in='1') then counter<=counter+step; end if; if counter<2**30 then f_out<='1'; elsif counter>=2**30 then f_out<='0'; end if; end PROCESS; end; 最后再次感謝吳明詩等朋友的幫助,謝謝大家! |
| 2樓: | >>參與討論 |
| 作者: 雷風 于 2005/9/5 23:02:00 發(fā)布:
呵呵 不錯 |
|
| 3樓: | >>參與討論 |
| 作者: ISeeYou 于 2005/9/6 1:51:00 發(fā)布:
to 雷風 也謝謝你的指點啊 |
|
|
|
| 免費注冊為維庫電子開發(fā)網會員,參與電子工程師社區(qū)討論,點此進入 |
Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號 |