资料介绍
DSP/FPGA
数字信号发送和接收的VHDL源码设计
发布日期:2009-3-22 11:12:18 文章来源:搜电 浏览次数: [pic]162
[pic][pic][pic]【数字信号的发送和接收】:设计一个5位数字信号的发送和接收电路
,把并行码变为串行码或把串行码变为并行码,串行偶校验检测器可通过异或实现。在
数据接收端,只有在代码传送无误后,才把数据代码并行输出。数据传送的格式采用异
步串行通信的格式,包含起始位、数据位、校验位、停止位和空闲位。
数据发送模块:将并行数据加上起始位、偶校验位和停止位,以串行方式发送出去。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity send is
port(start:in std_logic;
a: in std_logic_vector(4 downto 0);
clk: in std_logic;
b:out std_logic);
end send;
architecture rt1 of send is
begin
process(clk,a)
variable temp:std_logic_vector(6 downto 0);
variable tmp,m:std_logic;
variable tmp1:integer range 0 to 7;
begin
if(clk even and clk='1')then
if(m='0')then --发送空闲位
tmp:='1';
end if;
if(start='0')then --start键有效
m:='1';
temp(5 downto 1):=a(4 downto