我正在尝试将较小的std_logic_vector
分配给更大的library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity subarray_tb is
end subarray_tb;
architecture VERHALTEN of subarray_tb is
signal big : std_logic_vector(15 downto 0) := x"A5A5";
signal small : std_Logic_vector(7 downto 0) := x"F0";
begin
big <= small;
end VERHALTEN;
,如下所示:
big(big'LEFT downto (big'LEFT-small'LENGTH+1)) <= small;
正如预期的那样,我从Modelsim中得到以下错误:
**错误(可抑制):C:/altera/15.1/subarray_tb.vhd(19):( vcom-1272)预期长度为16;实际长度是8。
我知道如何解决这个问题,但我对结果不满意,因为它看起来很不可读:
ERROR - jmeter.JMeter: Uncaught exception: java.lang.AbstractMethodError
at org.apache.jmeter.gui.action.Clear.doAction(Clear.java:76)
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:81)
at org.apache.jmeter.gui.action.ActionRouter.access$000(ActionRouter.java:40)
at org.apache.jmeter.gui.action.ActionRouter$1.run(ActionRouter.java:63)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
我不想在括号中使用固定范围,因为我的实际问题有点复杂。较小的数组是不同std_logic_vectors的串联,因此我希望解决方案具有灵活性。
有没有更好的人类可读解决方案?
答案 0 :(得分:0)
您可以使用命名范围。您定义了subtype
:
subtype big_upper is integer range big'LEFT downto (big'LEFT-small'LENGTH+1);
然后使用它而不是范围:
big(big_upper) <= small;