We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for
Did you mean:
Visitor
91 Views
Registered: ‎12-06-2018

vhdl coding

What is the meaning VHDL code line is ,Signal temp: std_LOGIC_VECTOR (31 downto 0) := (others => '0'); as iam new to VHDL programming…

1 Solution

Accepted Solutions
Highlighted
Contributor
80 Views
Registered: ‎04-06-2018

Re: vhdl coding

you are just initializing the signal with 0 , zeros.

others=>'0' , say all vetor is filled with zeros.

2 Replies
Highlighted
Contributor
81 Views
Registered: ‎04-06-2018

Re: vhdl coding

you are just initializing the signal with 0 , zeros.

others=>'0' , say all vetor is filled with zeros.

Visitor
41 Views
Registered: ‎12-06-2018

Re: vhdl coding

function quantization_sgn(nbit : integer; max_abs : real; dval : real) return std_logic_vector is
variable temp : std_logic_vector(nbit-1 downto 0):=(others=>'0');
constant scale : real :=(2.0**(real(nbit-1)))/max_abs;
constant minq : integer := -(2**(nbit-1));
constant maxq : integer := +(2**(nbit-1))-1;
variable itemp : integer := 0;
begin
if(nbit>0) then
if (dval>=0.0) then
itemp := +(integer(+dval*scale+0.49));
else
itemp := -(integer(-dval*scale+0.49));
end if;
if(itemp<minq) then itemp := minq; end if;
if(itemp>maxq) then itemp := maxq; end if;
end if;
temp := std_logic_vector(to_signed(itemp,nbit));
return temp;

why 0.49 is used here..in this code ???
end quantization_sgn;