7 Replies Latest reply on Oct 7, 2013 2:06 AM by rama.sai.krishna.vakkantula

    AN61345  slavefifo F/W state machine

    lee.carter

       Hi.

         

      I trying to analysis AN61345 F/W and FPGA. But i have still question about state machine of TD_Poll().

         

      The following code is TD_poll() and i think it does not make sense.

         

      if ((done_frm_fpga) && (IOC & 0x02)) in order true, IOC must have 0x02 from FPGA.

         

      But firstly FPGA need to reset, and reset need  IOC|=0x01; //output 1 on PC.0...SYNC signal is HIGH 

         

      Does it make sense?

         

      Please Let me know What am i supposed to handle of this problem?

         

       

         

       

         

       

         

      void TD_Poll( void )

         

      { // Called repeatedly while the device is idle

         

       

         

        // ...nothing to do... slave fifo's are in AUTO mode...

         

       

         

      /* if((IOC & 0x02 ))

         

      {;}

         

      else

         

      {

         

        //IOA&=0xFD;

         

        IOC|=0x01;

         

      }*/

         

      if(!(IOC & 0x02))

         

      {

         

      done_frm_fpga = 1;

         

      }

         

      if ((done_frm_fpga) && (IOC & 0x02))

         

      {

         

      IFCONFIG = 0x03;

         

      SYNCDELAY;

         

       

         

      IOC|=0x01; //output 1 on PC.0...SYNC signal is HIGH 

         

      SYNCDELAY;

         

      done_frm_fpga = 0;

         

       

         

      }

         

       

         

      }

        • 1. Re: AN61345  slavefifo F/W state machine
          nikhil.naik

           IOC.2 is polled here to see if FPGA configuration is complete.

             

          It is not enough if you just poll for IOC&0x02, because IOC.2 pin is input to FX2 and output of FPGA and its state can be anything during the configuration (it can go high during configuration)

             

          So a dummy condition was added just to check if it trasitions from low to high.

             

          That is the reason following code is used

             

          if(!(IOC & 0x02)) //checks low

             

          {

             

          done_frm_fpga = 1;

             

          }

             

          if ((done_frm_fpga) && (IOC & 0x02)) //check high

          • 2. Re: AN61345  slavefifo F/W state machine
            lee.carter

            Hi

               

            In that code, firstly check low then chek high. 

               

            During check low to check high, IOC have to change value 0x02. 

               

            But i don't understand what make IOC value to 0x02?

               

            If you say that's FPGA, but my answer is NO

               

            In detail, done is need to reset from fpga. Also reset is made by sync from fx2lp's. 

               

            So what i'm saying is, that code does not make sense. 

            • 3. Re: AN61345  slavefifo F/W state machine
              rama.sai.krishna.vakkantula

               Hi dv2,     

               

                 

              I will explain you the functionality of firmware here.     

               

                 

              Initially the Slave FIFO interface of FX2LP is configured to use its internal clock. If you configure it to work on the external clock then external clock source must be present before the firmware sets IFCONFIG.7 = 0. But in our case, the FPGA connected to FX2LP is not programmed yet. So we need to configure FX2LP's Slave FIFO interface to work on internal clock till FPGA is ready to supply the clock.      

               

                 

              FX2LP firmware drives the PA1 GPIO to high so that you can program the FPGA connected to FX2LP over JTAG. Once the FPGA is programmed then we are changing the configuration of Slave FIFO (using IFCONFIG register) to use the external clock supplied from the FPGA.     

               

                 

              We are using PC1 for this purpose. "done_d" signal (G11 on ztex hardware board) on the FPGA is configured as output signal and this is tied to PC1 on the FX2LP. FPGA is driving this signal to LOW initially and changing its value to HIGH after 10 clock cycles. FX2LP firmware is waiting for this condition to happen before re-configuring the Slave FIFO to accept the clock from FPGA. Once this is done, FPGA     

               

               can just do data transfers to Slave FIFO interface of FPGA.

                 

              I hope my explanation is clear to you. Please let me know if you have any questions on this topic.     

               

                 

              Thanks,     

               

                 

              Sai Krishna.     

               

              • 4. Re: AN61345  slavefifo F/W state machine
                nikhil.naik

                 (IOC &0x02) mean pin 2 of port C of FX2LP which is connected to 'done' pin of FPGA

                • 5. Re: AN61345  slavefifo F/W state machine
                  lee.carter

                   Hi

                     

                  In the verilog code of slave_fifo_stream_in~.v,

                     

                  i can see as below

                     

                  assign reset_n = sync &lock;

                     

                  what is initial value of sync?

                     

                  And when is sync transition?

                  • 6. Re: AN61345  slavefifo F/W state machine
                    lee.carter

                    Hi

                       

                    I have some query as below

                       

                     We are using PC1 for this purpose. "done_d" signal (G11 on ztex hardware board) on the FPGA is configured as output signal and this is tied to PC1 on the FX2LP. FPGA is driving this signal to LOW initially and changing its value to HIGH after 10 clock cycles. FX2LP firmware is waiting for this condition to happen before re-configuring the Slave FIFO to accept the clock from FPGA. Once this is done, FPGA      

                     

                     can just do data transfers to Slave FIFO interface of FPGA.

                       

                     

                       

                    I hope my explanation is clear to you. Please let me know if you have any questions on this topic.     

                     

                       

                    Thanks,     

                     

                       

                    Sai Krishna.

                       

                         

                     

                       
                        
                       
                       
                        My question as below   
                       
                            
                       
                        1. done_d need wait_s, wait_s need reset_n from high to low.    
                       
                        But there is not reset_n transition.    
                       
                            
                    • 7. Re: AN61345  slavefifo F/W state machine
                      rama.sai.krishna.vakkantula

                       Hi dv2,

                         

                      I see your point here.

                         

                      You are talking about the following statement. right?

                         

                      assign reset_n = sync & lock;

                         
                          Can you please change that assignment statement to as shown below:   
                         
                              
                         
                          assign reset_n = lock;        
                         
                              
                         
                          Thanks,   
                         
                          Sai Krishna.