kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #14785
Re: Blind/buried via creation in P&S router [PATCH]
Looks like the issue I mentioned previously is indeed a bug. The
attached patch fixes it and provides full support for
blind/buried/microvias in GAL.
On Sun, 2014-09-21 at 19:27 -0400, Andrew Zonenberg wrote:
> Question for Orson or anybody else who knows PNS internals well.
>
> PNS_ROUTING_SETTINGS::SetLayerPair() currently sets m_layerTop to always
> be > m_layerBottom, which is the opposite of how it's done elsewhere in
> pcbnew. Is this a bug or intended behavior?
>
> On Sun, 2014-09-21 at 16:00 -0400, Andrew Zonenberg wrote:
> > So I'm starting to work on adding full blind/buried/micro via support to
> > the P&S router. My previous patches allow the router to correctly
> > shove/avoid special vias but not create them.
> >
> > As of now I have hotkeys created in the tool framework for instantiating
> > blind/buried vias, along with adding a via-type field to PNS_LINE_PLACER
> > so it knows what type of via it should be creating.
> >
> > There's still a few more things I need to fix before I'll have a patch.
> >
> > 1) Right now PNS_LINE_PLACER only stores the current layer, not the
> > layer pair. The existing code hard-codes (0, MAX_CU_LAYERS - 1) all over
> > the place, which needs to get fixed.
> >
> > 2) My current code doesn't check if blind/buried/microvias are allowed
> > by global settings.
> >
> > I should have a patch ready to submit in a day or so, depending on how
> > much time I spend cleaning up the lab and doing homework/thesis stuff
> > instead of kicad ;)
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
--
Andrew Zonenberg
PhD student, security group
Computer Science Department
Rensselaer Polytechnic Institute
http://colossus.cs.rpi.edu/~azonenberg/
=== modified file 'pcbnew/router/pns_line_placer.cpp'
--- pcbnew/router/pns_line_placer.cpp 2014-07-09 14:50:31 +0000
+++ pcbnew/router/pns_line_placer.cpp 2014-09-22 00:09:13 +0000
@@ -60,11 +60,12 @@
}
-void PNS_LINE_PLACER::AddVia( bool aEnabled, int aDiameter, int aDrill )
+void PNS_LINE_PLACER::AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType )
{
m_viaDiameter = aDiameter;
m_viaDrill = aDrill;
m_placingVia = aEnabled;
+ m_viaType = aType;
}
@@ -73,7 +74,7 @@
assert( m_world != NULL );
m_direction = m_initial_direction;
- TRACE( 1, "world %p, intitial-direction %s layer %d\n",
+ TRACE( 1, "world %p, initial-direction %s layer %d\n",
m_world % m_direction.Format().c_str() % aLayer );
m_head.SetNet( aNet );
m_tail.SetNet( aNet );
@@ -379,8 +380,8 @@
if( !m_placingVia )
return true;
- PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
- PNS_VIA v( aHead.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill, aHead.Net() );
+ PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
+ PNS_VIA v( aHead.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, aHead.Net(), m_viaType );
VECTOR2I force;
VECTOR2I lead = aHead.CPoint( -1 ) - aHead.CPoint( 0 );
@@ -439,8 +440,8 @@
}
else if( m_placingVia && viaOk )
{
- PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
- PNS_VIA v1( walkFull.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
+ PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
+ PNS_VIA v1( walkFull.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
walkFull.AppendVia( v1 );
}
@@ -464,8 +465,8 @@
if( m_placingVia )
{
- PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
- PNS_VIA v1( m_head.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
+ PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
+ PNS_VIA v1( m_head.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
m_head.AppendVia( v1 );
}
@@ -507,9 +508,9 @@
if( m_placingVia )
{
- PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
- PNS_VIA v1( l.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
- PNS_VIA v2( l2.CPoint( -1 ), allLayers, m_viaDiameter, m_viaDrill );
+ PNS_LAYERSET layers( Settings().GetLayerTop(), Settings().GetLayerBottom() );
+ PNS_VIA v1( l.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
+ PNS_VIA v2( l2.CPoint( -1 ), layers, m_viaDiameter, m_viaDrill, -1, m_viaType );
l.AppendVia( v1 );
l2.AppendVia( v2 );
=== modified file 'pcbnew/router/pns_line_placer.h'
--- pcbnew/router/pns_line_placer.h 2014-07-09 14:50:31 +0000
+++ pcbnew/router/pns_line_placer.h 2014-09-21 19:50:13 +0000
@@ -84,8 +84,9 @@
* @param aEnabled if true, a via is attached during placement
* @param aDiameter diameter of the via
* @param aDrill drill of the via
+ * @param aType Type of the via
*/
- void AddVia( bool aEnabled, int aDiameter, int aDrill );
+ void AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType );
/**
* Function SetLayer()
@@ -385,6 +386,9 @@
///> current via drill
int m_viaDrill;
+
+ ///> current via type
+ VIATYPE_T m_viaType;
///> current track width
int m_currentWidth;
=== modified file 'pcbnew/router/pns_router.cpp'
--- pcbnew/router/pns_router.cpp 2014-08-13 15:25:54 +0000
+++ pcbnew/router/pns_router.cpp 2014-09-22 00:09:35 +0000
@@ -895,12 +895,32 @@
}
-void PNS_ROUTER::ToggleViaPlacement()
+void PNS_ROUTER::ToggleViaPlacement(VIATYPE_T type)
{
+ const int layercount = m_board->GetDesignSettings().GetCopperLayerCount();
+
+ // Cannot place microvias or blind vias if not allowed (obvious)
+ if( ( type == VIA_BLIND_BURIED ) && ( !m_board->GetDesignSettings().m_BlindBuriedViaAllowed ) )
+ return;
+ if( ( type == VIA_MICROVIA ) && ( !m_board->GetDesignSettings().m_MicroViasAllowed ) )
+ return;
+
+ //Can only place through vias on 2-layer boards
+ if( ( type != VIA_THROUGH ) && ( layercount <= 2 ) )
+ return;
+
+ //Can only place microvias if we're on an outer layer, or directly adjacent to one
+ if( ( type == VIA_MICROVIA ) && ( m_currentLayer > In1_Cu ) && ( m_currentLayer < layercount-2 ) )
+ return;
+
+ //Cannot place blind vias with front/back as the layer pair, this doesn't make sense
+ if( ( type == VIA_BLIND_BURIED ) && ( Settings().GetLayerTop() == F_Cu ) && ( Settings().GetLayerBottom() == B_Cu ) )
+ return;
+
if( m_state == ROUTE_TRACK )
{
m_placingVia = !m_placingVia;
- m_placer->AddVia( m_placingVia, m_settings.GetViaDiameter(), m_settings.GetViaDrill() );
+ m_placer->AddVia( m_placingVia, m_settings.GetViaDiameter(), m_settings.GetViaDrill(), type );
}
}
=== modified file 'pcbnew/router/pns_router.h'
--- pcbnew/router/pns_router.h 2014-07-09 14:50:31 +0000
+++ pcbnew/router/pns_router.h 2014-09-21 18:57:43 +0000
@@ -112,7 +112,7 @@
void SwitchLayer( int layer );
- void ToggleViaPlacement();
+ void ToggleViaPlacement(VIATYPE_T type = VIA_NOT_DEFINED);
int GetCurrentLayer() const;
int GetCurrentNet() const;
=== modified file 'pcbnew/router/pns_routing_settings.h'
--- pcbnew/router/pns_routing_settings.h 2014-07-09 14:50:31 +0000
+++ pcbnew/router/pns_routing_settings.h 2014-09-21 23:26:35 +0000
@@ -129,7 +129,7 @@
void SetLayerPair( int aLayer1, int aLayer2 )
{
- if( aLayer1 > aLayer2 )
+ if( aLayer1 < aLayer2 )
{
m_layerTop = aLayer1;
m_layerBottom = aLayer2;
=== modified file 'pcbnew/router/pns_via.h'
--- pcbnew/router/pns_via.h 2014-07-28 09:32:15 +0000
+++ pcbnew/router/pns_via.h 2014-09-22 00:08:54 +0000
@@ -48,6 +48,13 @@
m_drill = aDrill;
m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 );
m_viaType = aViaType;
+
+ //If we're a through-board via, use all layers regardless of the set passed
+ if( aViaType == VIA_THROUGH )
+ {
+ PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
+ SetLayers( allLayers);
+ }
}
=== modified file 'pcbnew/router/router_tool.cpp'
--- pcbnew/router/router_tool.cpp 2014-08-24 07:05:07 +0000
+++ pcbnew/router/router_tool.cpp 2014-09-21 23:22:33 +0000
@@ -65,6 +65,12 @@
static TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
AS_CONTEXT, 'V',
"Place Through Via", "Adds a through-hole via at the end of currently routed track." );
+static TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia",
+ AS_CONTEXT, 'Z',
+ "Place Blind/Buried Via", "Adds a blind or buried via at the end of currently routed track." );
+static TOOL_ACTION ACT_PlaceMicroVia( "pcbnew.InteractiveRouter.PlaceMicroVia",
+ AS_CONTEXT, 'Q',
+ "Place Microvia", "Adds a microvia at the end of currently routed track." );
static TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackWidth",
AS_CONTEXT, 'W',
"Custom Track Width", "Shows a dialog for changing the track width and via size.");
@@ -209,6 +215,8 @@
// Add( ACT_AutoEndRoute ); // fixme: not implemented yet. Sorry.
Add( ACT_Drag );
Add( ACT_PlaceThroughVia );
+ Add( ACT_PlaceBlindVia );
+ Add( ACT_PlaceMicroVia );
Add( ACT_SwitchPosture );
AppendSeparator();
@@ -574,7 +582,21 @@
{
m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP,
frame->GetScreen()->m_Route_Layer_BOTTOM );
- m_router->ToggleViaPlacement();
+ m_router->ToggleViaPlacement(VIA_THROUGH);
+ m_router->Move( m_endSnapPoint, m_endItem ); // refresh
+ }
+ else if( evt->IsAction( &ACT_PlaceBlindVia ) )
+ {
+ m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP,
+ frame->GetScreen()->m_Route_Layer_BOTTOM );
+ m_router->ToggleViaPlacement(VIA_BLIND_BURIED);
+ m_router->Move( m_endSnapPoint, m_endItem ); // refresh
+ }
+ else if( evt->IsAction( &ACT_PlaceMicroVia ) )
+ {
+ m_router->Settings().SetLayerPair( frame->GetScreen()->m_Route_Layer_TOP,
+ frame->GetScreen()->m_Route_Layer_BOTTOM );
+ m_router->ToggleViaPlacement(VIA_MICROVIA);
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
}
else if( evt->IsAction( &ACT_SwitchPosture ) )
Attachment:
signature.asc
Description: This is a digitally signed message part
Follow ups
References