我正在設計通用移位算術運算符。 除了以下述方式使用32位多路複用器(解碼器)之外,還有更好的方法來實現嗎?VHDL中的通用移位算術權利
ENTITY isra IS
PORT (
clk: in std_logic;
rst: in std_logic;
di: in std_logic_vector (31 downto 0);
sel: in std_logic_vector (31 downto 0);
res: out std_logic_vector (31 downto 0) := (others => '0')
);
END isra;
PROCESS
BEGIN
WAIT UNTIL clk'EVENT AND clk = '1';
IF rst = '1' THEN
res <= (others => '0');
ELSE
CASE sel IS
when X"00000001" => res <= to_stdlogicvector(to_bitvector(a) sra 1);
when X"00000002" => res <= to_stdlogicvector(to_bitvector(a) sra 2);
...
when X"0000001F" => res <= to_stdlogicvector(to_bitvector(a) sra 31);
when others => res <= (others => '0');
END CASE;
END IF;
END PROCESS;
demultiplexer?這裏沒有demux。 – 2010-11-13 21:24:28
你是對的,我改變了描述。 thx指出這一點。 – name 2010-11-13 23:33:49