Hallo, I have made a clock divider (1 MHz) with a counter connected to system clock (50 MHz). This counter has a threshold which goes high on the last count. This pulse drives some blocks as a clock enable (the clock input of these blocks is connected to system clock). Every block is falling edge sensitive. The pulse drives also a FSM where every state send high/low 4 signals. In this way there is no gating clock, but now pulse signal has high load. I can't use DCM because of the too low out frequency. What could I do to reduce load and skew? The only way is to add a BUFG? Many Thanks in advance and sorry for my terrible english Marco Toschi
FSM with High load on clock signal
Started by ●October 6, 2005
Reply by ●October 6, 20052005-10-06
Marco wrote:> Hallo, > I have made a clock divider (1 MHz) with a counter connected to system clock > (50 MHz). > This counter has a threshold which goes high on the last count. > This pulse drives some blocks as a clock enable (the clock input of these > blocks is connected to system clock). > Every block is falling edge sensitive. > > The pulse drives also a FSM where every state send high/low 4 signals. > > In this way there is no gating clock, but now pulse signal has high load. > > I can't use DCM because of the too low out frequency. > > What could I do to reduce load and skew? > > The only way is to add a BUFG?I assume that you'd be using a BUFG for your clock? You probably want to do that, if you aren't already. Simplest way to do what you want (I think) is to replicate your clock enable signal (or use a bufg, I guess) - what synthesis tool are you using? Some of them, at least, do this automatically. Jeremy
Reply by ●October 6, 20052005-10-06
"Marco" <marcotoschi@nospam.it> wrote in message news:di2she$iji$1@news.ngi.it...> Hallo, > I have made a clock divider (1 MHz) with a counter connected to system > clock (50 MHz). > This counter has a threshold which goes high on the last count. > This pulse drives some blocks as a clock enable (the clock input of these > blocks is connected to system clock). > Every block is falling edge sensitive. >Why are you using the falling edge? Your 50MHz clock should come from a BUFG and only use one edge (either rising or falling) in all the places it goes. So, the counter and the 'blocks' you mention should all use the same edge. Is that what you are doing?> > The pulse drives also a FSM where every state send high/low 4 signals. > > In this way there is no gating clock, but now pulse signal has high load. > > I can't use DCM because of the too low out frequency. > > What could I do to reduce load and skew? >The enable signal will be automatically buffered by the Xilinx routing. As long as you've told the timing analyser that your main clock is going at 50MHz, you don't have to worry about 'load' (or fanout as it's often called) or skew. To send a 1MHz signal out of the FPGA, as you mentioned in your other thread, you might like to consider also generating a 2MHz enable from your 50 MHz counter, as well as the 1MHz one, to toggle the IOB flip-flop.> > The only way is to add a BUFG? > > Many Thanks in advance and sorry for my terrible english > Marco Toschi >Ciao, Syms
Reply by ●October 7, 20052005-10-07
"Symon" <symon_brewer@hotmail.com> wrote in message news:434584b2$0$49022$14726298@news.sunsite.dk...> "Marco" <marcotoschi@nospam.it> wrote in message > news:di2she$iji$1@news.ngi.it... >> Hallo, >> I have made a clock divider (1 MHz) with a counter connected to system >> clock (50 MHz). >> This counter has a threshold which goes high on the last count. >> This pulse drives some blocks as a clock enable (the clock input of these >> blocks is connected to system clock). >> Every block is falling edge sensitive. >> > Why are you using the falling edge? Your 50MHz clock should come from a > BUFG and only use one edge (either rising or falling) in all the places it > goes. So, the counter and the 'blocks' you mention should all use the same > edge. Is that what you are doing?There are an ADC and a DAC connected to FPGA pins, and they are falling edge sensitive.>> >> The pulse drives also a FSM where every state send high/low 4 signals. >> >> In this way there is no gating clock, but now pulse signal has high load. >> >> I can't use DCM because of the too low out frequency. >> >> What could I do to reduce load and skew? >> > The enable signal will be automatically buffered by the Xilinx routing. As > long as you've told the timing analyser that your main clock is going at > 50MHz, you don't have to worry about 'load' (or fanout as it's often > called) or skew. To send a 1MHz signal out of the FPGA, as you mentioned > in your other thread, you might like to consider also generating a 2MHz > enable from your 50 MHz counter, as well as the 1MHz one, to toggle the > IOB flip-flop.This morning I have verified that XST generates a fanout at least of 3 on the signal used as clock for FSM indipendentely from the number of signal to drive into FSM. So if the clock is the system clock buffered automatically by XST, the load and skew aren't a trouble and they aren't "visible". Even if I reproduce the clock signal and the state machines, every clock signal has a load of 3. It takes a skew of 1ns and a delay of 2ns. In my case I can't use the system clock. At this point I think the only way is to use a BUFG. So I have placed a BUFG and the trouble seems to be solved, but the DAC reacts in different ways depending on the level of optimizazion of mapping and post-placing. I send a clock signal of 1 MHz, a Chip Select, and 16 serial data bits. I have thought that depending on the level of optimization, the delay between clock and chip select could be different, so the DAC don't go into power on state. In what way may I solve this trouble? Many Thanks Marco
Reply by ●October 7, 20052005-10-07
"Marco" <marcotoschi@nospam.it> wrote in message news:di58qu$eof$1@news.ngi.it...> > "Symon" <symon_brewer@hotmail.com> wrote in message > news:434584b2$0$49022$14726298@news.sunsite.dk... >> Why are you using the falling edge? Your 50MHz clock should come from a >> BUFG and only use one edge (either rising or falling) in all the places >> it goes. So, the counter and the 'blocks' you mention should all use the >> same edge. Is that what you are doing? > > There are an ADC and a DAC connected to FPGA pins, and they are falling > edge sensitive. >OK Marco, let me see if I understand your design. You have an FPGA. It has a 50 MHz clock available. Let's call this the 'masterclock'. Attached to the FPGA are a DAC and a ADC. These parts are designed to be clocked at 1MHz, let's call these the DAC_clock and the ADC_clock. Here's some VHDL. --snippet to generate clock enables if res_n = '0' then --add async resets here elsif rising_edge(masterclock) then count <= (count + 1) mod 50; --may not synthesise, but you get the idea if (count = 25) then DAC_clock <= '0'; ADC_clock <= '0'; elsif (count = 0) then DAC_clock <= '1'; ADC_clock <= '1'; end if; if (count = 49) then enable_1MHz <= '1'; --this is our 1MHz enable signal else enable_1MHz <= '0'; end if; end if; --snippet to demonstrate clock enable if res_n = '0' then --add async resets here elsif rising_edge(masterclock) then if (enable_1MHz = '1') then --Here's the clock enable --add your 1 MHz state machine stuff here e.g. DAC_data <= new_DAC_data_value; ADC_data <= data_from_ADC_device; end if; end if; So, you see that every FF is clocked by the rising edge of the 50MHz clock. Some are only enabled one every microsecond, but their clock input is still our masterclock. This masterclock should come from a BUFG. No nasty 'falling edges' needed. Draw a timing diagram; it'll help you see what's happening!> >>> >>> The pulse drives also a FSM where every state send high/low 4 signals. >>> >>> In this way there is no gating clock, but now pulse signal has high >>> load. >>> >>> I can't use DCM because of the too low out frequency. >>> >>> What could I do to reduce load and skew? >>> >> The enable signal will be automatically buffered by the Xilinx routing. >> As long as you've told the timing analyser that your main clock is going >> at 50MHz, you don't have to worry about 'load' (or fanout as it's often >> called) or skew. To send a 1MHz signal out of the FPGA, as you mentioned >> in your other thread, you might like to consider also generating a 2MHz >> enable from your 50 MHz counter, as well as the 1MHz one, to toggle the >> IOB flip-flop. > > > This morning I have verified that XST generates a fanout at least of 3 on > the signal used as clock for FSM indipendentely from the number of signal > to drive into FSM. So if the clock is the system clock buffered > automatically by XST, the load and skew aren't a trouble and they aren't > "visible". > > Even if I reproduce the clock signal and the state machines, every clock > signal has a load of 3. It takes a skew of 1ns and a delay of 2ns. > > In my case I can't use the system clock. At this point I think the only > way is to use a BUFG. > > So I have placed a BUFG and the trouble seems to be solved, but the DAC > reacts in different ways depending on the level of optimizazion of mapping > and post-placing. > > I send a clock signal of 1 MHz, a Chip Select, and 16 serial data bits. > > I have thought that depending on the level of optimization, the delay > between clock and chip select could be different, so the DAC don't go into > power on state. > > In what way may I solve this trouble? > > Many Thanks > Marco >Sorry Marco, this last part of your post is a mystery to me. You only need one 'clock' signal, the masterclock. It should have a fanout of more than 3! The 1MHz enable signal should go to all the FFs in your FSM, I think this signal should have a lot more than 3 loads as well. A delay of 2ns and a skew of 1ns is fine for this clock. Do you want to post some code? Anyway, if this makes any sense to you, post back, and we can talk about the timing constraints you need to set! HTH, Syms.
Reply by ●October 7, 20052005-10-07
> So, you see that every FF is clocked by the rising edge of the 50MHz > clock. Some are only enabled one every microsecond, but their clock input > is still our masterclock. This masterclock should come from a BUFG. No > nasty 'falling edges' needed. Draw a timing diagram; it'll help you see > what's happening! >My code is similar to that you posted, the idea is the same. The only difference is I have used core generator to create the components. I will try drawing a timing diagram.> >> >>>> >>>> The pulse drives also a FSM where every state send high/low 4 signals. >>>> >>>> In this way there is no gating clock, but now pulse signal has high >>>> load. >>>> >>>> I can't use DCM because of the too low out frequency. >>>> >>>> What could I do to reduce load and skew? >>>> >>> The enable signal will be automatically buffered by the Xilinx routing. >>> As long as you've told the timing analyser that your main clock is going >>> at 50MHz, you don't have to worry about 'load' (or fanout as it's often >>> called) or skew. To send a 1MHz signal out of the FPGA, as you mentioned >>> in your other thread, you might like to consider also generating a 2MHz >>> enable from your 50 MHz counter, as well as the 1MHz one, to toggle the >>> IOB flip-flop. >> >> >> This morning I have verified that XST generates a fanout at least of 3 on >> the signal used as clock for FSM indipendentely from the number of signal >> to drive into FSM. So if the clock is the system clock buffered >> automatically by XST, the load and skew aren't a trouble and they aren't >> "visible". >> >> Even if I reproduce the clock signal and the state machines, every clock >> signal has a load of 3. It takes a skew of 1ns and a delay of 2ns. >> >> In my case I can't use the system clock. At this point I think the only >> way is to use a BUFG. >> >> So I have placed a BUFG and the trouble seems to be solved, but the DAC >> reacts in different ways depending on the level of optimizazion of >> mapping and post-placing. >> >> I send a clock signal of 1 MHz, a Chip Select, and 16 serial data bits. >> >> I have thought that depending on the level of optimization, the delay >> between clock and chip select could be different, so the DAC don't go >> into power on state. >> >> In what way may I solve this trouble? >> >> Many Thanks >> Marco >> > Sorry Marco, this last part of your post is a mystery to me. You only need > one 'clock' signal, the masterclock. It should have a fanout of more than > 3! The 1MHz enable signal should go to all the FFs in your FSM, I think > this signal should have a lot more than 3 loads as well. A delay of 2ns > and a skew of 1ns is fine for this clock. Do you want to post some code? > Anyway, if this makes any sense to you, post back, and we can talk about > the timing constraints you need to set! > HTH, Syms.Masterclock has a high fanout, about 100. I have replicated 2 times the clock pulse at 1MHz and the state machines to verify if it could low the fanout. I have obtained that every replicated clock (the pulse at 1 MHz) used to drive a state machine has a load equal to 3. I have tried now avoiding replication hardware and BUFG connected to clock pulse. In this way clock pulse at 1MHz hs a load of 7. There are skew 1ns and delay 2,5ns. I have made lots of experiments because I thought the main trouble could come from that. If I want update every channel, I should send 4 words of 16 bits and 4 ChipSelect. (I have made lots of post-place simulations and everything is ok). I have sent them and not every channel is updated. Which channel depends on level of optimization. If I try to update the out of only one channel (sending 500-1000 16-bit datas sequentially to DAC) the system works well. It seems doesn't accept a sequential update of different channels. I'm sure to wait the time needed to update a single channel. I have verified it. Could be a trouble depending on DAC and not from my logic? In example the control unit which read what channel to update and configure the nultiplexer? Many and many thanks for your precious answer Marco
Reply by ●October 7, 20052005-10-07
"Marco" <marcotoschi@nospam.it> wrote in message news:di5hbd$i0i$1@news.ngi.it...> > > Masterclock has a high fanout, about 100. > I have replicated 2 times the clock pulse at 1MHz and the state machines > to verify if it could low the fanout.Why do you want to lower the fanout? Have you connected the clock pulse at 1MHz to the clock input of any FFs? If you have, this is your mistake. It should only connect to the CE pins. The clock pins of *ALL* your FFs should connect to the 50MHz masterclock. Cheers, Syms.
Reply by ●October 7, 20052005-10-07
"Symon" <symon_brewer@hotmail.com> wrote in message news:43464b2d$0$49020$14726298@news.sunsite.dk...> "Marco" <marcotoschi@nospam.it> wrote in message > news:di5hbd$i0i$1@news.ngi.it... >> >> >> Masterclock has a high fanout, about 100. >> I have replicated 2 times the clock pulse at 1MHz and the state machines >> to verify if it could low the fanout. > > Why do you want to lower the fanout? Have you connected the clock pulse at > 1MHz to the clock input of any FFs? If you have, this is your mistake. It > should only connect to the CE pins. The clock pins of *ALL* your FFs > should connect to the 50MHz masterclock. > > Cheers, Syms. >Here the code: clk_low_pulse is the pulse of freq. 1MHz and goes high for 20ns. RX_REGISTER_SYNC_PROC: process ( clk_low_pulse, reset ) is begin if ( reset = '1' ) then rx_state <= rx_state_1; elsif ( clk_low_pulse'event and clk_low_pulse = '0') then rx_state <= rx_next_state; end if; end process; RX_REGISTER_OUTPUT_DECODE: process ( rx_state, clk_low_pulse ) is begin case ( rx_state ) is when rx_state_1 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_2 => Slave_Select <= '1'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_3 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_4 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_5 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_6 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_7 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_8 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '0'; acq_ack <= '0'; when rx_state_9 => Slave_Select <= '0'; rx_shift_enable <= '1'; Rx_Status_En <= '1'; acq_ack <= '0'; when rx_state_10 => Slave_Select <= '0'; rx_shift_enable <= '0'; Rx_Status_En <= '1'; acq_ack <= clk_low_pulse; when others => null; end case; end process; RX_REGISTER_NEXT_STATE_DECODE: process ( rx_state, Rx_State_Machine, rx_counter_tresh ) is begin rx_next_state <= rx_state; --default is to stay in current state case ( rx_state ) is when rx_state_1 => if ( Rx_State_Machine = '1' ) then rx_next_state <= rx_state_2; else rx_next_state <= rx_state_1; end if; when rx_state_2 => rx_next_state <= rx_state_3; when rx_state_3 => rx_next_state <= rx_state_4; when rx_state_4 => rx_next_state <= rx_state_5; when rx_state_5 => rx_next_state <= rx_state_6; when rx_state_6 => rx_next_state <= rx_state_7; when rx_state_7 => rx_next_state <= rx_state_8; when rx_state_8 => rx_next_state <= rx_state_9; when rx_state_9 => if ( rx_counter_tresh = '1' ) then rx_next_state <= rx_state_10; else rx_next_state <= rx_state_9; end if; when rx_state_10 => rx_next_state <= rx_state_1; when others => rx_next_state <= rx_state_1; end case; end process;
Reply by ●October 7, 20052005-10-07
"Marco" <marcotoschi@nospam.it> wrote in message news:di5pfo$kkm$1@news.ngi.it...> > "Symon" <symon_brewer@hotmail.com> wrote in message > news:43464b2d$0$49020$14726298@news.sunsite.dk... >> "Marco" <marcotoschi@nospam.it> wrote in message >> news:di5hbd$i0i$1@news.ngi.it... >>> >>> >>> Masterclock has a high fanout, about 100. >>> I have replicated 2 times the clock pulse at 1MHz and the state machines >>> to verify if it could low the fanout. >> >> Why do you want to lower the fanout? Have you connected the clock pulse >> at 1MHz to the clock input of any FFs? If you have, this is your mistake. >> It should only connect to the CE pins. The clock pins of *ALL* your FFs >> should connect to the 50MHz masterclock. >> >> Cheers, Syms. >> > > Here the code: > clk_low_pulse is the pulse of freq. 1MHz and goes high for 20ns. > > > RX_REGISTER_SYNC_PROC: process ( clk_low_pulse, reset ) is > begin > > if ( reset = '1' ) then > rx_state <= rx_state_1; > elsif ( clk_low_pulse'event and clk_low_pulse = '0') then > rx_state <= rx_next_state; > end if; > > end process; >OK, now we're getting somewhere! So, you're using 'clk_low_pulse' as a clock. This is bad. Do this instead:- RX_REGISTER_SYNC_PROC: process ( clk_50MHz, reset ) is begin if ( reset = '1' ) then rx_state <= rx_state_1; elsif ( clk_50MHz'event and clk_50MHz= '1') then --NB rising edge!! if clk_low_pulse = '1' then rx_state <= rx_next_state; end if; end if; end process; Does that make it clear? Try drawing a timing diagram of that. You'll see that the FFs are all clocked by the 50MHz masterclock. The signal 'clk_low_pulse' is used as a clock enable, so its delay and skew don't matter, provided you meet the set up time of the FFs. Cheers, Syms. p.s. Instead of elsif ( clk_50MHz'event and clk_50MHz= '1') then use elsif rising_edge(clk_50MHz) then It's better for some reason I can't remember but you can find by Googling!
Reply by ●October 7, 20052005-10-07





