首页 > 技术 > 内容

Xilinx FPGA中SRL原理

时间:2025-12-01  作者:Diven  阅读:0

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

);

猜您喜欢


贴片电阻,电子电路中不可或缺的小元件,其阻值大小对电路性能有着至关重要的影响。从几欧姆到几兆欧姆,不同阻值的贴片电阻应用于不同的场景,选择合适的阻值才能确保电路...
2024-11-26 11:29:59
便签贴作为实用的办公和生活工具,具有多个显著的优势。便携性极强,轻便小巧,随时随地都能记录下突发的灵感或重要事项。便签贴的多样化颜色和形状使其在视觉上更加吸引人...
2014-10-22 00:00:00
触发二极管是专门用于控制电流的半导体器件,应用于各种电力电子设备和电路中。与传统二极管不同,触发二极管能够在特定条件下被触发导通,因此在电路控制中起到了重要作用...
2025-04-01 20:00:34
排容是指在不同环境和条件下,物体或系统如何排放或容纳物质的能力。根据不同的标准,排容可以分为以下几类:按物质状态分类,排容可分为气体排容、液体排容和固体排容。气...
2019-07-31 00:00:00
贴片电阻,作为电子电路中不可或缺的元件,其型号规格表是工程师和电子爱好者必备的工具。通过查阅规格表,可以快速找到符合电路设计需求的电阻。规格表通常包含阻值、封装...
2025-04-14 15:02:09
现代电子设备中,碳化硅(SiC)二极管因其优越的性能和高温耐受性而受到的关注。相较于传统的硅二极管,碳化硅二极管在高压、高温和高频应用中展现出更佳的效率。了解如...
2025-03-31 18:00:02
风华贴片电阻的日期和型号大小都印在电阻本体表面。由于贴片电阻体积小,这些信息通常采用简化的编码方式,需要一定的解读技巧。日期:风华通常采用三位或四位编码表示生产...
2024-11-29 10:26:10
贴片电阻,电子电路中不可或缺的元件,其微小的体积却蕴藏着巨大的作用。它就像电路中的「交通警察」,控制着电流的流动。贴片电阻的工作原理基于欧姆定律:电流与电压成正...
2024-11-26 11:30:01
电流采样电阻在电路设计中是越来越重要的配件。作为电子元器件行业的知名品牌,华润电阻凭借其高品质的产品和很好的技术赢得了广大用户的信赖。本文将围绕“华润电阻电流采...
2023-10-22 01:03:52
精密电阻作为电子元器件中的关键部件,是非常重要的配件。宇阳(EYANG)作为国内知名的精密电阻品牌,很好的性能和的应用领域赢得了市场的高度认可。本文将详细介绍宇...
2024-09-07 06:30:13