题解 | #根据状态转移表实现时序电路#

根据状态转移表实现时序电路

https://www.nowcoder.com/practice/455c911bee0741bf8544a75d958425f7

`timescale 1ns/1ns

module seq_circuit(
      input                A   ,
      input                clk ,
      input                rst_n,
 
      output   wire        Y   
);
    reg             Q1,Q0 ;
always @(posedge clk or negedge rst_n) begin
    if(!rst_n) begin
        Q1 <= 1'b0 ;
    end
    else begin
        Q1 <= Q1 ^ Q0 ^ A ;
    end
end

always @(posedge clk or negedge rst_n) begin
    if(!rst_n) begin
        Q0 <= 1'b0 ;
    end
    else begin
        Q0 <= ~ Q0  ;
    end
end
assign  Y = Q1 & Q0 ;
endmodule

全部评论

相关推荐

Ncsbbss:又想干活又想要工资,怎么什么好事都让你占了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务