数字信号发送接收Word格式文档下载.docx
- 文档编号:15920490
- 上传时间:2022-11-17
- 格式:DOCX
- 页数:9
- 大小:372.15KB
数字信号发送接收Word格式文档下载.docx
《数字信号发送接收Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《数字信号发送接收Word格式文档下载.docx(9页珍藏版)》请在冰豆网上搜索。
仿真结果:
在test_bench里测试了10101、01001、11101这几个信号,可以看到均实现了并转串输出
接收电路模块:
接收电路要实时检测起始位’0’的到来,一旦检测到起始位到,就要将这一帧数据接收下来,开始接受数据,接收完成后,将数据位和校验位取出,若校验无误,则并行送出,若有误则报警。
我在test_bench里串行输入了0、1、0、1、0、0、0…
第一个0为起始位,可以看到接收数据为00101,接受正确,alarm=0
整体结构:
包括数据发送和接收模块,用component语句调用前两个模块,即可实现
仿真结果
收获
这个自由创作刚开始准备的时候觉得挺简单,但真正开始编译的时候,发现很多问题,有时候编译通过了还是得不到正确的仿真波形,原因在于程序的思路有问题,只好再把程序流程在纸上模拟一遍,发现错误后再改正。
通过这次设计,从中对于VHDL语言有了更加深入的理解,对于数字信号的特点也有了初步的了解。
设计过程中,遇到过许多困难,但在努力下,数字信号的发送和接收,能够准确的发送和接收,最终通过仿真。
几点VHDL语法的收获:
1)在进行代码编写前,应先有一个明确的思路,可以通过纸上的模拟检验程序是否有错误。
2)test_bench里不同测试信号的process分开写,不仅简单明了,而且可以避免错误。
3)在进行顶层模块的test_bench信号书写时应当赋初值,否则观测不到信号。
代码附录:
1.发送模块
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysendis
port(a:
instd_logic_vector(4downto0);
clk,start:
instd_logic;
b:
outstd_logic);
endsend;
architecturebehavofsendis
signala0:
std_logic_vector(4downto0);
begin
process(clk,a)
variabletemp:
std_logic_vector(6downto0);
variabletemp0,m:
std_logic;
variablecnt:
integerrange0to8;
if(clk'
eventandclk='
1'
)then
if(m='
0'
temp0:
='
;
endif;
if(a0/=a)then
m:
temp(5downto1):
=a(4downto0);
temp(6):
=a(4)xora(3)xora
(2)xora
(1)xora(0);
temp(0):
a0<
=a;
if(m='
andstart='
=temp(0);
temp:
&
temp(6downto1);
if(cnt<
7)then
cnt:
=cnt+1;
else
="
0000000"
=0;
endif;
b<
=temp0;
endprocess;
endbehav;
2.接收模块
entityreceiveis
port(clk,re:
instd_logic;
accept:
outstd_logic_vector(4downto0);
alarm:
endreceive;
architecturearcofreceiveis
process(clk)
variablea:
integerrange0to7;
variableshift:
std_logic_vector(5downto0);
ifclk'
then
ifre='
andcnt=0then
alarm<
a:
if(a='
ifcnt<
7then
shift:
=re&
shift(5downto1);
if(shift(0)xorshift
(1)xorshift
(2)xorshift(3)xorshift(4)xorshift(5))='
accept<
=shift(4downto0);
endarc;
3.顶层模块
entitysignal_sendis
port(start:
string:
clk0:
rece:
warning:
outstd_logic
);
endsignal_send;
architectureactofsignal_sendis
componentsendis
endcomponent;
componentreceiveis
signalc1:
std_logic;
u0:
sendportmap(start=>
start,a=>
string,clk=>
clk0,b=>
c1);
u1:
receiveportmap(clk=>
clk0,re=>
c1,accept=>
rece,alarm=>
warning);
endarchitecture;
4.顶层模块的test_bench
entitysignal_send_tbis
endsignal_send_tb;
architecturebehavofsignal_send_tbis
componentsignal_sendis
signalstart:
signalclk:
signalalarm0:
std_logic:
signalcode,rec:
std_logic_vector(4downto0);
signal_sendportmap(start=>
start,string=>
code,clk0=>
clk,rece=>
rec,warning=>
alarm0);
process
begin
clk<
='
waitfor1ns;
endprocess;
start<
waitfor2ns;
wait;
begin
code<
00101"
waitfor30ns;
01001"
11101"
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数字信号 发送 接收