-1
我需要幫助,我想剪輯我的值在+2048和-2048之間,但這是在std_logic_vector ie(「111111111111100000000000000000000000」和「000000000000100000000000000000000000」),我來自軟件背景,我認爲就是爲什麼我有這個問題,我重視我的代碼片段vhdl關係操作
--Saturate the output to -2048 to +2048
saturate1:process (x1,x2)
--variable sum, tmp :std_logic_vector(WWidth downto 0);
begin
y11 <= x1+x2;
if y11 >= "000000000000100000000000000000000000" then
y <= "000000000000100000000000000000000000";
elsif y11 >= "111111111111100000000000000000000000" then
y <= "111111111111100000000000000000000000";
else
y <= y2fullwidth;
end if;
end process saturate1;
Y11,X1,X2和y都是類型std_logic_vector。 謝謝。
你沒看錯... –
謝謝@Matthew泰勒,我能夠使用變量來解決它,你的方法不會像前面那樣給出同樣的錯誤,但我很欣賞這種努力。 – Dammy