The SRL (Shift Register) resource is available in the FPGA, but is called a different name. The LUT inside the Xilinx FPGA has a special feature that can be configured as a variable length SRL.
5 input LUT can become 32bit SRL
6 input, can become 64bit SRL
Therefore, the SRL you write may be integrated into a LUT.
A shift register with a shift length can be defined.
Just use a lut to implement a 16-bit shift register.
SRL16 is a 16bit shift register lookup table // 16-Bit Shift Register Look-Up-Table (LUT)
16 FF shift functions can be implemented in one LUT!
SSRL16 SRL16_inst (
.Q(Q), // SRL data output
.A0(A0), // Select[0] input
.A1(A1), // Select[1] input
.A2(A2), // Select[2] input
.A3(A3), // Select[3] input
.CLK(CLK), // Clock input
.D(D) // SRL data input
);
Xilinx official website description - principle
SRL16 is a shift register look up table (LUT). The inputs A3, A2, A1, and A0 select the output length of the shift register. The shift register may be a fixed, staTIc length or it may be dynamically adjusted.
The shift register LUT contents are iniTIalized by assigning a four-digit hexadecimal number to an INIT attribute. The first, or the left-most, hexadecimal digit is the most significant bit. If an INIT value is not specified, it defaults to a value Of four zeros (0000) so that the shift register LUT is cleared during configuraTIon.
The data (D) is loaded into the first bit of the shift register during the Low-to-High clock (CLK) transiTIon. During subsequent Low-to-High clock transitions data is shifted to the next highest bit position as new data is Loaded. The data appears on the Q output when the shift register length determined by the address inputs is reached.
Here are a few points,
- The initial value of the shift register can be initialized with the INIT attribute;
- the length of the shift register is determined by the value of the address line;
- Shift data is input from D terminal, Q terminal output
- The data moved in first is MSB
Xilinx official website description - Static Length Mode
To get a fixed length shift register, drive the A3 through A0 inputs with static values. The length of the shift register can vary from 1 bit to 16 bits as determined from the following formula:
Length = (8*A3) +(4*A2) + (2*A1) + A0 +1
If A3, A2, A1, and A0 are all zeros (0000), the shift register is one bit long. If they are all ones (1111), it is 16 bits long.
Xilinx official website description - Dynamic Length Mode
The length of the shift register can be changed dynamically by changing the values ​​driving the A3 through A0 inputs. For example, if A2, A1, and A0 are all ones (111) and A3 toggles between a one (1) and a zero ( 0), the length of the shift register changes from 16 bits to 8 bits.
Internally, the length of the shift register is always 16 bits and the input lines A3 through A0 select which of the 16 bits reach the output.
Inputs Output
Am CLK DQ
Am XXQ(Am)
Am ↑ DQ(Am-1)
m= 0, 1, 2, 3
Here are a few tips:
- The shift register is variable length
- The length change is specified by the address line
- The internal register length is constant, but the length of the interception has changed.
- The data is first shifted into A0, then to A1, and so on. Finally, it is output from Am-1 of the specified length. For example, A=8, the data is input from address 0 and output from address 7, so that the effective shift length is Is 8.
Description of Xilinx official website - VHDL instantiation example
-- SRL16: 16-bit shift register LUT operating on posedge of clock
-- All FPGAs
-- Xilinx HDL Libraries Guide version 7.1i
SRL16_inst : SRL16
-- The following generic declaration is only necessary if you wish to
-- change the initial contents of the SRL to anything other than all
-- zero's.
Generic map (
INIT = "X "0000")
Port map (
Q =》 Q, -- SRL data output
A0 =》 A0, -- Select[0] input
A1 =》 A1, -- Select[1] input
A2 =》 A2, -- Select[2] input
A3 =》 A3, -- Select[3] input
CLK =》 CLK, -- Clock input
D = " D -- SRL data input
);
-- End of SRL16_inst instantiation
Copy code
Description of Xilinx official website - Verilog instantiation example
-- SRL16: 16-bit shift register LUT operating on posedge of clock
- All FPGAs
-- Xilinx HDL Libraries Guide version 7.1i
SSRL16 SRL16_inst (
.Q(Q), // SRL data output
.A0(A0), // Select[0] input
.A1(A1), // Select[1] input
.A2(A2), // Select[2] input
.A3(A3), // Select[3] input
.CLK(CLK), // Clock input
.D(D) // SRL data input
);
// The following defparam declaration is only necessary if you wish to
// change the initial contents of the SRL to anything other than all
// zero's. If the instance name to the SRL is changed, that change
// needs to be reflected in the defparam statements.
Defparam SRL16_inst.INIT = 16'h0000;
// End of SRL16_inst instantiation
Then specific examples:
Distributed RAM based on SRL16 no longer supports devices such as V5, S6 and V6, but SRL16 is supported by all XIlinx devices and is used very frequently in the design. Therefore, it can be implemented by calling the primitive method to call SRL16E or even SRL32E. Original ISE distributed RAM IP core design. Give a sample code below
Module s2p_8channels_srl16(
a, d, clk, we, qspo
);
Input [3:0] a;
Input [4:0] d;
Input clk;
Input we;
Output [4:0] qspo;
SRL16E #(
.INIT(16'h0000) // Initial Value of Shift Register
) SRL16_inst_1 (
.Q(qspo[0]), // SRL data output
.A0(a[0]), // Select[0] input
.A1(a[1]), // Select[1] input
.A2(a[2]), // Select[2] input
.A3(a[3]), // Select[3] input
.CE(we),
.CLK(clk), // Clock input
.D(d[0]) // SRL data input
);
SRL16E #(
.INIT(16'h0000) // Initial Value of Shift Register
) SRL16_inst_2 (
.Q(qspo[1]), // SRL data output
.A0(a[0]), // Select[0] input
.A1(a[1]), // Select[1] input
.A2(a[2]), // Select[2] input
.A3(a[3]), // Select[3] input
.CE(we),
.CLK(clk), // Clock input
.D(d[1]) // SRL data input
);
SRL16E #(
.INIT(16'h0000) // Initial Value of Shift Register
) SRL16_inst_3 (
.Q(qspo[2]), // SRL data output
.A0(a[0]), // Select[0] input
.A1(a[1]), // Select[1] input
.A2(a[2]), // Select[2] input
.A3(a[3]), // Select[3] input
.CE(we),
.CLK(clk), // Clock input
.D(d[2]) // SRL data input
);
SRL16E #(
.INIT(16'h0000) // Initial Value of Shift Register
) SRL16_inst_4 (
.Q(qspo[3]), // SRL data output
.A0(a[0]), // Select[0] input
.A1(a[1]), // Select[1] input
.A2(a[2]), // Select[2] input
.A3(a[3]), // Select[3] input
.CE(we),
.CLK(clk), // Clock input
.D(d[3]) // SRL data input
);
SRL16E #(
.INIT(16'h0000) // Initial Value of Shift Register
) SRL16_inst_5 (
.Q(qspo[4]), // SRL data output
.A0(a[0]), // Select[0] input
.A1(a[1]), // Select[1] input
.A2(a[2]), // Select[2] input
.A3(a[3]), // Select[3] input
.CE(we),
.CLK(clk), // Clock input
.D(d[4]) // SRL data input
);
Shenzhen Scodeno Technology Co.,Ltd , https://www.scodenonet.com