ShiftReg.v

This module implements a shift register of variable width and depth.

Ports

clkinputThe clock input.
resetinputReset input, which clears the shift register.
eninputEnable; the state is frozen when not asserted.
inoutput  The data to be latched.
outoutputThe latched and shifted output. Multiple words within the shift register may be accessed using the outport parameter.

Parameters

width1Data bit width.
depth1The depth of the shift register.
invert"no"Whether to invert the output, "yes" or "no".
outport1Selects the width in words of the output port, and can can range from 1 to depth to access all of the delayed outport words when needed.

Notes

Example instantiation in Verilog:

Depth three shift register.

wire			clk, reset, en;
wire		[11:0]	in, out;
ShiftReg #(.width(12), .depth(3))  Delay3 (
    .clk(clk), 
    .reset(reset),
    .en(en)
    .in(in), 
    .out(out)
);

An instance array that latches multiple words at different times:

wire			clk, reset;
wire			load0, load1, load2, load3;
wire		[15:0]	din0, din1, din2, din3;
wire		[63:0]	dout;
ShiftReg #(.width(16)) Register4 [3:0] (
    .clk(clk),
    .reset(reset),
    .en({load0, load1, load2, load3}), 
    .in({din0, din1, din2, din3}),
    .out(dout)
);