一、Moore状态机
输出只与此时的状态有关,因此假如需要检测宽度为4的序列,则需要五个状态。
设计一个序列检测器,检测序列1101,检测到输出1,否则输出0。
`timescale 1ns / 1ps
module seq_det_moore(
input clk,
input reset,
input din,
output reg dout
);
//状态声明
localparam [2:0]
s0 = 3'b000,
s1 = 3'b001,
s2 = 3'b010,
s3 = 3'b011,
s4 = 3'b100;
reg [2:0] current_state,next_state;
always @(posedge clk, posedge reset)
begin
if(reset)
current_state
关注
打赏