Vhdl 如何将std_逻辑添加到整数值
我试着在这里运行两个7段,我到处都搜索了,但找不到满意的答复,我如何才能在std_逻辑中添加1?我也尝试了逻辑算术库,但没有任何效果。我在某个地方读到,我必须使用(0到0)向量,但我并没有真正理解那个部分。这是我的密码Vhdl 如何将std_逻辑添加到整数值,vhdl,Vhdl,我试着在这里运行两个7段,我到处都搜索了,但找不到满意的答复,我如何才能在std_逻辑中添加1?我也尝试了逻辑算术库,但没有任何效果。我在某个地方读到,我必须使用(0到0)向量,但我并没有真正理解那个部分。这是我的密码 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; use ieee.std_logic_arith.all; entity blah is Port ( clk : in STD_LOGI
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use ieee.std_logic_arith.all;
entity blah is
Port ( clk : in STD_LOGIC;
anode: out STD_LOGIC_VECTOR (3 downto 0);
segment: out STD_LOGIC_VECTOR (6 downto 0));
end blah;
architecture Behavioral of blah is
signal sel: STD_LOGIC;
signal r_anode: STD_LOGIC_VECTOR (3 downto 0);
begin
anode <= r_anode;
process (clk) begin
if (clk'event and clk = '1') then
sel <= sel+1;
end if;
end process;
process (sel) begin
case sel is
when '0' => r_anode <= "1110";
when '1' => r_anode <= "1101";
when others => r_anode <= "1111";
end case;
case r_anode is
when "1110" => segment <= "0100100";
when "1101" => segment <= "0010010";
when others => segment <= "1111111";
end case;
end process;
end;
sel
只是一个位,因此添加1就像而不是sel
但是,如果sel
是std\u logic\u vector
中的更多位,则可以添加
natural
到std\u logic\u vector
无符号:
sel <= std_logic_vector(unsigned(sel) + 1);
sel这个sel
只是一个位,所以加1就像是而不是sel
但是,如果sel
是std\u logic\u vector
中的更多位,则可以添加
natural
到std\u logic\u vector
无符号:
sel <= std_logic_vector(unsigned(sel) + 1);
sel