把真值表搞出来,分别写出Q1*/Q0*/Y 的表达式。

`timescale 1ns/1ns

module seq_circuit(
   input                C   ,
   input                clk ,
   input                rst_n,
 
   output   wire        Y   
);


// USE D_ff

reg q1;
reg q0;

always @(posedge clk or negedge rst_n)
begin
    if(!rst_n)
    q1 <= 0 ;
    else
    q1 <= (~C&q0) | (C&q1);
end

always @(posedge clk or negedge rst_n)
begin
    if(!rst_n)
    q0 <= 0 ;
    else
    q0 <= (~C&q0) | (C&~q1);
end

assign Y = (C&q1&~q0) | (q0&q1);

endmodule