-
q5b
module top_module (
input clk,
input areset,
input x,
output z
);parameter A = 1'b0; parameter B = 1'b1; reg[1:0] state; reg[1:0] next_state; always@(*) begin case(state) A: if(x) next_state = B; else next_state = A; B: next_state = B; endcase end always@(posedge clk or posedge areset) begin if(areset) state = A; else state = next_state; end always@(*) begin if(state == A) begin if(x) z = 1'b1; else z = 1'b0; end else begin if(x) z = 1'b0; else z = 1'b1; end endendmodule
-
q3a
module top_module(
input clk,
input reset,
input s,
input w,
output z
);parameter A = 1'd0; parameter B = 1'd1; reg[1:0] state; reg[1:0] next_state; reg[1:0] count; reg[1:0] num; always @(*) begin case(state) A: begin if(s) next_state = B; else next_state = A; end B: begin next_state = B; end endcase end always @(posedge clk) begin if(reset) state <= A; else state <= next_state; end always @(posedge clk) begin if(reset) count <= 2'd0; else if(count == 2'd2) count <= 2'd0; else if(state == B) count <= count + 1'b1; end always @(posedge clk) begin if(reset) num <= 1'b0; else begin if(count == 2'd0) begin if(w) num <= 1'b1; else num <= 1'b0; end else if(state == B) begin if(w) num <= num + 1'b1; else num <= num; end end end assign z = (state == B && num == 2'd2 && count == 2'd0);endmodule
Circuits--Sequential--FSM--q5b~q3a
且听风吟5672024-05-27 9:52
相关推荐
薛定e的猫咪9 小时前
因果推理研究方向综述笔记AOwhisky9 小时前
虚拟化技术学习笔记一只机电自动化菜鸟9 小时前
一建机电备考笔记(33) 机电专业技术(起重技术-吊装方案)(含考频+题型)小陈phd11 小时前
多模态大模型学习笔记(四十)——从“看字”到“懂结构”:版面分析与表格解析技术全解xuhaoyu_cpp_java11 小时前
SpringMVC学习(二)噜噜噜阿鲁~12 小时前
python学习笔记 | 9.2、模块-安装第三方模块我胖虎不答应!!13 小时前
Three.js开发思想笔记程序leo源13 小时前
C语言知识总结羊群智妍14 小时前
2026年GEO优化实战:AI搜索优化监测工具全解析中屹指纹浏览器14 小时前
2026浏览器插件指纹溯源机制与插件环境安全优化实战指南