首页 > 解决方案 > 在 Simulink/System Generator 中为黑匣子配置时钟信号

问题描述

我使用代码 VHDL 通过 System Generator 的“黑匣子”在 Simulink 中制作一次性计时器。该模块得出的输入是:clk、en、触发器、延迟和输出是:pluse。现在我想使用 System Generator 在 Zynq 7020 上实现并使用时钟频率 = 1.562Mhz。我读了“ug897-vivado-system generator-user”,但我仍然不知道如何配置 clk。

Matlab/Simulink 中的图表

在此处输入图像描述

一次性定时器/黑盒的 VHDL 代码

 library IEEE;
 use IEEE.STD_LOGIC_1164.ALL;
 use IEEE.NUMERIC_STD.ALL;
 library UNISIM;
 use UNISIM.VComponents.all;

 entity oneshot is
     port ( clk : in STD_LOGIC;
        ce : in STD_LOGIC;
        trigger : in STD_LOGIC:='0';
        delay : in STD_LOGIC_VECTOR (7 downto 0);
        pulse : out STD_LOGIC :='0');
 end oneshot;

 architecture Behavioral of oneshot is
     signal count: INTEGER range 0 to 255; -- count variable
     signal bus_rising_edge : boolean;
     signal input_sync : std_logic_vector(0 to 2);
 begin
      input_syncronizer : process(clk) begin
          if rising_edge(clk) then 
             input_sync <= to_x01(trigger)&input_sync(0 to 1);
          end if; 
      end process ;

bus_rising_edge <= input_sync(0 to 1) = "10";


trigger_process: process (clk)
begin
-- wait for trigger leading edge
if rising_edge(clk) then 
   if bus_rising_edge then
        pulse <= '1';   
        count <= to_integer(unsigned(delay));
   elsif count > 1 then  
        pulse <= '1';
        count <= count - 1;
    else
        pulse <= '0';
    end if;
end if;
end process;
end Behavioral;

Matlab 代码在导入 VHDL 代码时自动创建 https://drive.google.com/open?id=1jfztL-NgftDc7VAgAX4eHfuJF8uOgK3V

(对不起,我无法正确发布我的代码)

标签: simulinkfpgazynqsystem-generator

解决方案


您可以双击系统生成器标记并选择时钟选项卡并更改时钟周期。该时钟用于模拟。实际上,您的操作时钟是您板上的时钟。


推荐阅读