Problem with 'altpll' phase parameter.
Hello, I trying to set 'altpll' parameter:
HPLL1.clk1_phase_shift = PHASE_ps,
Now, in my code, I made localparam 'DDR3_WDQ_PHASE_pss' =:
localparam int PHASE_degree = 90;
localparam int PHASE_ps = (((1000000 / ( CLK_KHZ_IN/1000 * CLK_IN_MULT / CLK_IN_DIV )) * PHASE_degree / 360) -1) ;
localparam string PHASE_ps_s1 = "499" ;
localparam PHASE_ps_s2 = "499" ;
HPLL1.clk1_phase_shift only seems to accept 'PHASE_ps_s2', a hard number written in quotes.
It wont even accept the string PHASE_ps_s1, and it sees the original 'PHASE_ps' as a "0".
How do I make the 'altpll' megafunction accept my calculated 'PHASE_ps'? All the other 'altpll' parameters like 'HPLL1.clk0_divide_by = CLK_IN_DIV' and 'HPLL1.clk0_multiply_by = CLK_IN_MULT' work fine.
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.