Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VHDL组件可以独立工作;在上层实体中连接它们时出现问题 背景_Vhdl_Fpga_Xilinx - Fatal编程技术网

VHDL组件可以独立工作;在上层实体中连接它们时出现问题 背景

VHDL组件可以独立工作;在上层实体中连接它们时出现问题 背景,vhdl,fpga,xilinx,Vhdl,Fpga,Xilinx,目标是使用Xilinx的结构建模设计看门狗定时器(WDT)。WDT收到一个启动触发器,该触发器启动计数器,对59个时钟周期进行计数,产生一个时钟间隔脉冲信号重置条件,并重置为0。因此,我在photoshop中制作了下面的图表来说明组件以及它们应该如何连接。WDT是上层实体 CLKN是在SR ff和WDT(以及计数器和计数器中的T-ffs)之间共享的负边缘时钟 计数器是由T-FF制成的6位二进制计数器 六个T-ff级联,其中第一个ff时钟线的输入为系统时钟,其余FFs的时钟输入为前一个T-f

目标是使用Xilinx的结构建模设计看门狗定时器(WDT)。WDT收到一个启动触发器,该触发器启动计数器,对59个时钟周期进行计数,产生一个时钟间隔脉冲信号重置条件,并重置为0。因此,我在photoshop中制作了下面的图表来说明组件以及它们应该如何连接。WDT是上层实体

  • CLKN是在SR ff和WDT(以及计数器和计数器中的T-ffs)之间共享的负边缘时钟
  • 计数器是由T-FF制成的6位二进制计数器
    • 六个T-ff级联,其中第一个ff时钟线的输入为系统时钟,其余FFs的时钟输入为前一个T-ff的Q,因此FFs在每2i处切换,其中i=0、1、2、3、4、5,因此它创建一个二进制计数器
  • 6扇入与门是一个定制与门,只有当序列111010为输入时,输出才为1(111010=58;0->58=59个时钟周期)
    • 当输出=1时,复位SR ff,复位计数器和WDT
  • 2扇入与门确保计数器仅在Q=1且CLKN被断言时运行
    • 当断言启动触发器时,当S=1时,Q=1。触发器将保持高电平,直到WDT复位
  • 外部较厚的框表示WDT
    • 启动地图以启动
    • CLKN映射到CLKN
    • 重置\u信号映射以发送\u重置
我试过的
  • 我已经分别测试了每个组件,它们也相应地工作(最后列出了它们的代码)
  • 已尝试将std_逻辑切换为位,以避免0和1以外的值——不起作用;切换回std_逻辑
  • 初始化每个端口和信号以避免未初始化的值问题——在某些组合中工作了一些时间,但我永远无法复制它
  • 我已经调试了ISim波形屏幕中的组件和信号

  • 忽略前100 ns
  • SR ff不产生q或qnot输出,即使其显示1和0的恒定值;请注意,这两个输出以及R没有波形
  • 此问题传播到2扇入与门,即使输入不是11,也会产生1的恒定输出;它不从SR ff读取Q输出;由于输出为常数1,因此没有转换,因此没有时钟进入计数器
  • 这个问题似乎是由于portmapping造成的,但我真的不知道我做错了什么。我的意思是,这一定是因为我尝试了所有其他方法(就代码而言),并将其与端口映射隔离
  • 没有语法错误 我真的不知道该怎么办了。我已经坚持了7个小时了,我真的快发疯了(睡眠不足也无济于事)
守则(主要章节) 高级消防队员 WDT 我感谢任何帮助/想法/建议。我不想从头开始,因为我已经在这方面投入了很多时间,但如果必须的话,我会的。
提前谢谢你

发布测试台代码。添加计数器输出。此外,也测试R,以便您可以在sim卡中看到Q和notQ处于活动状态。另外,您使用的是哪种sim卡?看起来它无法正确绘制没有转换的信号。基本上,开始调试看起来不错。看起来像是大学作业,因为头脑正常的人不会用这种方式创建6位计数器。相反,我们将使用一个类型为整数或无符号的寄存器,并将计数从59降到0,然后在0之后使用59重新加载。HDL提供的抽象的全部目的是简化这样的事情。当然,还有其他的方式来谈论结构规范,而不是通过这种方式。祝你好运然而,就像任何工程项目一样——你的工作就是解决问题——不幸的是,作为一名学生,遵循给出的指导。发布你的测试台代码。添加计数器输出。此外,也测试R,以便您可以在sim卡中看到Q和notQ处于活动状态。另外,您使用的是哪种sim卡?看起来它无法正确绘制没有转换的信号。基本上,开始调试看起来不错。看起来像是大学作业,因为头脑正常的人不会用这种方式创建6位计数器。相反,我们将使用一个类型为整数或无符号的寄存器,并将计数从59降到0,然后在0之后使用59重新加载。HDL提供的抽象的全部目的是简化这样的事情。当然,还有其他的方式来谈论结构规范,而不是通过这种方式。祝你好运然而,就像任何工程项目一样——你的工作就是解决问题——不幸的是,作为一名学生,你必须遵循给出的指导。
entity SR_FF is
    Port ( S : in  std_logic;
           R : in  std_logic;
              CLKN : in std_logic;
              QNOT : out std_logic := '1';
           Q : out  std_logic := '0');
end SR_FF;

architecture Behavioral of SR_FF is

begin

    process(CLKN)

    variable imm: std_logic := '0';
    begin

        if (falling_edge(CLKN)) then
            if (S = '0' AND R = '0') then
                imm := imm; --no change
            elsif (S = '0' AND R = '1') then
                imm := '0';
            elsif (S = '1' AND R = '0') then
                imm := '1';
            else
                NULL;
            end if;
        end if;

        Q <= imm;
        QNOT <= not imm;

    end process;
entity T_FF is
    Port ( T : in  STD_LOGIC;
           CLKN : in  STD_LOGIC;
              Reset : in STD_LOGIC;
           Q : out  STD_LOGIC := '0';
           Qnot : out  STD_LOGIC := '1');
end T_FF;

architecture Behavioral of T_FF is

begin

    process(CLKN, Reset)

    variable imm: std_logic := '0';

    begin
    if (Reset = '0') then
        if (falling_edge(CLKN)) then
            if (T = '0') then
                imm := imm; --no change
            elsif (T = '1') then
                imm := not imm; --toggle
            else
                NULL;
            end if;
        end if;
    else
        imm := '0';
    end if;

    Q <= imm;
    Qnot <= not imm;

    end process;
end Behavioral;
entity six_bit_counter is
    Port ( CLKN : in  STD_LOGIC;
              RESET : in STD_LOGIC;
           COUNT : out  STD_LOGIC_VECTOR (5 downto 0) := "000000");
end six_bit_counter;

architecture Structural of six_bit_counter is

component T_FF
    Port ( T : in  STD_LOGIC;
           CLKN : in  STD_LOGIC;
              Reset : in STD_LOGIC;
           Q : out  STD_LOGIC;
           Qnot : out  STD_LOGIC);
end component;

component OR_two
    Port ( A : in  STD_LOGIC;
           B : in  STD_LOGIC;
           C : out  STD_LOGIC);
end component;

signal clk_trigger : std_logic_vector (4 downto 0) := "00000";
signal temp_count : std_logic_vector (5 downto 0) := "000000";

begin

T0: T_FF port map (T => '1', Reset => RESET, CLKN => CLKN, Q => temp_count(0), Qnot => open);
T1: T_FF port map (T => '1', Reset => RESET, CLKN => clk_trigger(0), Q => temp_count(1), Qnot => open);
T2: T_FF port map (T => '1', Reset => RESET, CLKN => clk_trigger(1), Q => temp_count(2), Qnot => open);
T3: T_FF port map (T => '1', Reset => RESET, CLKN => clk_trigger(2), Q => temp_count(3), Qnot => open);
T4: T_FF port map (T => '1', Reset => RESET, CLKN => clk_trigger(3), Q => temp_count(4), Qnot => open);
T5: T_FF port map (T => '1', Reset => RESET, CLKN => clk_trigger(4), Q => temp_count(5), Qnot => open);

//used to duplicate signals; same signal is applied to the clock_input of the flip flops as well as the counter output value
O0: OR_two port map (A => '0', B =>  temp_count(0), C => clk_trigger(0));
O1: OR_two port map (A => '0', B =>  temp_count(1), C => clk_trigger(1));
O2: OR_two port map (A => '0', B =>  temp_count(2), C => clk_trigger(2));
O3: OR_two port map (A => '0', B =>  temp_count(3), C => clk_trigger(3));
O4: OR_two port map (A => '0', B =>  temp_count(4), C => clk_trigger(4));

//signal mapped to counter output
O5: OR_two port map (A => '0', B =>  temp_count(0), C => COUNT(0));
O6: OR_two port map (A => '0', B =>  temp_count(1), C => COUNT(1));
O7: OR_two port map (A => '0', B =>  temp_count(2), C => COUNT(2));
O8: OR_two port map (A => '0', B =>  temp_count(3), C => COUNT(3));
O9: OR_two port map (A => '0', B =>  temp_count(4), C => COUNT(4));
OA: OR_two port map (A => '0', B =>  temp_count(5), C => COUNT(5));


end Structural;
entity WDT is
    Port ( CLKN : in STD_LOGIC;
              Start : in STD_LOGIC;
           Reset_Signal : out  STD_LOGIC);
end WDT;

architecture Structural of WDT is

component SR_FF is
    Port ( S : in  std_logic;
           R : in  std_logic;
              CLKN : in std_logic;
              QNOT : out std_logic;
           Q : out  std_logic);
end component;


component six_bit_counter
    Port ( CLKN : in  STD_LOGIC;
              RESET : in STD_LOGIC;
           COUNT : out  STD_LOGIC_VECTOR (5 downto 0));
end component;

component AND_six
    Port ( A_IN : in  STD_LOGIC_VECTOR (5 downto 0);
           A_OUT : out  STD_LOGIC);
end component;

component AND_two
    Port ( A_IN : in  STD_LOGIC_VECTOR (1 downto 0);
           A_OUT : out  STD_LOGIC);
end component;

component OR_two
    Port ( A : in  STD_LOGIC;
           B : in  STD_LOGIC;
           C : out  STD_LOGIC);
end component;

signal temp_count : std_logic_vector (5 downto 0) := "000000";
signal send_reset : std_logic := '0'; --coming out of and_six
signal q_temp : std_logic := '0';
signal clk_counter : std_logic := '0';
signal q_not_temp : std_logic := '0';

begin
--58 = 111010

SRFF1: SR_FF port map (S => Start, R =>send_reset, CLKN => CLKN, Q => q_temp, QNOT => q_not_temp);
A1: AND_two port map (A_IN(0) => CLKN, A_IN(1) => q_temp, A_OUT => clk_counter);
C1: six_bit_counter port map (CLKN => clk_counter, Reset => send_reset, COUNT => temp_count);
A2: AND_six port map (A_IN => temp_count, A_OUT => send_reset);
//used to duplicate Reset signal which is mapped to the interal reset signal to reset the counter and SR ff as well as mapped to the WDT output to demonstrate the counter reached its threshold
OR1: OR_two port map (A => '0', B => send_reset, C => Reset_Signal);

end Structural;