Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHow is the clock divider done, with a register used as a ripple clock?
In TQ, clocks propagate through logic, such as a much, but not through registers. Because of this, I might see a 2:1 clock mux in logic(where the sources are pins or PLLs) and the user doesn't do anything special and it all works out. They just cut timing between the two source clocks because they're not related. If they are related, the user has to put two generated clocks on the output of the mux, something like: create_generated_clock -name clkA_muxed -source [get_ports clkA] [get_pins {clk_mux_hierarchy|o}] create_generated_clock -name PLL_muxed -source [get_pins PLL_name] [get_pins {clk_mux_hierarchy|o}] -add set_clock_groups -asynchronous -group {clkA_muxed} -group {PLL_muxed} Now there are two clocks going through the mux, but they're not related, i.e. they can't both be driving through at the same time, but clkA_muxed can drive the base PLL, and PLL_muxed can connect to the base clkA for example, of course you can cut those too: set_clock_groups -asynchronous -group {clkA_muxed clkA} -group {PLL_muxed PLL_name} This cuts timing between the clkA and it's muxed version, and PLL and it's muxed version. It's really going to do the same analysis as not doing any generated clocks and just cutting timing between clkA and PLL. The difference is there are names for everything driven by the mux, so it's easier to analyze it's timing, i.e. you can do: report_timing -setup -npaths 100 -detail full_path -from_clock clkA_muxed -to_clock clkA_muxed -panel_name "setup: within clkA_muxed" Obviously you can do all sorts of combinations, like from clkA to clkA_muxed, to see if any paths cross and will have large skew. Another benefit is if it shows up in one of the summary reports, like Setup Summary, there will be separate lines for clkA, clkA_muxed, PLL and PLL_muxed, so you have a better idea if you see one failing where it's at. Now in your case, let's say the dividers are registers. Clocks do NOT propagate through registers and you must put a generated clock on them. You might have something like: create_clock -name clkA -period 10.0 [get_ports clkA] create_generated_clock -name B_div -source [get_ports clkA] -divide_by 2 [get_keepers {div_B_reg}] create_generated_clock -name C_div -source [get_ports clkA] -divide_by 4 [get_keepers {div_C_reg}] # First mux: create_generated_clock -name E_muxedA -source [get_ports clkA] [get_pins E_mux|o] create_generated_clock -name E_muxedB -source [get_keepers {div_B_reg}] [get_pins E_mux|o] -add # Second mux(I'm calling F) create_generated_clcok -name F_muxedA -source [get_pins E_mux|o] -master_clock E_muxedA [get_pins F_mux|0] create_generated_clcok -name F_muxedBdiv -source [get_pins E_mux|o] -master_clock E_muxedB [get_pins F_mux|0] -add create_generated_clcok -name F_muxedCdiv -source [get_keepers {div_B_reg}] [get_pins F_mux|0] -add # Finally the output port: create_generated_clock -name clk_out_A -source [get_pins F_mux|o] -maser_clock F_muxedA [get_ports clk_out] create_generated_clock -name clk_out_B -source [get_pins F_mux|o] -maser_clock F_muxedBdiv [get_ports clk_out] -add create_generated_clock -name clk_out_C -source [get_pins F_mux|o] -maser_clock F_muxedCdiv [get_ports clk_out] -add This is the worst case, most complicated manner, but it is complete. Note that for generated clocks, the -source is a physical node in the design, not a clock name. The reason this is done is for IP, the user can just specify a point in the design and not have to know the clock name that is applied to it. A good example is an input port driving a PLL. When they call derive_pll_clocks, TQ puts a generated clock on the output of the PLL, and it's source is just the pin going into the PLL(not the physical port, but the reference clock pin on the PLL cell). TimeQuest then traces back to the input port. The beauty of this is that the generated clock assignment doesn't need to know the name of the input port or the name of the clock assigned to it, and it still works. The user can change the input port name or clock on the fly and the PLL will automatically update. Anyway, when the -source of the assignment is a physical node that has more than one clock going through it, like a mux, the user needs to add the -master_clock option to specify which clock they are talking about. You will also need a set_clock_groups assignment to say most of these clocks aren't related, otherwise TQ will analyze cases where one clock goes through the mux and feeds the source register, and the other clock goes through the mux and feeds the destination, and vice-versa. This all looks really complicated, but it accounts for all cases. You really do have three separate source clocks(A, divB and divC), then multiple combinations that comes out of the mux, and multiple ways they could all be related. This gives you complete control.