Shift register

Implement the following circuit:

a
题目网站

module top_module (
    input clk,
    input resetn,   // synchronous reset
    input in,
    output out);
    reg [3:0]q;
    assign out=q[3];
    always@(posedge clk)begin
        if(!resetn)begin
            q<=4'b0;
        end
        else begin
            q[3]<=q[2];
            q[2]<=q[1];
            q[1]<=q[0];
            q[0]<=in;
        end
    end
            
endmodule
posted @ 2024-04-11 16:52  江左子固  阅读(10)  评论(0编辑  收藏  举报