FPGARelated.com
Forums

Dynamic DCM Controller help

Started by cutemonster December 19, 2006
Hi, I'm interfacing 2 ADC to spartan 3 3s400.  I need to phase shift the
"DATA READY" from ADC with DCM and I'm not succeed. First of all, is it a
good idea to phase shift the DATA READY signal for data capturing
purpose?
I did 90,180 and 270 shift and I did see some change. Now I would like to
use dynamic shift and here is my code.  The problem is that status[0]
always high and the phase shift DCM doesn't seem to work.  What do I
missed? please help.  


always @ (posedge pixel_clk)
begin	 
 if (rst) begin     
	 y_dynamic <= 8'h00;
 end	 
 else begin
      /***
        handshacking for DCM request
      ***/
      if(!req_phase_y)begin req_phase_y_ack <= 0; end
                /***
                   state machine
                ***/
		case(y_dynamic)
		8'h00:begin
			if(req_phase_y)begin
			  phase_y_cnt <= 0;
			  y_dynamic <= 8'h01;
			  req_phase_y_ack <= 1;
			end
			else begin
			  y_dynamic <= 8'h00;				 
			end
			PSEN_INy <= 0;				
		end
		8'h01:begin
                          /***
                            phase_y_sign[0] is from I2C 
                            phase_y_value is from I2C
                            phase_y_cnt is counter for phase_y_value
                         ***/
		  if(phase_y_cnt <= phase_y_value)begin
		         PSEN_INy <= 1;
                         
			 PSINCDEC_INy <= phase_y_sign[0];		 
			 phase_y_cnt <= phase_y_cnt + 1; 
			 y_dynamic <= 8'h02;
		  end
		  else begin          		  
		    PSEN_INy <= 0;			 
		    phase_y_cnt <= 0; 
		    y_dynamic <= 8'h00;
		  end				  
		end
		8'h02:begin
		   if(PSDONE_OUTy)begin
			    y_dynamic <= 8'h01;
			end
			else begin
			    y_dynamic <= 8'h02;
			end	                       		
		   end
		default:begin end
		endcase
	
	
 end 
end