尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

verilog HDLBits刷题[Finite State Machines]“Exams/2014 q3fsm”---Q3a:FSM

verilog HDLBits刷题[Finite State Machines]“Exams/2014 q3fsm”---Q3a:FSM
📅 发布时间:2026/8/3 0:29:46

1、题目

Consider a finite state machine with inputssandw. Assume that the FSM begins in a reset state calledA, as depicted below. The FSM remains in stateAas long ass= 0, and it moves to stateBwhens= 1. Once in stateBthe FSM examines the value of the inputwin the next three clock cycles. Ifw= 1 in exactly two of these clock cycles, then the FSM has to set an outputzto 1 in the following clock cycle. Otherwisezhas to be 0. The FSM continues checkingwfor the next three clock cycles, and so on. The timing diagram below illustrates the required values ofzfor different values ofw.

Use as few states as possible. Note that thesinput is used only in stateA, so you need to consider just thewinput.

2、分析

s=0,进入号状态A,s=1,进入状态B,接着观察三个时钟周期内w为1的个数,如果三个时钟周期内刚好有2个w为1,则在第四个时钟周期将z拉高,其它时候z=0.

故可以四种状态

A:复位状态

B:第一个w

C:第二个w

D:第三个w,第三个w结束后从第一个w开始三个时钟周期

3、代码

module top_module ( input clk, input reset, // Synchronous reset input s, input w, output z ); parameter A=0,B=1,C=2,D=3; reg [2:0]state,next_state; reg [2:0]cnt;//计算有多少个w为1 always@(posedge clk)begin if(reset) state<=A; else state<=next_state; end always@(*)begin case(state) A:next_state=s?B:A; B:next_state=C; C:next_state=D; D:next_state=B; default:next_state=A; endcase end always@(posedge clk)begin if(reset) cnt<=3'd0; else begin case(state) A:cnt<=3'd0; B:cnt<=w; C:cnt<=cnt+w; D:cnt<=cnt+w; default:cnt<=3'd0; endcase end end assign z=(state==B&cnt==2); endmodule

相关新闻

  • 如何快速掌握magnetW磁力聚合搜索:面向新手的完整教程
  • 2026年浙江工业场景里走近固废掺混制浆方案成套机组 - 奔跑123
  • 晋中除甲醛公司母婴除醛技术揭秘:金耀母婴除甲醛分析避坑指南 - 信誉隆金银铂奢回收

最新新闻

  • 从物理到数字:按钮设计的核心技术原理与工程实践全解析
  • PyTorch 2.0 训练报错排查指南:5个高频内存与编译陷阱解析
  • 2026年帮全国同行打听 影像测量仪大家通常推荐哪个厂家 - 奔跑123
  • PyTorch GPU环境配置全攻略:从CUDA驱动到PyCharm避坑指南
  • 2026年优选:玩具ODM设计实力公司如何选?——汕头黑马设计全解析 - 装修教育财税推荐2026
  • 2026车间选购硬质合金旋转锉的实地考察记录 - 奔跑123

日新闻

  • 112、LLC谐振变换器的输入电压瞬态仿真分析
  • 2026深圳疑难签证办理指南:拒签再签/商务签/高端定制机构怎么选 - 互联网科技品牌测评
  • C-LODOP在Edge等现代浏览器中的部署、适配与实战应用

周新闻

  • 怀化母婴除甲醛公司测甲醛中心怎么选:康之居母婴除甲醛标准、流程、避坑指南 - 信誉隆金银铂奢回收
  • 三步打造你的终极音乐中心:foobox-cn网络电台功能完整指南
  • Lance湖仓格式:为多模态AI工作流设计的终极数据存储方案

月新闻

  • ClickHouse版本管理深度实战:4步构建零风险升级与回滚体系
  • Java 23 种设计模式:从踩坑到精通 | 番外:责任链模式 —— 物流审批流程实战
  • 华硕笔记本性能解放指南:G-Helper轻量级控制工具全面解析

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号