Forum Discussion
Altera_Forum
Honored Contributor
16 years agohow to export macro to system.h?
eg, I want to put # define MOD_0_FREQ 50000000u to system.h as many altera sopc ip do. And I try to add some line in the MOD_hw.tcl: add_parameter FREQ_PARAM 0 set_parameter_property FRE...
Altera_Forum
Honored Contributor
16 years agoThere are a couple of good documents on all of this..
http://www.altera.com/literature/hb/qts/qts_qii54022.pdf http://www.altera.com/literature/hb/nios2/n2sw_nii52018.pdf We use the validation phase for the main clock frequency that feeds a SOPC module as it is usually derived and you don't really want them editable in the gui.. But I guess it's much the same depending on how you write the proc callback.... ******* The following is in the ___hw.tcl file for the component ** set_module_property VALIDATION_CALLBACK validate add_parameter clock_freq INTEGER set_parameter_property clock_freq SYSTEM_INFO {CLOCK_RATE "clock"} proc validate {} { set_module_assignment embeddedsw.CMacro.FREQ [get_parameter_value clock_freq] } **** This will add a C Macro to the system.h file like this# define "SOPC_MODULE_NAME"_FREQ 1000000 the "clock" above is the endpoint you defined somewhere else in you tcl file.