VHDL的神秘位不匹配

发布于 2025-01-21 11:46:12 字数 779 浏览 0 评论 0原文

我正在使用端口和通用映射进行32位寄存器。由于某种原因,它说目标信号QT具有31位,而输入有32位。现在没有任何意义。我仔细研究了所有内容,但找不到QT在32位以外的其他任何东西,因为我将信号称为信号QT:STD_LOGIC_VECTOR(31降至0);> 任何帮助都非常感谢。

我隔离了错误行qt< = d;,但它仍然抛出一个例外。下面是我的最低重现的例子。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.math_real.log2;
use ieee.math_real.ceil;


entity my_rege is
   generic (N: INTEGER:= 32);
    port ( clock, resetn: in std_logic;
           E, sclr: in std_logic; -- sclr: Synchronous clear
             D: in std_logic_vector (N-1 downto 0);
           Q: out std_logic_vector (N-1 downto 0));
end my_rege;

architecture Behavioral of my_rege is

    signal Qt: std_logic_vector (31 downto 0);
    
begin
                    Qt <= D;


    Q <= Qt;
end Behavioral;

I am making a 32 bit register with port and generic mapping. For some reason it says that the target signal Qt has 31 bits, while the input has 32 bits. Makes no sense right now. I looked through everything, and could not find how the Qt could be anything else than 32 bits since I declared the signal as signal Qt: std_logic_vector(31 downto 0);Any help is appreciated thanks.

I isolated the error line Qt <= D; and it still threw an exception. Down below is my minimally reproducible example.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.math_real.log2;
use ieee.math_real.ceil;


entity my_rege is
   generic (N: INTEGER:= 32);
    port ( clock, resetn: in std_logic;
           E, sclr: in std_logic; -- sclr: Synchronous clear
             D: in std_logic_vector (N-1 downto 0);
           Q: out std_logic_vector (N-1 downto 0));
end my_rege;

architecture Behavioral of my_rege is

    signal Qt: std_logic_vector (31 downto 0);
    
begin
                    Qt <= D;


    Q <= Qt;
end Behavioral;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不打扰别人 2025-01-28 11:46:12

没有意识到我在顶部文件中有n:integer:= 31。当我将定义更改为n:integer:= 32错误消失了。在我的角度上编码草率。我不知道为什么TCL在寄存器文件中引用了这一点,而不是顶部(LAPFN)文件。这是因为VHDL在端口映射之后写下了上层,并且它假设顶部的组件是真正的位大小吗?

entity LAPfn is
  Port (resetn, clock, sclr, lap_db: in std_logic;
        lap_select: in std_logic_vector (2 downto 0); 
        Data_in:    in std_logic_vector (31 downto 0);
        Lap_bits:   out std_logic_vector (31 downto 0);
        zlap:       out std_logic;
        cout: out std_logic_vector(2 downto 0));
        
end LAPfn;

architecture Behavioral of LAPfn is

component my_rege
   generic (N: INTEGER:= 31);
    port ( clock, resetn: in std_logic;
           E, sclr: in std_logic; -- sclr: Synchronous clear
           D: in std_logic_vector (N-1 downto 0);
           Q: out std_logic_vector (N-1 downto 0));
end component;

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.math_real.log2;
use ieee.math_real.ceil;

entity my_rege is
generic (N: INTEGER:= 32);
    port ( clock, resetn: in std_logic;
           E, sclr: in std_logic; -- sclr: Synchronous clear
             D: in std_logic_vector (N-1 downto 0);
           Q: out std_logic_vector (N-1 downto 0));
end my_rege;

architecture Behavioral of my_rege is

    signal Qt: std_logic_vector (31 downto 0);
    
begin

                    Qt <= D;

    Q <= Qt;
end Behavioral;
    

Did not realize that I had N: INTEGER:= 31 in the top file. When I changed the definition to N: INTEGER:= 32 the error disappeared. Sloppy coding on my part. I don't know why the tcl referenced this in the register file and not the top(lapfn) file. Is this because VHDL is written top down after port mapping, and it assumed the component from the top was the true bit-size?

entity LAPfn is
  Port (resetn, clock, sclr, lap_db: in std_logic;
        lap_select: in std_logic_vector (2 downto 0); 
        Data_in:    in std_logic_vector (31 downto 0);
        Lap_bits:   out std_logic_vector (31 downto 0);
        zlap:       out std_logic;
        cout: out std_logic_vector(2 downto 0));
        
end LAPfn;

architecture Behavioral of LAPfn is

component my_rege
   generic (N: INTEGER:= 31);
    port ( clock, resetn: in std_logic;
           E, sclr: in std_logic; -- sclr: Synchronous clear
           D: in std_logic_vector (N-1 downto 0);
           Q: out std_logic_vector (N-1 downto 0));
end component;

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.math_real.log2;
use ieee.math_real.ceil;

entity my_rege is
generic (N: INTEGER:= 32);
    port ( clock, resetn: in std_logic;
           E, sclr: in std_logic; -- sclr: Synchronous clear
             D: in std_logic_vector (N-1 downto 0);
           Q: out std_logic_vector (N-1 downto 0));
end my_rege;

architecture Behavioral of my_rege is

    signal Qt: std_logic_vector (31 downto 0);
    
begin

                    Qt <= D;

    Q <= Qt;
end Behavioral;
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文