Chinaunix
标题: VHDL语言中 bit如何转换为std_logic的方法 [打印本页]
作者: ToDDY 时间: 2011-01-05 16:05
标题: VHDL语言中 bit如何转换为std_logic的方法
在std_1164库中只查到有bit转成std_ulogic,bit_vector 转成std_logic_vector.我现在想把一个bit赋给std_logic_vector类型的最后一位,请问有没有好的处理方法?谢谢
function bit_to_std_logic(constant bit_in : bit) return std_logic is
variable temp_bit : bit;
variable temp_result : std_logic;
begin
temp_bit := bit_in;
if temp_bit = '1' then
temp_result := '1';
else
temp_result := '0';
end if;
return(temp_result);
end bit_to_std_logic;
begin
std_logic_vector_signal(0) <= bit_to_std_logic(bit_in);
end;
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) |
Powered by Discuz! X3.2 |