tag:blogger.com,1999:blog-8545584178161664571.post5663884166684292965..comments2024-03-05T12:22:41.522+05:30Comments on Blog of Sandeep Vaniya: Reusable Channel using Define MacroSandeep B. Vaniyahttp://www.blogger.com/profile/07162249171731430910noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8545584178161664571.post-25927946318576742672008-12-20T10:39:00.000+05:302008-12-20T10:39:00.000+05:30Wow,,,I never paid this much attention to SV macro...Wow,,,<BR/>I never paid this much attention to SV macros and so I was unaware of these usages.<BR/>Thanks a lot :)Shuntyhttps://www.blogger.com/profile/02001680854113630661noreply@blogger.comtag:blogger.com,1999:blog-8545584178161664571.post-28195059764212688652008-06-05T23:14:00.000+05:302008-06-05T23:14:00.000+05:30Hi Ram,Yes. You can pass macro as argument to `cha...Hi Ram,<BR/><BR/>Yes. You can pass macro as argument to `channel(integer).<BR/>For example, consider that you have generic data class.<BR/>`define get_data_class_name(A) A``_data<BR/>`define define_data_class(A) class A``_data; \<BR/> A variable; \<BR/> function fnc1(A a); \<BR/> endfunction \<BR/> task tsk1(A a); \<BR/> endtask \<BR/>endclass<BR/><BR/>Now, you can create channel as follows.<BR/>`define_data_class(integer) // Create declaration for class named integer_data.<BR/>`channel(`get_data_class_name(integer)) // This will create channel dealing with data class named integer_data.<BR/><BR/>`define_data_class(string) // Create declaration for class named string_data<BR/>`channel(`get_data_class_name(string)) // This will create channel dealing with data class named string_data.<BR/><BR/>If above one is difficult to understand, then see this simple one.<BR/>`define DATA_TYPE integer<BR/>`channel(`DATA_TYPE) <BR/><BR/>Thanks,<BR/>SandeepSandeep B. Vaniyahttps://www.blogger.com/profile/07162249171731430910noreply@blogger.comtag:blogger.com,1999:blog-8545584178161664571.post-10333825741176357472008-06-05T17:57:00.000+05:302008-06-05T17:57:00.000+05:30Hi Sandeep,Thanks for information on macros in SV....Hi Sandeep,<BR/><BR/>Thanks for information on macros in SV. I have a question, in the example stated above instead of calling the macro as `channel(integer), can a macro be used as an argument to the `channel macro?<BR/><BR/>If so how can that be done? LRM of SV doesn't talk about this aspect neither do i find it anywhere in the web.<BR/><BR/>Thanks for the help.<BR/><BR/>Thanks & Regards<BR/>-RamRamhttps://www.blogger.com/profile/13767549084778679893noreply@blogger.com