I have designed a serial in parallel out shift register as input register for an encoder
module ShiftRegister_SIPO(clk, in, out);
input clk,in;
output [3:0] out;
reg [3:0] tmp;
always @(posedge clk)
begin
tmp = {tmp[2:0], in};
end
assign PO = tmp;
endmodule
how do I retain the value once the desired parallel out data is got , even with clk=1? Because even after the output data is got the value keeps shifting. For example ,if i give
Part of testbench
in=1;
#10
in=0;
#10
in=1;
#10
in=1;
#5 clk=~clk;
I get 1011 at the 4th clock cycle , but the value then keeps shifting. Can i retain it as 1011 for the remaining period also, still keeping the clk=1. Thanks in advance