⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart_package.vhd

📁 异步串口通信VHDL源代码
💻 VHD
字号:
-- 库声明library IEEE;use IEEE.STD_LOGIC_1164.all; -- 包声明PACKAGE UART_PACKAGE IS	 	-- 信号监测器状态type dt_state is (dt_unlock,			-- 未锁定状态dt_lock 			-- 锁定状态);	 -- UART状态type UART_STATE is( UART_IDLE,UART_LOAD,UART_SEND,	UART_END_SEND,UART_RECV,UART_END_RECV);-- 计数器计数范围type BD_COUNT is range 65535 downto 0;-- 9600波特率对应参数constant BD9600_FPC : BD_COUNT := 5208;constant BD9600_HPC : BD_COUNT := 2604;-- 波特率测试参数constant BDTEST_FPC : BD_COUNT := 10;constant BDTEST_HPC : BD_COUNT := 5;-- 奇偶校验规则定义type PARITY is(NONE,		-- 无奇偶校验ODD,		-- 奇校验EVEN		-- 偶校验);-- 类型声明type test_vectors is array (0 to 10) of std_logic;-- 无奇偶校验测试序列constant test_si_none : test_vectors := ('0', '1', '0', '1', '0', '1', '0', '1', '0', others => '1');-- 奇校验测试序列constant test_si_odd : test_vectors := ('0', '1', '0', '1', '0', '1', '1', '1', '0', '1', others => '1');-- 偶校验测试序列constant test_si_even : test_vectors := ('0', '1', '0', '1', '0', '1', '0', '1', '0', '1', others => '1');-- 函数声明function MultiXOR(	din : in std_logic_vector )  	return std_logic;END UART_PACKAGE;-- 包体PACKAGE BODY UART_PACKAGE IS-- 函数实现function MultiXOR(	din : in std_logic_vector )  	return std_logic is	variable check : std_logic;begin	check := din(din'LOW);	for i in 1 to (din'HIGH) loop		check := check xor din(i);	end loop;			return check;end MultiXOR;END UART_PACKAGE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -