【问题标题】:VHDL input forced to groundVHDL 输入强制接地
【发布时间】:2023-04-11 10:57:02
【问题描述】:

我是 VHDL 新手。我试图为加法减法器编写代码。我的一个电路输入总线在综合后接地。我在 Ubuntu 14.04 LTS 64 位中使用 Xilinx ISE 14.2。

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.NUMERIC_STD.ALL;

    entity examples is
    Generic(n: Natural :=8);
    port (
          A : in std_logic_vector(n-1 downto 0);
          B : in std_logic_vector(n-1 downto 0);
         subtract : in std_logic;
         sum: out std_logic_vector(n-1 downto 0);
         carry : out std_logic
    );
   end examples;

   architecture Behavioral of examples is
       Signal result: std_logic_vector(n downto 0);
   begin

       my_adder_subtractor : process(A,B,subtract)
           begin
           if(subtract = '0') Then
               result <= std_logic_vector(('0' & unsigned(A))+('0' & unsigned(B)));

           else
               result <= std_logic_vector(('0' & unsigned(A))-('0' & unsigned(B)));
           end if;
           sum <= result(n-1 downto 0);
           carry <= result(n);
       end process my_adder_subtractor;

   end Behavioral;

RTL 示意图:

【问题讨论】:

  • 你的问题是什么。
  • 我的问题是为什么端口A接地?

标签: vhdl xilinx xilinx-ise


【解决方案1】:

这个怎么样。让我知道这是否有效。我的 VHDL 可以追溯到很久以前。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;

entity examples is
Generic(n: Natural :=8);
port (
     A : in std_logic_vector(n-1 downto 0);
     B : in std_logic_vector(n-1 downto 0);
     subtract, clk : in std_logic;
     sum: out std_logic_vector(n-1 downto 0);
     carry : out std_logic_vector(0 downto 0)
);
end examples;

   architecture Behavioral of examples is
   begin
      process(clk)
           begin
           if(subtract = '0') then
               (carry, sum) <= ('0' & A)+('0' & B);
           else
               (carry, sum) <= ('0' & A)-('0' & B);
           end if;
      end process;
   end Behavioral;

【讨论】:

  • 我的问题是为什么端口 A 接地?还尝试添加 2 个信号..相同的结果。可能是我错过了一些东西。信号的数据类型应该是什么?我尝试使用标准逻辑向量
  • 好吧,你的实现似乎有点不对劲。 (A, B, substract) 上不应该有进程,因为进程推断出一个内存元素 (D-Latch)。对我来说,它会在您还进行操作的 3 个不同输入的触发器上改变状态,这似乎很奇怪。另外,我不明白为什么将输入定义为 std_logic_vectors 时将它们转换为无符号然后再转换为 std_logic 向量。只需在开始时将它们定义为无符号即可。 Unisgned 是可合成的,无需施放。
  • 顺便说一句,您实际上并不需要对时钟信号进行处理。我只是把它放在那里,因为你似乎想要一个记忆元素,但我在 A、B 和减法上切换状态时遇到了麻烦(使记忆元素几乎无用 [你可以在不改变任何行为的情况下删除该过程])。
  • 试过你的代码。出现以下错误 ERROR:HDLParsers:3285 - "/home/rezwan/xilinx_projects/free_range_vhdl/examples.vhd" 第 21 行。找不到具有与聚合匹配的类型元素的数组或记录类型。错误:HDLParsers:3285 - "/home/rezwan/xilinx_projects/free_range_vhdl/examples.vhd" 第 23 行。找不到具有与聚合匹配的元素类型的数组或记录类型。
【解决方案2】:

A 未接地。 Xilinx ISE中的RTL原理图不好...

您的加法器输入的一个输入位为零。所以A 与一个接地位连接。请打开 RTL 技术原理图查看“真实”电路。

【讨论】:

  • 我也没有从模拟中得到正确的结果。例如 A 00110000 和 B = 00100001 给我 Sum = 00000000
  • 你能发布 RTL 技术吗?示意图?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-06-22
  • 1970-01-01
  • 2021-06-01
  • 2011-07-23
  • 2011-09-14
  • 1970-01-01
  • 2017-12-09
相关资源
最近更新 更多