目录

Mealy 状态机

原题复现

我的设计

Moore 状态机

原题复现

状态转移图

我的设计


Mealy 状态机

原题复现

原题复现:

The following diagram is a Mealy machine implementation of the 2's complementer. Implement using one-hot encoding.

尽管我不太清楚这是个为啥?

但既然状态转移图都给你了,设计一个mealy状态机应该不成问题:

我的设计

module top_module (input clk,input areset,input x,output z
); localparam A = 2'b01, B = 2'b10;reg [1:0] state, next_state;always@(*)begincase(state)A: beginif(x) next_state = B; else next_state = A;endB: beginnext_state = B;enddefault: beginnext_state = A;endendcaseendalways@(posedge clk or posedge areset) beginif(areset) state <= A;else state <= next_state;endassign z = (state == A)?x:~x;/*reg z_mid;always@(*)begincase(state)A: beginif(x) z_mid = 1;else z_mid = 0;endB: beginif(x) z_mid = 0;else z_mid = 1;enddefault: beginz_mid = 0;endendcaseendassign z = z_mid;*/endmodule

Moore 状态机

姊妹篇,用Moore状态机如何实现?

原题复现

原题复现:

You are to design a one-input one-output serial 2's complementer Moore state machine. The input (x) is a series of bits (one per clock cycle) beginning with the least-significant bit of the number, and the output (Z) is the 2's complement of the input. The machine will accept input numbers of arbitrary length. The circuit requires an asynchronous reset. The conversion begins when Reset is released and stops when Reset is asserted.

状态转移图

我们根据mealy状态机的状态转移图来画Moore状态机的状态转移图,然后完成设计。

我的设计

给出设计:

module top_module (input clk,input areset,input x,output z
); localparam A = 0, B = 1, C = 2, D = 3;reg [1:0] state, next_state;always@(*) begincase(state)A: beginif(x) next_state = B;else next_state = A;endB: beginif(x) next_state = D;else next_state = C;endC: beginif(x) next_state = D;else next_state = C;endD: beginif(x) next_state = D;else next_state = C;enddefault: beginnext_state = A;endendcaseendalways@(posedge clk or posedge areset) beginif(areset) state <= A;else state <= next_state;    endassign z = (state == B || state == C)? 1 : 0;endmodule

HDLBits 系列(34)Serial two's complememter(Mealy and Moore FSM)相关推荐

  1. HDLBits 系列(27)孰对孰错 之 Fsm onehot?

    目录 前言 原题复现 审题 我的设计 测试吐槽 最后的解决方案 前言 今天的这个问题,并没有满意的解决,路过的朋友,看出问题所在的,可以给个评论,谢谢. 原题复现 Fsm onehot 下面是一个最基 ...

  2. HDLBits 系列(0)专题目录

    本篇博文是近来总结HDLBits系列的目录,点击蓝色字体即可进入查看具体内容. HDLBits 系列(1)从HDLBits中获取灵感,整顿自己,稳步前行 HDLBits 系列(2)如何避免生成锁存器? ...

  3. HDLBits 系列(31)Serial Receiver and Datapath

    目录 序言 原题复现 我的设计 序言 上篇博文: HDLBits 系列(30)Serial Receiver 写了串行接收器如何接收8位串行数据,正确接收8位串行数据后给一个接收完毕标志信号,这篇博文 ...

  4. HDLBits 系列(29)PS/2 mouse protocol(PS/2 packet parser and datapath)

    目录 序言 原题传送 题目解释 我的设计 序言 上篇博客: HDLBits 系列(28)PS/2 mouse protocol(PS/2 packet parser) 只对PS/2 mouse pro ...

  5. HDLBits 系列(8)——Sequential Logic(Finite State Machines(一))

    目录 3.2 Sequential Logic 3.2.5 Finite State Machines 1. Simple FSM 1 (asynchronous reset) 2. Simple F ...

  6. Moore FSM和Mealy FSM的区别

    Moore型FSM:下一状态只由当前状态决定,即次态=f(现状,输入),输出=f(现状) Mealy型FSM:下一状态不但与当前状态有关,还与当前输入值有关,即次态=f(现状,输入),输出=f(现状, ...

  7. verilog中一文搞懂有限状态机(FSM)Mealy和Moore状态机(及一段式,二段式,三段式)

    三段式 1.什么是有限状态机 2.Mealy 状态机 2.Moore FSM 3.Mealy 和 Moore的区别 4.Encoding 风格 设计原则 5. 一段式状态机 6. 二段式状态机 控制c ...

  8. HDLBits 系列(33)Sequence Recognition with Mealy FSM

    目录 原题复现 状态转移图 我的设计 测试 原题复现 原题重现: Implement a Mealy-type finite state machine that recognizes the seq ...

  9. HDLBits 系列(30)Serial Receiver

    目录 序言 原题复现 翻译 状态转移图 我的设计 设计解释 序言 所谓的串行接收器(Serial Receiver),类似,或者根本就是Uart的协议的一种形式,Uart的接收器部分,如何实现呢? 原 ...

最新文章

  1. 一天一算法:快速排序
  2. Oracle表空间离线在线切换和数据库关闭启动操作图解
  3. html5同心圆代码,HTML5/Canvas 鼠标跟随的同心圆
  4. IntelliJ IDEA 14.x 创建工作空间与多个Java Web项目
  5. Nginx惊群问题分析及解决
  6. SpacePack 运维工具之 Auto fdisk
  7. 802.11n无线网卡驱动linux,安装Broadcom Linux hybrid 无线网卡驱动总结
  8. linux时间转excel,linux时间戳转换【操作模式】
  9. Windows7压缩文件到最小的方法
  10. 中国云服务商最新排名:阿里云第一腾讯云华为云分列二、三名
  11. python迅雷远程下载页面_迅雷远程下载 linux
  12. 分销代理商管理系统有哪些功能?
  13. 模拟cmos集成电路(7)
  14. 自适应均衡器的研究与仿真设计
  15. 离线百度地图嵌入开发
  16. 我国三大常用坐标系区别(北京54、西安80和WGS-84)(转)
  17. python代码在线回归中怎么运行_手把手教你用Python进行回归(附代码、学习资料)...
  18. 被ddos攻击了怎么办,阿里云又太贵了
  19. 怎么从转移特性曲线上看dibl_半导体器件原理chapter4.ppt
  20. easybuy项目总结_20180409

热门文章

  1. c语言链表程序框图,C语言课程设计————写下流程图! 谢谢
  2. 测试的目的_电磁干扰测试技术的目的是什么呢?
  3. 通讯系统流程图_基于OBD系统的量产车评估测试(PVE)
  4. 两张照片重叠处半透明_全面解读超焦距,让你的风景照片更锐更清晰
  5. 计算机内部使用什么方法技术,计算机内部使用什么技术
  6. java 容器的嵌套_java界面设计里怎么实现容器嵌套
  7. 第十六届全国大学生智能车竞赛全国总决赛报名信息汇总
  8. 无线节能信标调试说明-2021-3-3
  9. LED亮度与电流之间的关系?
  10. 批处理处理远程计算机,使用批处理文件在远程计算机上调整PowerShell窗口的大小...