VHDL的神秘位不匹配
我正在使用端口和通用映射进行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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有意识到我在顶部文件中有
n:integer:= 31
。当我将定义更改为n:integer:= 32
错误消失了。在我的角度上编码草率。我不知道为什么TCL在寄存器文件中引用了这一点,而不是顶部(LAPFN)文件。这是因为VHDL在端口映射之后写下了上层,并且它假设顶部的组件是真正的位大小吗?Did not realize that I had
N: INTEGER:= 31
in the top file. When I changed the definition toN: 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?