我遇到一些移位器模块的问题,它会移位由字节组成的数组的索引。VHDL - 移位字节数组
shifter.vhd:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use work.mypackage2.all; -- contains the type reg array
entity shifter is
generic (REGSIZE : integer := 8);
port(clk : in std_logic;
Scan_Dav : in std_logic;
Data_in : in std_logic_vector(7 downto 0);
Data_out : out reg_array);
end shifter;
architecture bhv of shifter is
signal shift_reg : reg_array;
begin
process (clk) begin
if rising_edge(clk) then
if Scan_Dav = '1' then
shift_reg <= shift_reg(shift_reg'high-1 downto 0) & Data_in;
end if;
end if;
end process;
Data_out <= shift_reg;
end bhv;
这是一个移位器,将持有从键盘和所述输出阵列的扫描码将被用于滚动七段显示器上的文本。我的包包含用于定义转换器的输出类型声明:
mypackage2.vhd:
-- Package File Template
--
-- Purpose: This package defines supplemental types, subtypes,
-- constants, and functions
library IEEE;
use IEEE.STD_LOGIC_1164.all;
package mypackage2 is
subtype reg is std_logic_vector(7 downto 0); -- a byte
type reg_array is array (7 downto 0) of reg; -- array of bytes
end mypackage2;
package body mypackage2 is
end mypackage2;
我与它有问题,虽然。这段代码的RTL原理似乎是因为:
我很困惑,为什么出现这种情况,任何人都可以帮助我解决这个问题?
你用什么工具生成和查看RTL原理图?根据我的经验,查看RTL原理图很少有用,而且 - 也许是因为它们很少被使用 - 它们往往是越野车。我会更加关注你的VHDL代码在模拟中做了什么。写一个测试台并模拟它... –
除了丢失的时钟外,看起来完全没问题,这可能是您原理图工具的一个特性。 VHDL代码看起来也很好。你对什么感到困惑? – BennyBarns
问题恰恰在于BennyBarns,原理图与代码不一致。应该有3个输入和1个输出,它们的名称应与我在代码中分配的名称相同,并且logic_vectors的宽度应该在原理图中可见。我正在使用Xilinx ISE @Brian。例如,当我将此设备放置在顶层模块中时,它的行为不正确:(http://i.imgur.com/QoOPQ.jpg?1) 了解其他组件是如何正确绘制的。 – John