?? send_top.vhd
字號(hào):
library IEEE;
use IEEE.std_logic_1164.all;
use WORK.SEND_PACKAGE.all;
entity send_top is
generic(
DATA_BIT : integer := 64; -- 數(shù)據(jù)位個(gè)數(shù)
TOTAL_BIT : integer := 66 -- 總數(shù)據(jù)個(gè)數(shù)
);
port(
clk : in STD_LOGIC; -- 時(shí)鐘信號(hào)
rdclk:out std_logic; -- 讀fifo的時(shí)鐘
rdempty:in std_logic; --讀空標(biāo)志
rdreq:out std_logic;
-- send : in STD_LOGIC; -- 發(fā)送控制信號(hào)
send_bus : in STD_LOGIC_VECTOR(DATA_BIT-1 downto 0);-- 數(shù)據(jù)發(fā)送總線
-- send_over : out STD_LOGIC; -- 發(fā)送完成信號(hào)
RxD :in std_logic;
-- dout :out std_logic_vector(5 downto 0);
TxD : out STD_LOGIC ); -- RS-232數(shù)據(jù)發(fā)送端口
end send_top;
architecture send_top of send_top is
-- 計(jì)數(shù)器組件聲明
component counter
generic(
MAX_COUNT : INTEGER := 66
);
port (
ce : in STD_LOGIC;
clk : in STD_LOGIC;
reset_n : in STD_LOGIC;
overflow : out STD_LOGIC
);
end component;
---奇偶校驗(yàn)?zāi)K
component parity_verifier is
-- 類屬參數(shù)
generic (
DATA_LENGTH : integer := 64;
PARITY_RULE : PARITY := ODD );
-- 端口
port (
source : in std_logic_vector(DATA_LENGTH-1 downto 0);
parity : out std_logic );
end component;
-- 移位寄存器
component shift_register
generic(
TOTAL_BIT : INTEGER := 67
);
port (
clk : in STD_LOGIC;
din : in STD_LOGIC;
reset_n : in STD_LOGIC;
dout : out STD_LOGIC
);
end component;
component detector1 is
port (
clk : in std_logic;
reset_n : in std_logic;
RxD : in std_logic; --輸入信號(hào)
new_data : out std_logic ); --指示信號(hào),當(dāng)監(jiān)測(cè)到新的數(shù)據(jù)傳輸時(shí)置高
end component;
-- 二選一選擇器
component switch
port (
din1 : in STD_LOGIC;
din2 : in STD_LOGIC;
sel : in STD_LOGIC;
dout : out STD_LOGIC
);
end component;
-- UART內(nèi)核
component send_core is
generic (
DATA_BIT : integer := 64;-- 數(shù)據(jù)位個(gè)數(shù)
TOTAL_BIT : integer := 66;-- 總數(shù)據(jù)個(gè)數(shù)
PARITY_RULE:PARITY := ODD
);
port (
-- 時(shí)鐘信號(hào)
clk : in std_logic;
rdclk:out std_logic; -- 讀fifo的時(shí)鐘
rdempty:in std_logic; --讀空標(biāo)志
rdreq:out std_logic;
-- 復(fù)位、使能子模塊的信號(hào)
reset_parts : out std_logic;
reset_dt:out std_logic;
ce_parts : out std_logic;
new_data:in std_logic;
-- 和移位寄存器的接口信號(hào)
RxD:in std_logic;
send_si : out std_logic;
--計(jì)數(shù)器計(jì)數(shù)到達(dá)上閾的指示信號(hào)
overflow : in std_logic;
-- dout :out std_logic_vector(5 downto 0);
parity:in std_logic;
-- 輸出選擇信號(hào)
sel_out : out std_logic;
-- 提供給CPU的接口信號(hào)
--send : in std_logic;
send_bus : in std_logic_vector(DATA_BIT-1 downto 0)
-- send_bus_2: out std_logic_vector(63 downto 0);
-- send_over : out std_logic
);
end component;
---- 常數(shù) -----
constant VCC_CONSTANT : STD_LOGIC := '1';
---- 內(nèi)部信號(hào)聲明 ----
signal ce_parts : STD_LOGIC;
signal clk_inv : STD_LOGIC;
signal counter_clk : STD_LOGIC;
signal overflow : STD_LOGIC;
signal sr_out:STD_LOGIC;
signal reset_parts : STD_LOGIC;
signal sel_clk : STD_LOGIC;
signal sel_out : STD_LOGIC;
signal send_si : STD_LOGIC;
signal VCC : STD_LOGIC;
signal parity:std_logic;
signal new_data:std_logic;
signal reset_dt:std_logic;
--signal send_bus_2:std_logic_vector(63 downto 0);
begin
-- 信號(hào)連接
VCC <= VCC_CONSTANT;
-- UART內(nèi)核實(shí)例
U_Core : send_core
port map(
ce_parts => ce_parts,
clk => clk,
overflow => overflow,
reset_parts => reset_parts,
reset_dt => reset_dt,
rdclk => rdclk,
rdempty => rdempty,
rdreq => rdreq,
sel_out => sel_out,
parity => parity,
new_data=> new_data,
-- send => send,
RxD => RxD,
-- dout => dout ,
send_bus => send_bus,
-- send_bus_2 => send_bus_2,
-- send_over => send_over,
send_si => send_si
);
-- 計(jì)數(shù)器實(shí)例
U_Counter : counter
port map(
ce => ce_parts,
clk => clk,
overflow => overflow,
reset_n => reset_parts
);
-- 移位寄存器實(shí)例
U_SR : shift_register
port map(
clk => clk,
din => send_si,
dout => sr_out,
reset_n => reset_parts
);
-- 輸出選擇器實(shí)例
U_TXDSwitch : switch
port map(
din1 => VCC,
din2 => sr_out,
dout => TxD,
sel => sel_out
);
U_PV:parity_verifier
port map(
source => send_bus,
parity => parity
);
U_detector:detector1
port map(
clk => clk,
reset_n => reset_dt,
RxD => RxD,
new_data => new_data
);
end send_top;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -