示例#1
0
 public static int Normalize(int value, int bitWidth)
 {
     bitWidth = BasePin.CheckBitWidth(bitWidth);
     if (bitWidth < 32)
     {
         return(value & ((1 << bitWidth) - 1));
     }
     return(value);
 }
示例#2
0
        public DevicePin Create(Circuit circuit, PinType pinType, int bitWidth)
        {
            PinSide   pinSide = BasePin.DefaultSide((circuit is Pin circuitPin) ? (circuitPin.PinType == PinType.Input ? PinType.Output : PinType.Input) : pinType);
            DevicePin pin     = this.CreateItem(Guid.NewGuid(), circuit, bitWidth, pinType, pinSide, false,
                                                this.UniqueName(BasePin.DefaultName(pinType), circuit),
                                                DevicePinData.NoteField.Field.DefaultValue, DevicePinData.JamNotationField.Field.DefaultValue
                                                );

            pin.Order = this.order++;
            return(pin);
        }
示例#3
0
 private Jam CreateJam(BasePin pin)
 {
     if (pin is Pin)
     {
         LogicalCircuit logicalCircuit = (LogicalCircuit)this.Circuit;
         CircuitSymbol  pinSymbol      = logicalCircuit.CircuitProject.CircuitSymbolSet.SelectByCircuit(pin).First();
         Jam            innerJam       = pinSymbol.Jams().First();
         return(new LogicalJamItem(pin, this, innerJam));
     }
     return(new JamItem(pin, this));
 }
示例#4
0
        public Pin Create(LogicalCircuit logicalCircuit, PinType pinType, int bitWidth)
        {
            Pin pin = this.CreateItem(Guid.NewGuid(), logicalCircuit, bitWidth, pinType,
                                      BasePin.DefaultSide(pinType),
                                      PinData.InvertedField.Field.DefaultValue,
                                      this.UniqueName(BasePin.DefaultName(pinType), logicalCircuit),
                                      PinData.NoteField.Field.DefaultValue,
                                      PinData.JamNotationField.Field.DefaultValue
                                      );

            this.CreateDevicePin(pin);
            return(pin);
        }
示例#5
0
 public Jam Jam(BasePin pin)
 {
     this.Update();
     foreach (List <Jam> list in this.jams)
     {
         foreach (Jam jam in list)
         {
             if (jam.Pin == pin)
             {
                 return(jam);
             }
         }
     }
     return(null);
 }
示例#6
0
 public LogicalJamItem(BasePin pin, CircuitGlyph symbol, Jam innerJam) : base(pin, symbol)
 {
     Tracer.Assert(innerJam != null && innerJam.CircuitSymbol.LogicalCircuit == symbol.Circuit);
     this.innerJam = innerJam;
 }
示例#7
0
 public JamItem(BasePin pin, CircuitGlyph symbol)
 {
     Tracer.Assert(pin.Circuit == symbol.Circuit);
     this.Pin           = pin;
     this.CircuitSymbol = symbol;
 }