Intel® Quartus® Prime Pro Edition User Guide: Design Recommendations

ID 683082
Date 8/03/2023
Document Table of Contents Shift Register with Evenly Spaced Taps

The following examples show a Verilog HDL and VHDL 8-bit wide, 255-bit long shift register (W > 1 and M = 255) with evenly spaced taps at 64, 128, 192, and 254.

The synthesis software implements this function in a single ALTSHIFT_TAPS IP core and maps it to RAM in supported devices, which is allowed placement in dedicated RAM blocks or MLAB memory.

Verilog HDL 8-Bit Wide, 255-Bit Long Shift Register with Evenly Spaced Taps

module top (clk, shift, sr_in, sr_out, sr_tap_one, sr_tap_two,
				sr_tap_three );
	input clk, shift;
	input [7:0] sr_in;
	output [7:0] sr_tap_one, sr_tap_two, sr_tap_three, sr_out;
	reg [7:0] sr [254:0];
	integer n;
	always @ (posedge clk)
		if (shift == 1'b1)
			for (n = 254; n>0; n = n-1)
				sr[n] <= sr[n-1];
			sr[0] <= sr_in;
	assign sr_tap_one = sr[64];
	assign sr_tap_two = sr[128];
	assign sr_tap_three = sr[192];
	assign sr_out = sr[254];

Did you find the information on this page useful?

Characters remaining:

Feedback Message