ch可综合的Verilog设计.ppt
状态机设计(续) 2 状态跳转 // transition always @(posedege clk or negedge rst_n) begin if(!rst_n) current_state = SLEEP; else current_state = next_state; end 敏感信号表时钟信号以及复位信号边沿的组合 使用非阻塞赋值 状态机设计(续) 3 当前状态下的动作 // action wire read_book; assign read_book = (curretn_state ==STUDY) ? 1’b1: 1’b0; ... ... 4 下状态判断 // next state decision always @(current_state or input_signals) begin case (current_state) SLEEP: begin if(clock_alarm) next_state = STUDY; else next_state = SLEEP; end SYUDY:... ; EAT:... ; AMUSE:... ; default: ... ; endcase end 状态机设计(续) 敏感信号表包括所有的右边表达式中的变量以及if/case条件中的变量 使用阻塞赋值 If/else要配对以避免latch的产生 状态机设计-举例 实现111序列检测逻辑 CAP_1 CAP_11 CAP_111 IDLE rst_n 1 0 1 0 1 0 0 1 检测到目标序列,产生输出动作 状态转换图 状态机设计-举例(续) 1 状态定义 //state definition parameter IDLE = 4b0001; parameter CAP_1 = 4b0010; parameter CAP_11 = 4b0100; parameter CAP_111 = 4b1000; reg [0:3] current_state; reg [0:3] next_state; 2 状态跳转 // state transition always @(posedge clk or negedge rst_n) begin if(!rst_n) current_state = IDLE; else current_state = next_state; end 状态机设计-举例(续) 3 下状态判断 // next state decison always @(current_state or data_in) begin case(current_state ) IDLE: begin if(data_in) next_state = CAP_1; else next_state = IDLE; end CAP_1: begin if(data_in) next_state = CAP_11; else next_state = IDLE; end 状态机设计-举例(续) 必须保证状态判断的完备性和下状态的唯一性 CAP_11: begin if(data_in) next_state = CAP_111; else next_state = IDLE; end CAP_111: begin
您可能关注的文档
最近下载
- 《GB 28263-2024民用爆炸物品生产、销售企业安全管理规程》最新解读.pptx
- 工程力学(第七版)蒙晓影全套PPT课件.ppt
- 无人机与机器人在建筑施工现场智慧管理中的应用.docx
- 新疆维吾尔自治区2024年中考语文真题试卷【附答案】 .pdf VIP
- 第二单元教学设计-统编版高中语文必修下册.docx VIP
- 在线网课学堂《舰艇动力装置》单元测试考核答案.pdf VIP
- 心肌纤维化中细胞外基质重塑的分子机制.pptx
- 2025年国家公务员农业农村部面试题型及答案.docx VIP
- a330机型分部sop航线检查单.pdf VIP
- 2025年国家公务员农业农村部面试题型及答案.docx VIP
原创力文档

文档评论(0)