?? baud.vhd
字號:
---------------------------------------------------------------
--File name : Baud.vhd
--Function : 波特率發生器
--Interface :
-- clk : 時鐘輸入,為24MHz,波特率為115200,由于
-- 時鐘為波特率的4倍,所以分頻系數為
-- 64000000/115200/4=138
-- dout : 波特率輸出
--Author : wanyou
--Date : 2008-03-24
----------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity Baud is
port(
clk : in std_logic;
dout : out std_logic
);
end Baud;
architecture behave of Baud is
constant cnt_len : integer := 137;
signal temp : std_logic;
begin
process(clk)
variable cnt : integer range 0 to cnt_len;
begin
if rising_edge(clk) then
if cnt = cnt_len/2 then
cnt := 0;
temp <= not temp;
else
cnt := cnt + 1;
end if;
end if;
dout <= temp;
end process;
end behave;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -