触发任意宽度



好吧,我正在尝试用VHDL语言制作一个模块,到目前为止,我的内部时钟(100MHz(和调用的控制信号(std_logic(,我需要输出任意宽度的信号(std_logic(,说宽我想控制计算时钟rising_edge,我没有一个良好的编程基础,这就是为什么我坚持下去,如果有人可以帮助我,我谢谢你,我包含一个说明性的图像,说明我希望如何获得输出,其中delta/是一个任意的间隔,不取决于输入的任意间隔,当在较低的情况下,out信号必须保持在访问柜台的目的之前。

https://i.stack.imgur.com/shkzp.jpg

因此,您基本上可以创建一个关闭延迟?

注意: VHDL 2008 MIGTH应用(我通常的语言(

entity off_delay is 
   generic(
      n : natural : 2 -- off delay
   );
   port(
      clk : in  std_logic;
      a   : in  std_logic;
      b   : out std_logic
   );
end entity;

clk _/¯ __/ _ _ _/ _/ _ _ _ _/ _ _ _ _ _//// _/
_____/' ________________________________________
b _________/'' ___________________

architecture synkron of off_delay is 
   signal delay: std_logic_vector(n downto 0); -- 1+n cycles out signal
begin 
   b <= delay(0);
   process(clk)
   begin
      if rising_edge(clk) then
         delay <= (others => '1') when a else ('0' & delay(delay'left downto 1));
      end if;
   end process;   
end architecture;

clk _/¯ __/ _ _ _/ _/ _ _ _ _/ _ _ _ _ _////
_____/' ________________________________________________________________________________________________________________b _____/é ' ______________________________

architecture asynkron of off_delay is 
   signal delay: std_logic_vector(n-1 downto 0); -- n cycles off delay
begin 
   b <= delay(0) or a;
   process(clk)
   begin
      if rising_edge(clk) then
         delay <= (others => '1') when a else ('0' & delay(delay'left downto 1));
      end if;
   end process;
end architecture;

注意: Asynkron解决方案将取决于稳定的a,因为它容易受到故障的影响。

注意: Asynkron解决方案将引入一个延迟,可能很难调试

注意:这些是最简单的灵魂。为了获得技术,可以在Asynkron Fassion中实现a设置SR闩锁,并通过Synkron延迟行重置。 obs latches 强烈 adved> fpga design!

这是另一个解决方案,它使用宽度较低但宽度较小,宽度较小,宽度为输入而不是通用:

的宽度更少,但较小的解决方案:
entity top is
port
(
    i_rst   : in std_logic;
    i_clk   : in std_logic;
    i_din   : in std_logic;
    i_width : in std_logic_vector(7 downto 0);
    o_dout  : out std_logic
);
end top;
architecture Behavioral of top is
    signal counter  : unsigned(7 downto 0);
    signal oe       : std_logic;
begin
    process(i_clk)
    begin
        if i_rst = '1' then
            counter <= (others => '0');
            oe      <= '0';
        elsif rising_edge(i_clk) then
            if oe = '1' then
                counter <= counter + 1; 
                if counter = unsigned(i_width) - 1 then
                    counter <= (others => '0'); 
                    oe      <= '0';
                end if;
            elsif i_din = '1' then
                if unsigned(i_width) > x"01" then
                    counter <= counter + 1;            
                    oe      <= '1';
                end if;
            end if;
        end if; 
    end process;
    o_dout  <= oe or i_din;

end Behavioral;

但是,正如半距告诉您的,在输出之前使用组合使模块对故障非常敏感。

最新更新