第一范文网 - 专业文章范例文档资料分享平台

(完整版)FPGA课程设计基于FPGA器件设计与实现毕业论文

来源:用户分享 时间:2025/6/2 3:20:12 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

case state is

when x_idle=> --状态1,等

待数据帧发送命令

if xmit_cmd_p='1' then state<=x_start; txd_done<='0';

else state<=x_idle; end if;

when x_start=> --状态2,发送信号至起始位

if xcnt16>=\else xcnt16:=xcnt16+1; txds:='0'; state<=x_start; end if;

when x_wait=> --状态3,等待状态

if xcnt16>=\

if xbitcnt=framlent then state<=x_stop; xbitcnt:=0;

else state<=x_shift; end if;

xcnt16:=\

else xcnt16:=xcnt16+1; state<=x_wait;

end if;

x_shift=>txds:=txdbuf(xbitcnt);

xbitcnt:=xbitcnt+1;

when state<=x_wait;

--

状态4,将待发数据进行并串转换

when x_stop=> --状态5,停止位发送状态 if xcnt16>=\

if xmit_cmd_p='0' then state<=x_idle;

xcnt16:=\

else xcnt16:=xcnt16; state<=x_stop; end if; txd_done<='1';

else xcnt16:=xcnt16+1; txds:='1'; state<=x_stop;

end if;

when others=>state<=x_idle;

end case;

end if; txd<=txds; end process; end Behavioral;

3.3 UART接收器程序

library IEEE;

use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity reciever is

generic(framlenr:integer:=8);

Port (bclkr,resetr,rxdr:in std_logic; 义输入输出信号

r_ready:out std_logic;

rbuf:out std_logic_vector(7 downto 0));

end reciever;

--定

architecture Behavioral of reciever is

type states is (r_start,r_center,r_wait,r_sample,r_stop); --定义各子状态

signal state:states:=r_start; signal rxd_sync:std_logic; begin

pro1:process(rxdr) begin

if rxdr='0' then rxd_sync<='0'; else rxd_sync<='1'; end if; end process;

pro2:process(bclkr,resetr,rxd_sync) 控时序、组合进程

variable count:std_logic_vector(3 downto 0); 定义中间变量

variable rcnt:integer:=0;

variable rbufs:std_logic_vector(7 downto 0); begin if resetr='1'

then

state<=r_start;

--复位

elsif rising_edge(bclkr) then case state is

when r_start=> 态1,等待起始位

--主 --count:=\ --状

if rxd_sync='0' then state<=r_center; r_ready<='0'; rcnt:=0;

else state<=r_start; r_ready<='0'; end if;

when r_center=> --状态2,求出每位的中点

if rxd_sync='0' then

if count=\

else count:=count+1; state<=r_center; end if;

else state<=r_start;

end if;

when r_wait=> --状态3,等待状态

if count>=\

if rcnt=framlenr then state<=r_stop;

else state<=r_sample; end if;

count:=\

else count:=count+1; state<=r_wait;

end if;

when r_sample=>rbufs(rcnt):=rxd_sync; rcnt:=rcnt+1;state<=r_wait; --状态4,数据位采样检测

when r_stop=>r_ready<='1'; rbuf<=rbufs; state<=r_start;

--状态4,输出帧

(完整版)FPGA课程设计基于FPGA器件设计与实现毕业论文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c6wetg92wp92wkqq4mj6h371qz5d0ci00kjo_5.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top