Circuits--Building--FSM1101

  1. FSM1101

    module top_module (
    input clk,
    input reset, // Synchronous reset
    input data,
    output start_shifting);

    复制代码
     parameter s0 = 3'd0;
     parameter s1 = 3'd1;
     parameter s2 = 3'd2;
     parameter s3 = 3'd3;
     parameter s4 = 3'd4;
     
     reg[2:0] state;
     reg[2:0] next_state;
     
     always@(*)
         begin
             case(state) 
                s0:
                    begin
                        if(data) next_state = s1;
                        else     next_state = s0;
                    end
                 s1:
                    begin
                        if(data) next_state = s2;
                        else     next_state = s0;
                    end
                 s2:
                    begin
                        if(data) next_state = s2;
                        else     next_state = s3;
                    end
                 s3:
                    begin
                        if(data) next_state = s4;
                        else     next_state = s0;
                    end
                 s4: next_state = s4;
                    
             endcase
         end
     
     always@(posedge clk)
         begin
             if(reset)
                 state <= s0;
             else
                 state <= next_state;
         end
     
     assign start_shifting = (state == s4);

    endmodule

相关推荐
_落纸2 天前
三大基础无源电子元件——电阻(R)、电感(L)、电容(C)
笔记
Alice-YUE2 天前
【CSS学习笔记3】css特性
前端·css·笔记·html
2303_Alpha2 天前
SpringBoot
笔记·学习
风_峰2 天前
Ubuntu Linux SD卡分区操作
嵌入式硬件·ubuntu·fpga开发
FPGA_Linuxer2 天前
FPGA 40 DAC线缆和光模块带光纤实现40G UDP差异
网络协议·fpga开发·udp
Hello_Embed2 天前
STM32HAL 快速入门(二十):UART 中断改进 —— 环形缓冲区解决数据丢失
笔记·stm32·单片机·学习·嵌入式软件
咸甜适中2 天前
rust语言 (1.88) 学习笔记:客户端和服务器端同在一个项目中
笔记·学习·rust
Grassto2 天前
RAG 从入门到放弃?丐版 demo 实战笔记(go+python)
笔记
Magnetic_h2 天前
【iOS】设计模式复习
笔记·学习·ios·设计模式·objective-c·cocoa
周周记笔记2 天前
学习笔记:第一个Python程序
笔记·学习