anyone help me in how to write the vhdl code of k counter, the programmable part? the variable stage long which controlled by the K modulus.
or giv me some direction because i cant find any sources in internat.
thank you.
Re: help in "K counter" of ADPLL (VHDL source code
no one know that? then....
does anyone know whether the bound can make variable?
for eg.
UP : std_logic_vector(N downto 0);
the N is not constant but will depend on the other input port. or hav any method to solve it?
thanks first.
Re: help in "K counter" of ADPLL (VHDL source code
yming said:
no one know that? then....
does anyone know whether the bound can make variable?
for eg.
UP : std_logic_vector(N downto 0);
the N is not constant but will depend on the other input port. or hav any method to solve it?
thanks first.
i do not really understand what bound you are trying to define. but you can try this (k-counter values are according to CD74ACT297 datasheet):
Code:
if K = "0001" then
k_val := 8;
elsif K = "0010" then
k_val := 16;
elsif K = "0011" then
k_val := 32;
end if;
and so on...
note: assume k_val is declared earlier as variable.
make sure the k_val variable is shared among all processes in your k-counter architecture.
Code:
architecture rtl of k_counter is
shared variable k_val : integer;
...
end architecture k_counter;
it's a bit hard to defined the bound through entity declaration although you can do it, but it will cause extra work later in the architecture if you want to synthesize your code. for me, so i just define the bound during declaration in the first place (made it 4-bit).
yeah, just set the K width (UP and DOWN) width to be the worst-case one (or the largest available width you preferred). then by getting the 4-bit input for k-counter configuration, you can use the available width according to your need.
for example, as you set the k-counter width to be 32-bit wide (it is fixed), it is the worst-case/largest one. so you can't configure the k-counter or set K for value more than 32. but you can still set for K value that is below than 32. so no problem if you want to use K value of 8 or 16, although there will be extra bits left.
the code you had written, i think is just possible to be used in simulation only, maybe by setting N as the global variable, or generic value in the top-level design. but not for synthesis because we are defining hardware. and hardware needs precise ports definition.