Xilinx FPGA中SRL原理

时间:2025-04-26  作者:Diven  阅读:0

SRL(移位寄存器)资源,在FPGA中都有,不过是叫不同的名字。Xilinx FPGA内部的LUT有个特殊功能,就是可以配置成可变长度SRL。

Xilinx FPGA中SRL原理

5输入的一个LUT可以变成32bit 的SRL

6输入的,可以变成64bit的SRL

所以,你写的SRL可能被综合成LUT。

可以定义移位长度的移位寄存器

就是用一个lut可以实现16位的移位寄存器。

SRL16 的是 16bit移位寄存器查找表 // 16-Bit Shift Register Look-Up-Table (LUT)

在一个LUT中可以实现16个FF移位的功能!

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 官网的说明——原理

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 of 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.

这里说了几点,

- 移位寄存器的初始值可以用INIT属性初始化;

- 移位寄存器的长度由地址线的取值决定;

- 移位数据从D端输入,Q端输出

- 先移入的数据是MSB

Xilinx 官网的说明——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 官网的说明——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 D Q

Am X X Q(Am)

Am ↑ D Q(Am-1)

m= 0, 1, 2, 3

这里提示了几个要点:

- 移位寄存器是可变长度的

- 长度的改变由地址线来指定

- 内部的寄存器长度是不变的,只是截取的长度变了

- 数据先移入到A0,然后到A1,以此类推,最后从指定长度的Am-1处输出,比如A=8,则数据从地址0输入,从地址7输出,这样有效的移位长度就为8。

Xilinx 官网的说明——VHDL例化实例

-- 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

复制代码

Xilinx 官网的说明——Verilog例化实例

-- 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

然后具体例子:

基于SRL16的分布式RAM不再支持V5、S6和V6等器件,但是SRL16是所有XIlinx器件都支持的,并且在设计中应用非常频繁,因此可通过调用原语的方法来调用SRL16E甚至SRL32E来实现原来ISE分布式RAM IP核的设计。下面给出一段示例代码

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

);

猜您喜欢

现代科技迅速发展的时代,配件的选择对设备的整体性能非常重要。今天,我们将重点介绍一种特殊的配件——Accessories_11X4.25MM_SM。这款配件以其...
2025-03-05 13:56:58

开口型扁圆头抽芯铆钉是常见的连接件,其设计和功能具有独特的特点。开口型铆钉的结构使其在安装过程中更加便捷,适合快速组装的场景。与传统铆钉相比,开口型设计能够有效...
2008-03-27 00:00:00

针式插头是应用于电子设备的连接器,了解其规格尺寸对选购和使用非常重要。常见的针式插头规格主要有两种:2.5mm和3.5mm。这两种尺寸的插头在直径和形状上有所不...
2011-08-30 00:00:00

现代电力电子技术中,续流二极管作为重要的元件,应用于各种电路中。主要作用是提供电流的续流,保护电路安全,提升系统的整体性能。本文将详细探讨续流二极管的作用及其在...
2025-04-07 00:00:34

PLC各型主机均内建2个通信接口的标准配置,即一个RS232和一个RS485通信接口,其RS232接口主要用于上下载程序或用来与上位机、触摸屏通信,而RS485...
2018-06-17 05:23:00

贴片排阻焊接是现代电子制造中重要的工艺技术,应用于各种电子产品的生产中。电子产品的日益小型化和高性能化,对焊接技术的要求也越来越高。本文将深入探讨贴片排阻焊接的...
2025-04-14 10:01:13

作者 XCZXilinx的针对Gigabit应用的FPGA基本都会集成一些高速串行接口,统称为Gigabit Transceiver(GTx),包括GTP、...
2018-06-29 08:47:00

现代电子设备中,连接器是非常重要的配件。其中,CONN_D2.54X4.57MM_TM连接器因其独特的设计和优越的性能,成为许多行业中应用的选择。本文将深入探讨...
2025-04-20 16:00:38

近日,Allegro公司正式推出了两款全新的电流传感器芯片——ACS37030MY与ACS37220MZ。这两款产品凭借其尖端的传感技术,为用户提供了卓越的性能...
2025-01-15 16:46:00

串行器和解串器在现代通信和数据传输中是非常重要的配件。应用领域非常,涵盖了多个行业。在通信领域,串行器和解串器用于将并行数据转换为串行数据,以提高数据传输的效率...
2013-08-13 00:00:00