- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 RaghavendraLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
include it as all other packages. e.g.: use work.my_functions.all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks..How can i use in testbench code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- 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
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page