使用连接操作符+D触发器设计循环移位寄存器


1.设计代码

`default_nettype none
module Cycle_Shift_Register(clk,rst_n,in,out);
    parameter byte_size = 8;    //declare input and output width.
    input wire clk;
    input wire rst_n;
    input wire [byte_size-1:0] in;
    output reg [byte_size-1:0] out;

    always @(posedge clk or negedge rst_n) 
    begin
        if (!rst_n) //asynchronous reset
            begin
                out <= in;    //reload value        
            end
        else
            begin
                out <= {out[byte_size-2:0],out[byte_size-1]};  //connect operat
            end
    end
endmodule

2.移动过程