pcbnew: added diff pair gap & width to Design Rules dialog & PCB file format.

This commit is contained in:
Tomasz Wlostowski 2016-08-15 17:16:49 +02:00 committed by Maciej Suminski
parent bcf7990bf9
commit e5524832a9
9 changed files with 69 additions and 10 deletions

View File

@ -56,6 +56,8 @@ date
descr descr
die_length die_length
dimension dimension
diff_pair_width
diff_pair_gap
drawings drawings
drill drill
edge edge
@ -206,4 +208,4 @@ zone_45_only
zone_clearance zone_clearance
zone_connect zone_connect
zone_type zone_type
zones zones

View File

@ -44,6 +44,8 @@ const int NETCLASS::DEFAULT_VIA_DRILL = Millimeter2iu( 0.4 );
const int NETCLASS::DEFAULT_UVIA_DIAMETER = Millimeter2iu( 0.3 ); const int NETCLASS::DEFAULT_UVIA_DIAMETER = Millimeter2iu( 0.3 );
const int NETCLASS::DEFAULT_UVIA_DRILL = Millimeter2iu( 0.1 ); const int NETCLASS::DEFAULT_UVIA_DRILL = Millimeter2iu( 0.1 );
const int NETCLASS::DEFAULT_TRACK_WIDTH = Millimeter2iu( 0.25 ); const int NETCLASS::DEFAULT_TRACK_WIDTH = Millimeter2iu( 0.25 );
const int NETCLASS::DEFAULT_DIFF_PAIR_WIDTH = Millimeter2iu( 0.2 );
const int NETCLASS::DEFAULT_DIFF_PAIR_GAP = Millimeter2iu( 0.25 );
NETCLASS::NETCLASS( const wxString& aName ) : NETCLASS::NETCLASS( const wxString& aName ) :
@ -58,6 +60,8 @@ NETCLASS::NETCLASS( const wxString& aName ) :
SetTrackWidth( DEFAULT_TRACK_WIDTH ); SetTrackWidth( DEFAULT_TRACK_WIDTH );
SetViaDiameter( DEFAULT_VIA_DIAMETER ); SetViaDiameter( DEFAULT_VIA_DIAMETER );
SetuViaDiameter( DEFAULT_UVIA_DIAMETER ); SetuViaDiameter( DEFAULT_UVIA_DIAMETER );
SetDiffPairGap( DEFAULT_DIFF_PAIR_GAP );
SetDiffPairWidth( DEFAULT_DIFF_PAIR_WIDTH );
} }
@ -69,6 +73,9 @@ void NETCLASS::SetParams( const NETCLASS& aDefaults )
SetViaDrill( aDefaults.GetViaDrill() ); SetViaDrill( aDefaults.GetViaDrill() );
SetuViaDiameter( aDefaults.GetuViaDiameter() ); SetuViaDiameter( aDefaults.GetuViaDiameter() );
SetuViaDrill( aDefaults.GetuViaDrill() ); SetuViaDrill( aDefaults.GetuViaDrill() );
SetDiffPairWidth( aDefaults.GetDiffPairWidth() );
SetDiffPairGap( aDefaults.GetDiffPairGap() );
} }
@ -257,6 +264,10 @@ void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FMT_IU( GetuViaDiameter() ).c_str() ); aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FMT_IU( GetuViaDiameter() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FMT_IU( GetuViaDrill() ).c_str() ); aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FMT_IU( GetuViaDrill() ).c_str() );
aFormatter->Print( aNestLevel+1, "(diff_pair_gap %s)\n", FMT_IU( GetDiffPairGap() ).c_str() );
aFormatter->Print( aNestLevel+1, "(diff_pair_width %s)\n", FMT_IU( GetDiffPairWidth() ).c_str() );
for( NETCLASS::const_iterator it = begin(); it != end(); ++it ) for( NETCLASS::const_iterator it = begin(); it != end(); ++it )
aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() ); aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() );

View File

@ -59,6 +59,8 @@ private:
static const int DEFAULT_VIA_DIAMETER; static const int DEFAULT_VIA_DIAMETER;
static const int DEFAULT_UVIA_DIAMETER; static const int DEFAULT_UVIA_DIAMETER;
static const int DEFAULT_TRACK_WIDTH; static const int DEFAULT_TRACK_WIDTH;
static const int DEFAULT_DIFF_PAIR_WIDTH;
static const int DEFAULT_DIFF_PAIR_GAP;
protected: protected:
wxString m_Name; ///< Name of the net class wxString m_Name; ///< Name of the net class
@ -79,6 +81,9 @@ protected:
int m_uViaDia; ///< microvia diameter int m_uViaDia; ///< microvia diameter
int m_uViaDrill; ///< microvia drill hole diameter int m_uViaDrill; ///< microvia drill hole diameter
int m_diffPairWidth;
int m_diffPairGap;
public: public:
static const wxChar Default[]; ///< the name of the default NETCLASS static const wxChar Default[]; ///< the name of the default NETCLASS
@ -179,6 +184,12 @@ public:
int GetuViaDrill() const { return m_uViaDrill; } int GetuViaDrill() const { return m_uViaDrill; }
void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; } void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; }
int GetDiffPairWidth() const { return m_diffPairWidth; }
void SetDiffPairWidth( int aSize ) { m_diffPairWidth = aSize; }
int GetDiffPairGap() const { return m_diffPairGap; }
void SetDiffPairGap( int aSize ) { m_diffPairGap = aSize; }
/** /**
* Function SetParams * Function SetParams
* will set all the parameters by copying them from \a defaults. * will set all the parameters by copying them from \a defaults.

View File

@ -58,7 +58,9 @@ enum {
GRID_VIASIZE, GRID_VIASIZE,
GRID_VIADRILL, GRID_VIADRILL,
GRID_uVIASIZE, GRID_uVIASIZE,
GRID_uVIADRILL GRID_uVIADRILL,
GRID_DIFF_PAIR_WIDTH,
GRID_DIFF_PAIR_GAP
}; };
const wxString DIALOG_DESIGN_RULES::wildCard = _( "* (Any)" ); const wxString DIALOG_DESIGN_RULES::wildCard = _( "* (Any)" );
@ -450,6 +452,13 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASSPTR nc )
msg = StringFromValue( g_UserUnit, nc->GetuViaDrill() ); msg = StringFromValue( g_UserUnit, nc->GetuViaDrill() );
grid->SetCellValue( row, GRID_uVIADRILL, msg ); grid->SetCellValue( row, GRID_uVIADRILL, msg );
msg = StringFromValue( g_UserUnit, nc->GetDiffPairGap() );
grid->SetCellValue( row, GRID_DIFF_PAIR_GAP, msg );
msg = StringFromValue( g_UserUnit, nc->GetDiffPairWidth() );
grid->SetCellValue( row, GRID_DIFF_PAIR_WIDTH, msg );
} }
@ -489,6 +498,9 @@ static void gridRow2class( wxGrid* grid, int row, NETCLASSPTR nc )
nc->SetViaDrill( MYCELL( GRID_VIADRILL ) ); nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) ); nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) ); nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
} }
@ -924,6 +936,18 @@ bool DIALOG_DESIGN_RULES::TestDataValidity( wxString* aErrorMsg )
errorMsg += msg; errorMsg += msg;
} }
int dpsize = ValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_DIFF_PAIR_WIDTH ) );
if( dpsize < minTrackWidth )
{
result = false;
msg.Printf( _( "%s: <b>Differential Pair Size</b> &lt; <b>Min Track Size</b><br>" ),
GetChars( m_grid->GetRowLabelValue( row ) ) );
errorMsg += msg;
}
// Test vias // Test vias
int viadia = ValueFromString( g_UserUnit, int viadia = ValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIASIZE ) ); m_grid->GetCellValue( row, GRID_VIASIZE ) );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 23 2015) // C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -29,7 +29,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_grid = new wxGrid( sbSizerUpper->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxTAB_TRAVERSAL|wxVSCROLL ); m_grid = new wxGrid( sbSizerUpper->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxSIMPLE_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
// Grid // Grid
m_grid->CreateGrid( 1, 6 ); m_grid->CreateGrid( 1, 8 );
m_grid->EnableEditing( true ); m_grid->EnableEditing( true );
m_grid->EnableGridLines( true ); m_grid->EnableGridLines( true );
m_grid->EnableDragGridSize( false ); m_grid->EnableDragGridSize( false );
@ -51,6 +51,8 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_grid->SetColLabelValue( 3, _("Via Drill") ); m_grid->SetColLabelValue( 3, _("Via Drill") );
m_grid->SetColLabelValue( 4, _("uVia Dia") ); m_grid->SetColLabelValue( 4, _("uVia Dia") );
m_grid->SetColLabelValue( 5, _("uVia Drill") ); m_grid->SetColLabelValue( 5, _("uVia Drill") );
m_grid->SetColLabelValue( 6, _("Diff Pair Width") );
m_grid->SetColLabelValue( 7, _("Diff Pair Gap") );
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows // Rows

View File

@ -298,9 +298,9 @@
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTRE</property> <property name="col_label_horiz_alignment">wxALIGN_CENTRE</property>
<property name="col_label_size">40</property> <property name="col_label_size">40</property>
<property name="col_label_values">&quot;Clearance&quot; &quot;Track Width&quot; &quot;Via Dia&quot; &quot;Via Drill&quot; &quot;uVia Dia&quot; &quot;uVia Drill&quot;</property> <property name="col_label_values">&quot;Clearance&quot; &quot;Track Width&quot; &quot;Via Dia&quot; &quot;Via Drill&quot; &quot;uVia Dia&quot; &quot;uVia Drill&quot; &quot;Diff Pair Width&quot; &quot;Diff Pair Gap&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property> <property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
<property name="cols">6</property> <property name="cols">8</property>
<property name="column_sizes">100,120,84,85,81,90</property> <property name="column_sizes">100,120,84,85,81,90</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 23 2015) // C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -39,8 +39,9 @@ class NETINFO_MAPPING;
/// Current s-expression file format version. 2 was the last legacy format version. /// Current s-expression file format version. 2 was the last legacy format version.
//#define SEXPR_BOARD_FILE_VERSION 3 // first s-expression format, used legacy cu stack //#define SEXPR_BOARD_FILE_VERSION 3 // first s-expression format, used legacy cu stack
#define SEXPR_BOARD_FILE_VERSION 4 // reversed cu stack, changed Inner* to In* in reverse order //#define SEXPR_BOARD_FILE_VERSION 4 // reversed cu stack, changed Inner* to In* in reverse order
// went to 32 Cu layers from 16. // // went to 32 Cu layers from 16.
#define SEXPR_BOARD_FILE_VERSION 5 // differential pair settings per net class
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names #define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
#define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library) #define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library)

View File

@ -1301,13 +1301,21 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
nc->SetuViaDrill( parseBoardUnits( T_uvia_drill ) ); nc->SetuViaDrill( parseBoardUnits( T_uvia_drill ) );
break; break;
case T_diff_pair_width:
nc->SetDiffPairWidth( parseBoardUnits( T_diff_pair_width ) );
break;
case T_diff_pair_gap:
nc->SetDiffPairGap( parseBoardUnits( T_diff_pair_gap ) );
break;
case T_add_net: case T_add_net:
NeedSYMBOLorNUMBER(); NeedSYMBOLorNUMBER();
nc->Add( FromUTF8() ); nc->Add( FromUTF8() );
break; break;
default: default:
Expecting( "clearance, trace_width, via_dia, via_drill, uvia_dia, uvia_drill, or add_net" ); Expecting( "clearance, trace_width, via_dia, via_drill, uvia_dia, uvia_drill, diff_pair_width, diff_pair_gap or add_net" );
} }
NeedRIGHT(); NeedRIGHT();