Fsm serial
题目:
In many (older) serial communications protocols, each data byte is sent along with a start bit and a stop bit, to help the receiver delimit bytes from the stream of bits. One common scheme is to use one start bit (0), 8 data bits, and 1 stop bit (1). The line is also at logic 1 when nothing is being transmitted (idle).Design a finite state machine that will identify when bytes have been correctly received when given a stream of bits. It needs to identify the start bit, wait for all 8 data bits, then verify that the stop bit was correct. If the stop bit does not appear when expected, the FSM must wait until it finds a stop bit before attempting to receive the next byte.
题目翻译:
在许多(较旧的)串行通信协议中,每个数据字节都与一个起始位和一个停止位一起发送,以帮助接收器从位流中分隔字节。 一种常见的方案是使用 1 个起始位 (0)、8 个数据位和 1 个停止位 (1)。 当没有传输任何内容(空闲)时,该线路也处于逻辑 1。设计一个有限状态机,当给定比特流时,它将识别何时正确接收字节。 它需要识别起始位,等待所有 8 个数据位,然后验证停止位是否正确。 如果停止位没有按预期出现,FSM 必须等待直到找到停止位,然后才能尝试接收下一个字节。
逻辑抽象:
一个完整数据包括起始位、8个数据位和一个停止位共10个位
未进入起始位时,系统处于空闲状态
进入停止位后,进行判别,如果停止位正确,按照in的输入选择进入S0或S1
如果停止位不正确,进入等待状态,直到找到in,并结束该次数据输入,返回S0或S1
有限状态机:
注意事项:
一个成功的数据传输包括起始位,8个数据位,停止位10个状态,起始位和停止位也占一个周期,不能空闲状态判定in后直接进入数据位进行数据传输,同理第8个数据位完成后需要进入停止位,而不能直接判断进入错误位或返回
module top_module(input clk,input in,input reset, // Synchronous resetoutput reg done
);
reg [3:0] state,next_state;
parameter S11=11,S0=0,S1=1,S2=2,S3=3,S4=4,S5=5,S6=6,S7=7,S8=8,S9=9,S10=10;
always @(*)
begin
case(state)
S0:next_state<=(!in)?S1:S0;
S1:next_state<=S2;
S2:next_state<=S3;
S3:next_state<=S4;
S4:next_state<=S5;
S5:next_state<=S6;
S6:next_state<=S7;
S7:next_state<=S8;
S8:next_state<=S9;
S9:next_state<=(in)?S10:S11;
S10:next_state<=(!in)?S1:S0;
S11:next_state<=(in)?S0:S11;
default;
endcase
endalways@(posedge clk)
begin
if(reset)
state<=S0;
else state<=next_state;
endalways@(posedge clk)
begin
if(reset)
done<=0;
else if(next_state==S10)
done<=1;
else done<=0;
endendmodule
本人vegetable,勿喷
Fsm serial相关推荐
- Fsm serialdp
题目: See also: Serial receiver and datapath,We want to add parity checking to the serial receiver. Pa ...
- 【verilog学习23】HDLBits:Circuits_Sequential Logic_Finite State Machines
[HDLBits]Circuits_Sequential Logic_Finite State Machines I FSM 1 (asynchronous reset) (Fsm1) 1.代码编写 ...
- verilog练习:hdlbits网站上的做题笔记(6)
前言 之前的文章<如何学习verilog,如何快速入门?>中提到了verilog学习,推荐了一个可以练习的网站:hdlbits网站,那自己也玩玩这个网站. 这篇文章,是接着<veri ...
- 【HDLBits 刷题 10】Circuits(6)Finite State Manchines 10-17
目录 写在前面 Finite State Manchines Lemmings1 Lemmings2 Lemmings3 Lemmings4 Fsm onehot Fsm ps2 Fsm ps2dat ...
- HDLBits 系列(34)Serial two's complememter(Mealy and Moore FSM)
目录 Mealy 状态机 原题复现 我的设计 Moore 状态机 原题复现 状态转移图 我的设计 Mealy 状态机 原题复现 原题复现: The following diagram is a Mea ...
- HDLBits 系列(31)Serial Receiver and Datapath
目录 序言 原题复现 我的设计 序言 上篇博文: HDLBits 系列(30)Serial Receiver 写了串行接收器如何接收8位串行数据,正确接收8位串行数据后给一个接收完毕标志信号,这篇博文 ...
- HDLBits 系列(30)Serial Receiver
目录 序言 原题复现 翻译 状态转移图 我的设计 设计解释 序言 所谓的串行接收器(Serial Receiver),类似,或者根本就是Uart的协议的一种形式,Uart的接收器部分,如何实现呢? 原 ...
- H3C Boot升级 Serial模式
开机 CTRL+B (何时按见附件 底部) ###################################Serial模式 ===================<EXTEND-BOOT ...
- SAP 对HU做货物移动报错-Only 0 serial numbers entered instead of 30 -
SAP 对HU做货物移动报错-Only 0 serial numbers entered instead of 30 - 元旦刚过,就收到客户的业务人员报错说,当其对HU做转库(同一个公司代码下工厂到 ...
最新文章
- python和c先学哪个对于初中生来说-初中生想学编程,请问先学C语言好还是先学Python?...
- js 不同页面间传递值并取值
- Oracle 10g OCP 042 题库 1-30 题 共168题
- 基于CentOS 搭建 FTP 文件服务
- SAP Business ByDesign云计算ERP软件
- linux 文件系统 vfs,linux虚拟文件系统vfs
- 【MySQL】查看MySQL配置文件路径及相关配置
- 简单的动画函数封装(2)
- 物联网通信技术最全科普!你一定要了解的NB-IoT
- ef mysql code first_关于ef+codefirst+mysql(入门)
- Controller接口控制器(6)
- odbc mysql server_使用MySQL ODBC进行MySQL和SQL Server转换
- 手把手,从零开始搭建个人博客网站(附源码)
- python3d动图_如何用Python制作3D动态航线图
- IDEA Translation插件,有道智云(有道翻译)应用ID,密钥申请教程
- 想成为魅力十足的人的十大习惯
- java对象实例化内存布局与访问定位
- Echarts饼图字体颜色
- 服务器显示屏出现白屏,远程服务器时出现白屏怎么解决
- 如何使用IDM下载电子书
热门文章
- 一个让全球人沉迷的游戏背后需要怎样的团队?
- c语言横坐标加一怎么表示,在c语言里自动加一的函数怎么写
- 如何成为一个牛逼的程序员
- IPO观察丨绿源持续推进IPO,这次不止“一部车能骑10年”
- b站pink老师JavaScript的PC端网页特效 案例代码——仿淘宝固定侧边栏
- GoJS教程:图布局
- 行式数据库和列式数据库
- html div 显示动画效果,css3-动画(animation)效果的实现
- win10共享未授予用户在此计算机,win10系统访问网上邻居提示未授予用户在此计算机上的请求登录类型的操作步骤...
- 手机动态桌面壁纸源码