Xilinx SRL16E如何实现16移位寄存器

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

     在做FPGA的开发过程中经常会使用到移位寄存器,一般我们使用移位寄存器的目的都是为了将某个信号进行打拍,使得时序符合我们的需求。最常见的打拍方法就是在process过程语句中对信号进行移位(在verilog中是在always过程中进行移位)。但是这里我给大家介绍一下SRL6E,这个是Xilinx提供的一个原语,顾名思义,这是一个可以最大实现16位移位寄存的移位寄存器。

Xilinx SRL16E如何实现16移位寄存器

      需要注意的是,SRL16E原语在不同的器件中表现形式可能稍有区别,下面是在Kintex-7系列器件中的SRL16E原语:

--使用原语时,需要加上这两句

Library UNISIM;  

use UNISIM.vcomponents.all;

   -- SRL16E: 16-bit shift register LUT with clock enable operating on posedge of clock (Mapped to SlICeM LUT6)

   --        Kintex-7

   -- Xilinx HDL Language Template, version 2017.4

--以下时=是SRL16E原语

   SRL16E_inst : SRL16E

   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

      CE => CE,     -- Clock enable input--寄存器使能端口

      CLK => CLK,   -- Clock input   --时钟端口

      D => D        -- SRL data input--寄存器输入端口

   );

   -- End of SRL16E_inst instantiation

这里主要对地址进行一下说明。地址A3A2A1A0表明要对输入数据进行多少移位。如果是A3A2A1A0=“0000”,说明是对D端口输入数据进行1位移位,也就是说对D端口输入的数据进行一个周期的延迟。如果是A3A2A1A0=“1111”,说明是对D端口输入数据进行16位移位。

下面举一个例子来说明:

这是源程序,因为A3A2A1A0=“0011”,所以主要是对输入数据进行4个周期的延迟。

----------------------------------------------------------------------------------

-- Company: 

-- Engineer: 

-- 

-- Create Date: 2018/12/10 1605

-- Design Name: 

-- Module Name: srl16e_test - Behavioral

-- Project Name: 

-- Target Devices: 

-- Tool Versions: 

-- Description: 

-- 

-- Dependencies: 

-- 

-- Revision:

-- Revision 0.01 - File Created

-- Additional Comments:

-- 

----------------------------------------------------------------------------------

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

Library UNISIM;

use UNISIM.vcomponents.all;

-- Uncomment the following library declaration if using

-- arithmetic functions with Signed or Unsigned values

--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating

-- any Xilinx leaf cells in this code.

--library UNISIM;

--use UNISIM.VComponents.all;

entity srl16e_test is

  Port (

        clk     : in    std_logic;

        data_in : in    std_logic;

        data_out: out   std_logic

         );

end srl16e_test;

architecture Behavioral of srl16e_test is

signal  q  : std_logic:='0';

signal  d  : std_logic:='0';

begin

   SRL16E_inst : SRL16E

generic map (

   INIT => X"0000")

port map (

   Q => q,       -- SRL data output

   A0 => '1',     -- Select[0] input

   A1 => '1',     -- Select[1] input

   A2 => '0',     -- Select[2] input

   A3 => '0',     -- Select[3] input

   CE => '1',     -- Clock enable input

   CLK => clk,   -- Clock input

   D => d        -- SRL data input

);

d <= data_in;

data_out <= q;

end Behavioral;

这是仿真文件:

仿真文件中的输入数据是一个周期的单脉冲。

----------------------------------------------------------------------------------

-- Company: 

-- Engineer: 

-- 

-- Create Date: 2018/12/10 1615

-- Design Name: 

-- Module Name: tb_srl16e - Behavioral

-- Project Name: 

-- Target Devices: 

-- Tool Versions: 

-- Description: 

-- 

-- Dependencies: 

-- 

-- Revision:

-- Revision 0.01 - File Created

-- Additional Comments:

-- 

----------------------------------------------------------------------------------

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.NUMERIC_STD.ALL;

use IEEE.STD_LOGIC_ARITH.All;

use IEEE.STD_LOGIC_UNSIGNED.All;

-- Uncomment the following library declaration if using

-- arithmetic functions with Signed or Unsigned values

--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating

-- any Xilinx leaf cells in this code.

library UNISIM;

use UNISIM.VComponents.all;

entity tb_srl16e is

end tb_srl16e;

architecture Behavioral of tb_srl16e is

component srl16e_test 

port(

    clk : in std_logic;

    data_in : in std_logic;

    data_out : out  std_logic

    );

 end component;

 signal clk ='1';

 signal in_data : std_logic:='0';

 signal out_data: std_logic:='0';

begin

uut: srl16e_test

port map(

    clk => clk,

    data_in => in_data,

    data_out => out_data

    );

 process

 begin

    wait for 10 ns;

    clk <=  '0';

    wait for 10 ns;

    clk <=  '1';

 end process;

process

begin

in_data <= '0';

wait for 20 ns;

in_data <= '1';

wait for 20 ns;

in_data <= '0';

wait;

end process;

end Behavioral;

仿真波形:

输入数据是data_in,输出是data_out,可以看到对输入数据进行了4个周期的延迟。

      审核编辑:彭静
猜您喜欢

现代电子产品中,AC/DC开关电源是重要的重要模块。能够高效地将交流电源转换为直流电源,满足各种设备的需求。为了帮助广大用户更好地理解AC/DC开关电源芯片的组...
2024-10-01 00:00:00

现代电子技术快速发展的背景下,封装技术的创新与应用显得尤为重要。WQFN24_4X4MM_EP(四方扁平无引脚封装)作为新型的封装形式,因其小型化、高性能和良好...
2025-04-23 15:30:05

称量纸是实验室和工业中常用的工具,主要用于称取固体样品。不同类型的称量纸在材质、厚度、抗油性和防潮性等方面存在显著区别。普通称量纸一般由高质量的纸浆制成,适合一...
2009-09-24 00:00:00

贴片电阻上的6802标识代表其阻值为6.8千欧姆。 这是一种简化的表示方法,遵循前两位数字+后一位数字代表10的几次方的规则。 具体来说,68代表有效数字68,...
2024-11-29 10:26:26

铁丝是应用于各个领域的重要材料,因其优良的物理特性而受到青睐。铁丝通常由高品质的低碳钢制成,具有良好的韧性和抗拉强度,能够承受较大的压力和拉力。在建筑、农业、手...
2019-07-04 00:00:00

秒表作为计时工具,具有多个关键参数,帮助用户准确记录时间。最基本的参数是“计时精度”,通常以毫秒为单位,精确度越高,记录时间越准确。其次是“计时范围”,秒表能够...
2009-08-01 00:00:00

FPGA时序不收敛,会出现很多随机性问题,上板测试大概率各种跑飞,而且不好调试定位原因,所以在上板测试前,先优化时序,再上板。今天我们就来唠一唠解决时序不收敛的...
2023-06-26 15:41:00

隔离开关是重要的电气设备,其主要作用是切断电路中的电流,以确保设备的安全维护和检修。通常用于高压和低压配电系统中,能够有效地隔离电源,从而防止意外触电和设备损坏...
2021-02-17 00:00:00

全球化的数字工业高科技企业霍尼韦尔(纳斯达克代码:HON)近日亮相2023上海国际传感器技术与应用展,集中展示公司在储能、新能源汽车、医疗与健康、工业安全、非公...
2023-09-19 09:54:00

引言多节点系统,在目前的很多电子系统应用场合都可以看到。这种多节点系统由于具有结构可扩展性、功能配置的灵活性以及便于查找故障节点等良好的可维护性得到了越来越广...
2020-01-01 16:53:00