module shift_reg_4b ( input logic clk, input logic rst, input logic en, input logic in, output logic out ); logic [3:0] shift_reg; always_ff @(posedge clk) begin if (rst) begin shift_reg <= 4'b0000; end else if (en) begin shift_reg <= {shift_reg[2:0], in}; end end assign out = shift_reg[3]; endmodule