コード例 #1
0
 private static (Pen NonGatePen, Brush NonGateBrush, Brush GateBrush) SelectSiliconBrush(ILayerCell cell)
 {
     return(cell.IsBaseP()
         ? cell.IsBaseN()
             ? throw new InvalidOperationException("both P and N silicon on single cell")
             : (PPen, PBrush, PGateBrush)
         : cell.IsBaseN()
             ? (NPen, NBrush, NGateBrush)
             : throw new InvalidOperationException("no silicon on cell"));
 }
コード例 #2
0
        private (bool, SiliconLink, SiliconLayerContent) CheckSiliconLink(ILayerCell fromCell, ILayerCell toCell, Side side)
        {
            var fromBase = fromCell.IsBaseN() ? SiliconType.NType : SiliconType.PType;
            var toBase   = toCell.IsBaseN() ? SiliconType.NType : SiliconType.PType;

            if (fromBase != toBase)
            {
                var(p1, p2) = side.GetPerpendicularSides();

                return(toCell.Links[p1].SiliconLink == SiliconLink.BiDirectional &&
                       toCell.Links[p2].SiliconLink == SiliconLink.BiDirectional &&
                       toCell.Links[side].SiliconLink != SiliconLink.BiDirectional &&
                       !toCell.HasVia()
                    ? (true, SiliconLink.Master, toCell.HasGate() ? toCell.Silicon : toBase.ConvertToGate(!side.IsVertical()))
                    : (false, SiliconLink.None, SiliconLayerContent.None));
            }
            else
            {
                return(fromCell.HasGate() || toCell.HasGate()
                    ? (false, SiliconLink.None, SiliconLayerContent.None)
                    : (true, SiliconLink.BiDirectional, toCell.Silicon));
            }
        }