-1
[我的波形] [1] 移位器是一个能够实现算术和逻辑移位操作的组件。 对于此实现,您不允许使用移位运算符。 AL输入决定您是否进行算术或逻辑移位操作。 迪尔也决定你的转变方向。改变输入值也决定了你期望的班次数。 您可以假设每个位移都需要10 ns的移位分量。例如,如果选择移位= 5而不管移位方向或类型(算术或逻辑)如何,则此组件的延迟为50 ns。计算32位移位VHDL延迟
如何找出延迟?每个位都有10 ns的延迟,我应该怎么做10 *移位延迟?
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_unsigned.all;
ENTITY shifter IS
GENERIC (BW : INTEGER :=32);
PORT (i : IN STD_LOGIC_VECTOR (BW -1 DOWNTO 0);
dir : IN BIT; -- dir ='0' means shift right and dir ='1' means shift left
AL: IN BIT ; -- Arithmetic or logical shift asume AL='1' means arithmetic an AL ='0' means logical
shifting : IN INTEGER range 0 to BW -1;
o: OUT STD_LOGIC_VECTOR (BW -1 DOWNTO 0));
END ;
ARCHITECTURE shifter_arch OF shifter IS
BEGIN
process(dir,i,AL,shifting)
variable temp: std_logic_vector(31 downto 0);
begin
if dir='0' then
if AL='0' then
temp:= i(BW-(1+shifting) downto 0)&(BW-1 downto BW-(1+shifting)=> '0');
else
temp:= i(BW-(1+shifting) downto 0)&(BW-1 downto BW-(1+shifting)=> i(BW-1));
end if;
elsif dir ='1' then
if AL='0' then
temp:= i(BW-1 downto shifting)&((shifting-1) downto 0=> '0');
else
temp:= i(BW-1 downto shifting)&((shifting-1) downto 0=> i(0));
end if;
end if;
o <= temp ;
end process;
END shifter_arch ;
你的移位器没有成功分析。生成循环的外部依赖于作为右边界的“移位”,移位是输入端口(非静态)。 IEEE Std 1076-2008 11.8生成语句“for generate语句的生成参数规范中的离散范围应为静态离散范围;类似地,if生成语句中的每个条件应为静态表达式。” *必须*(*必须* -1993)具有强制性权重,并且应该产生错误而不是没有详细说明。你的意思是使用顺序循环语句(在一个进程内)? – user1155120
我应该如何获得n位移位而不生成? –
一个for循环的过程? – user1155120