ฉันกำลังพยายามใช้ฟังก์ชัน shift_left() ในโครงการของฉัน แต่ฉันได้รับข้อผิดพลาด 2 ข้อที่อธิบายไม่ได้:
- ข้อผิดพลาด: พิมพ์ข้อผิดพลาดใกล้กับ 'shift left'; ประเภทที่คาดหวัง 'std_logic_vector'
แต่ temp เป็น std_logic_vector!
- ข้อผิดพลาด: ไม่พบรายการที่เป็นไปได้สำหรับโปรแกรมย่อย 'shift_left'
สัญญาณที่ใช้ในรหัสถูกกำหนดเป็น:
signal shifted_pixel, temp : std_logic_vector(15 downto 0);
signal i_data : std_logic_vector(7 downto 0);
ตัวอย่างด้านล่างนี้เขียนขึ้นภายในกระบวนการ
temp <= "00000000" & i_data;
shifted_pixel <= shift_left(temp, 5);
รหัสเต็มด้านล่าง:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.ALL;
entity project is
port (
i_clk : in std_logic;
i_rst : in std_logic;
i_start : in std_logic;
i_data : in std_logic_vector(7 downto 0);
);
end project;
architecture rtl of project is
signal shifted_pixel, temp : std_logic_vector(15 downto 0);
begin
process(i_data)
begin
temp <= "00000000" & i_data;
shifted_pixel <= shift_left(temp, 5);
end process;
end rtl;
shifted_pixel <= std_logic_vector(shift_left(unsigned(temp), 5));
temp
จะต้องพิมพ์ unsigned เพื่อใช้ SHIFT_LEFT ที่เกี่ยวข้องในแพ็คเกจ numeric_std ค่าผลลัพธ์จะต้องเข้ากันได้กับ std_logic_vector เพื่อกำหนดให้กับshifted_pixel
- person   schedule 27.03.2021