- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Ссылка скопирована
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Hi Alan,
Write a testbench for counter and pre-set counter value.
A process block with a wait or initial block.
Regards
Anand
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Thank you Anand.
That is probably the best way to do it.
Regards,
Alan
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
I agree with Anand that the testbench is the best place, however, if you do want to use force command have a look at the many options and in particular the "-deposit" one;
force {<object_name> <value> [[@]<time_info>][, <value> [@]<time_info>]...
[-deposit | -drive | -freeze] [-cancel [@]<time_info>] [-repeat [@]<time_info>]
• -deposit
(optional) Sets the object to the specified <value>. The <value> remains until the object is
forced again, there is a subsequent driver transaction, or it is unforced with a noforce
command.
Good luck,
hans86
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Thank you Hans!
That may well be the quick-fix I was looking for - I was not aware of those options. I will certainly give it a try.
Best regards,
Alan
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Hello Hans.
I may be misinterpreting the command but using the "deposit" option does indeed force the counter output to a preset value but the counter output returns to the previous value (+1) after the next driver transaction (in this case input clocking of the counter). I had hoped it would continue counting from the preset value.
Have I missed something?
Thank you.
Regards,
Alan
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Hi Alan,
I just tried it out and it works fine for me (Modelsim DE 2019.2). I have a simple counter in VHDL defined as:
signal count_s : std_logic_vector(7 downto 0);
process (reset, clk)
begin
if reset='1' then
count_s <= (others => '0');
elsif rising_edge(clk) then
count_s + '1';
end if ;
end process;
During simulation I can force it to any value and it continues from the forced value:
force -deposit test_tb/u1/count_s 36
Is your counter a variable? In that case you need to use the change command.
Regards,
Hans.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Interesting and thanks for the trouble.
I created a 14 bit counter using the Megawizard.
I have an old version of ModelSim (Starter edition 6.5b) although I doubt that there would be any fundamental differences. (?).
I will however try the command on a VHDLdefined counter.
Rgds
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Some feedback:
The force/deposit command operates as you indicated on a VHDL counter. I do not know why it does not do so on a MegaWizard generated counter.
For now however, I have a solution.
Thank you.
Alan

- Подписка на RSS-канал
- Отметить тему как новую
- Отметить тему как прочитанную
- Выполнить отслеживание данной Тема для текущего пользователя
- Закладка
- Подписаться
- Страница в формате печати