题解 | 根据状态转移表实现时序电路
`timescale 1ns/1ns module seq_circuit( input A , input clk , input rst_n, output wire Y ); reg Q0,Q1; always @(posedge clk or negedge rst_n) if (~rst_n) Q0 <= 1'b0; else Q0 <= ~Q0; always @(posedge clk or negedge rst_n) if (~rst_n) Q1 <= 1'b0; else Q1 <= (~A & (Q0 ^ Q1)) | (A & (Q0 ~^ Q1)); assign Y= Q0 & Q1; endmodule