当前位置: 首页 > news >正文

Verilog刷题笔记53

题目:
Fsm serialdata
See also: Serial receiver

Now that you have a finite state machine that can identify when bytes are correctly received in a serial bitstream, add a datapath that will output the correctly-received data byte. out_byte needs to be valid when done is 1, and is don’t-care otherwise.

在这里插入图片描述
解题:

module top_module(input clk,input in,input reset,    // Synchronous resetoutput [7:0] out_byte,output done
); //parameter idle=0,start=1,data_receive=2,stop=3,error=4;reg [2:0]state,next_state;reg [3:0]cnt;reg [7:0]out;always@(posedge clk)beginif(reset)state=idle;elsestate=next_state;endalways@(*)begincase(state)idle:next_state=(in==0)?start:idle;start:next_state=data_receive;data_receive:next_state=(cnt==8)?(in?stop:error):data_receive;stop:next_state=in?idle:start;error:next_state=in?idle:error;default:next_state=idle;endcaseendalways@(posedge clk)beginif(reset)cnt=0;else begincase(next_state)start:cnt=0;data_receive:cnt=cnt+1;default:cnt=cnt;endcaseendendalways@(posedge clk)beginif(reset)out=0;else begincase(next_state)start:out=0;data_receive:out={in,out[7:1]};endcaseendendassign done=(state==stop)?1:0;assign out_byte=out;// Use FSM from Fsm_serial// New: Datapath to latch input bits.endmodule

结果正确:
在这里插入图片描述

本题在51、52题目的基础上增加了记录数据、计周期数的功能。
即51、52两道题目的结合体。

http://www.lryc.cn/news/428121.html

相关文章:

  • GoFly快速开发后台框架-后端接口请求返回403提示码就跨域问题/请求端域名拦截问题
  • 设备实时数据采集:开启制造业智能化、自动化的新篇章
  • 【python与java的区别-03(集合、字典)】
  • Java继承
  • Kafka集群搭建的两种方式
  • 两种变量初始化方法的区别
  • 群晖把硬盘共享给win10(虚拟机或物理机)的两种办法
  • Java-Web面试题汇总
  • 数字化技术分别有哪些,数字化技术特点和优势是什么?
  • 微服务CI/CD实践(一)环境准备及虚拟机创建
  • 【SpringBoot】优化慢启动应用的用户体验
  • String str=“i“ 与 String str=new String (“i“) 一样吗?
  • 【数据结构】二叉树链式结构的实现
  • 如何有效找到目标客户群体?
  • 机器学习-混淆矩阵
  • 数据结构----栈
  • STL六大组件
  • 【机器学习】CNN的数学基础
  • 最小路径和[中等]
  • 【题库】——数组 小鱼比可爱
  • 基于飞腾平台的Hbase的安装配置
  • 【springboot】springboot接口参数全局解密,解决request内容修改后如何重新设置回去的问题
  • yml基本语法
  • 橙色简洁大气体育直播自适应模板赛事直播门户自适应网站源码
  • 【启明智显技术分享】工业级HMI芯片Model系列GUI合成到项目中的指南
  • 开源服务器运维工具1Panel
  • 新版本源2.0大模型发布:Yuan2-2B-July-hf
  • 用python生成GIF动图—用于博客插图或封面等
  • [RCTF2019]draw
  • 设计模式 - 责任链模式