usb_bb_term.v 3.54 KB
//**************************************************************************************
//
//	Model Name	: usb_bb_term.v
//	Revision	: $Revision: 1.8 $
//	Date		: $Date: 2003/01/18 00:05:43 $
//	Author		: Bill Saperstein
//	Description	: USB termination block to interface to bb chip
//
//**************************************************************************************


//**************************************************************************************
// Module Definition
//**************************************************************************************
module usb_bb_term
		(
	// Inputs
		usb_dp_high ,
		usb_d_low_n ,
		usb_vbus_on ,
		tb_is_device ,
		tb_is_disconnect ,
	// Outputs
		usb_id ,
		usb_sess_vld ,
		bb_device ,
		bb_is_disconnect ,
	// Bi-directionals
		dplus ,
		dminus
		) ;

//**************************************************************************************
// Define Parameters (optional)
//**************************************************************************************


//**************************************************************************************
// Port Declarations
//**************************************************************************************

	input
		usb_dp_high, usb_d_low_n, usb_vbus_on, tb_is_device,
		tb_is_disconnect ; 
	output
		usb_id, usb_sess_vld, bb_device, bb_is_disconnect ;
	inout
		dplus, dminus ;

//**************************************************************************************
// Net Assignments and Declarations
//**************************************************************************************

	reg	bb_slave, cbl_connect ;
	wire	slave, connect ;
	pullup(usb_d_low_n) ;
	pulldown(usb_dp_high) ;

//**************************************************************************************
// Pre-Defined Module Instantiations
//**************************************************************************************

// Not Applicable

//**************************************************************************************
// Gate and Structural Declarations
//**************************************************************************************

	//*** the ipc environment needs to set the bb_slave register and
	//	cbl_connect register to configure the termination block
	//	these registers can be written whenever the OTG mode changes
	//	or the cable is connected/disconnected

	//*** define the usb_id, sess_vld outputs

   assign
	slave = bb_slave | ~tb_is_device ,
	connect = cbl_connect ,
	usb_id = ~(connect) | slave ,
	usb_sess_vld = (slave & connect & ~tb_is_disconnect) | (usb_vbus_on & ~slave) ,
	bb_device = slave ,
	bb_is_disconnect = ~connect ;

	//*** define the resistor terminations

	bufif1 (pull1,highz0)
		g1	(dplus,1'b1,usb_dp_high) ;
	bufif0 (highz1,weak0)
		g2	(dplus,1'b0,usb_d_low_n) ,
		g3	(dminus,1'b0,usb_d_low_n) ;

//**************************************************************************************
// Procedural Assignments
//**************************************************************************************

	//*** set initial conditions
	initial
	   begin
		bb_slave <= 1'b1 ;
		cbl_connect <= 1'b1 ;
	   end



//**************************************************************************************
// Task and Function Definitions
//**************************************************************************************

// Not Applicable

//**************************************************************************************
// End of Model
//**************************************************************************************
endmodule // usb_term