nand2/07_Operating_System/00_HACK/BitShift8L.v
Michael Schröder 971b323822 added v2.0
2023-01-11 23:04:57 +01:00

23 lines
444 B
Verilog

/**
* 8-bit Shiftregister (shifts to left)
* if (load == 1) out[t+1] = in[t]
* else if (shift == 1) out[t+1] = out[t]<<1 | inLSB
* (shift one position to left and insert inLSB as least significant bit)
*/
`default_nettype none
module BitShift8L(
input clk,
input [7:0] in,
input inLSB,
input load,
input shift,
output [7:0] out
);
reg [7:0] out=0;
always @(posedge clk)
out <= load?in:(shift?{out[6:0],inLSB}:out);
endmodule