Forum Discussion
Altera_Forum
Honored Contributor
14 years agoHow to use functions in packages on testbench code.
Hi all,
How to use functions in the packages to testbench to give inputs a and b code. function to_max(a, b : integer) return integer is variable output :integer; begin if (a > b)then output := a; return output ; else output := b; return output; end if; Thanks in advance Regards Raghavendra4 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- Thanks..How can i use in testbench code. --- Quote End --- 1. Start by reading the two replies that you got to your question when you first posted it. 2. If you're still confused, then ask a question about where you are confused by those two replies 3. Don't ask the same question twice, when it was answered the first time. KJ - Altera_Forum
Honored Contributor
Thanks..How can i use in testbench code.
- Altera_Forum
Honored Contributor
eg:
package my_function is function to_max(a, b : integer) return integer is variable output :integer; begin if (a > b)then output := a; return output ; else output := b; return output; end if; end package my_functions library ieee library work use work.my_functions.all entity test_program is port ( x,y : in integer; y : out integer ); architecture beh of test_program is begin y =to_max(x,y) ; end architecture beh; not synthesizable code but this is just a guide. hope it helps - Altera_Forum
Honored Contributor
include it as all other packages. e.g.: use work.my_functions.all