上篇博文讲了使用Moore状态机来设计一个序列检测器:序列检测器的Moore状态机实现
原理一致,这里只不过采用了Mealy状态机实现,快速给出:
状态转移图如下:被检测序列为1101,也就是说,如果出现1101序列,则输出为1,否则输出为0。
Verilog HDL代码为:
`timescale 1ns / 1ps
//
// Company:
// Engineer:
//
// Create Date: 2019/01/04 20:34:06
// Design Name:
// Module Name: seq_det_mealy
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//
module seq_det_mealy(
input clk,
input reset,
input din,
output reg dout
);
localparam [1:0]
s0 = 2'b00,
s1 = 2'b01,
s2 = 2'b10,
s3 &#