Forum Discussion
Problem with 'altpll' phase parameter.
- 5 years ago
It looks like this is the only trick which will work:
localparam DDR3_WDQ_PHASE_ps = (((1000000 / ( PLL1_in_KHz/1000 * CLK_IN_MULT / CLK_IN_DIV )) * DDR3_WDQ_PHASE / 360) -1) ;
localparam DDR3_RDQ_PHASE_ps = (((1000000 / ( PLL1_in_KHz/1000 * CLK_IN_MULT / CLK_IN_DIV )) * DDR3_RDQ_PHASE / 360) -1) ;localparam int Altera_Dummy_String [0:399] = '{ // Seriously, this is the only way... I feel like an idiot making this public...
"0000","0010","0020","0030","0040","0050","0060","0070","0080","0090","0100","0110","0120","0130","0140","0150","0160","0170","0180","0190",
"0200","0210","0220","0230","0240","0250","0260","0270","0280","0290","0300","0310","0320","0330","0340","0350","0360","0370","0380","0390",....... All the way up to 3990 .....
localparam DDR3_WDQ_PHASE_pss = Altera_Dummy_String[DDR3_WDQ_PHASE_ps/10] ;
localparam DDR3_RDQ_PHASE_pss = Altera_Dummy_String[DDR3_RDQ_PHASE_ps/10] ;Though this lowers my ps resolution to every 10ps, your so called string for some reason needs to be an INT parameter defined with numbers in quotes for ModelSim and Quartus to accept the results, hence my array 'localparam 'INT' Altera_Dummy_String [0:399] '.
Simulation and results in the fitter's utilization report in the PLL section prove my calculated parameter referenced to the array 'DDR3_R/WDQ_PHASE_pss' takes proper effect.
Really weird since the other 'STRING' parameters accept normal strings properly. It is only the PLL phase exclusively which requires an INT localparam with a number packaged in Quotes as if it were a string. Something is fishy with the way the coder decided to implement the phase feature as a non-standard string.
Hi,
Please note that clk1_phase_shift is of type STRING. You cannot pass an Integer value to it.
For your application, the integer value should be converted to a string.
You may use function like sprintf() to do that or any other method.
Regards.
- BrianHG5 years ago
Occasional Contributor
Ok, I tried this:
localparam PHASE_ps_s2 = sprintf("%d",PHASE_ps);
and for the PLL, I used the 'PHASE_ps_s2'.
However, ModelSim reported this:
# ** Error: BrianHG_DDR3_PLL.sv(131): External function 'sprintf' may not be used in a constant expression.
# ** Error: BrianHG_DDR3_PLL.sv(131): Parameter value must be constant.Is there a way to tell the localparam that the 'sprintf("%d",PHASE_ps)' is a constant?
The PHASE_ps is a localparam constant.
Is there another way to pass my constant calculated integer PHASE_ps into a string?
- BrianHG5 years ago
Occasional Contributor
Also, if I try:
localparam string PHASE_ps_s2 = string'(((1000000 / ( CLK_KHZ_IN/1000 * CLK_IN_MULT / CLK_IN_DIV )) * PHASE_degree / 360) -1) ;
I get this error:
# ** Error: (vsim-8576) Override of parameter 'clk1_phase_shift' from '/BrianHG_DDR3_PLL_tb/DUT_DDR3_PLL/genblk3' has an incompatible value.
# Time: 0 ps Iteration: 0 Region: /BrianHG_DDR3_PLL_tb/DUT_DDR3_PLL/genblk3 File: BrianHG_DDR3_PLL.sv- BrianHG5 years ago
Occasional Contributor
Intel keeps emailing me to check if a solution to my problem has been found, yet it has not.
The email does not offer a means to say that there is no solution yet...
ModelSim wont accept me feeding the 'altpll' phase unless it is an INTEGER parameter filled with a number in "QUOTES".
How do I pass one of my numerically calculated integers into the 'string', but not a true 'string' so that the 'altpll' can operate?