Complete the code to declare a 4-bit shift register.
reg [3:0] [1] ;
clk or input_data as register name.The shift register is declared as a 4-bit register named shift_reg.
Complete the code to shift data left by one bit on the rising edge of clock.
always @(posedge clk) begin
[1] <= {shift_reg[2:0], serial_in};
endserial_out or clk inside always block.The shift register shift_reg is updated by shifting left and inserting serial_in at LSB.
Fix the error in the code to correctly output the serial data from the shift register.
assign serial_out = [1][3];
serial_in or clock signals.The output serial_out should be assigned from the MSB of the shift register shift_reg.
Fill both blanks to complete the parallel load logic for a PISO shift register.
always @(posedge clk or posedge reset) begin if (reset) begin shift_reg <= 4'b0000; end else if (load) begin shift_reg <= [1]; end else begin shift_reg <= {shift_reg[2:0], [2]; end end
serial_out instead of serial_in for shifting.On load, the shift register takes the parallel input parallel_in. Otherwise, it shifts left inserting serial_in.
Fill all three blanks to complete a SISO shift register that shifts right and outputs the LSB.
always @(posedge clk or posedge reset) begin if (reset) begin shift_reg <= 4'b0000; end else begin shift_reg <= { [1], shift_reg[3:1] }; end end assign [3] = shift_reg[[2]];
The shift register shifts right by inserting serial_in at MSB. The output is the LSB shift_reg[0]. A wire serial_out is assigned to output.