public static int Normalize(int value, int bitWidth) { bitWidth = BasePin.CheckBitWidth(bitWidth); if (bitWidth < 32) { return(value & ((1 << bitWidth) - 1)); } return(value); }
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); }
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)); }
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); }
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); }
public LogicalJamItem(BasePin pin, CircuitGlyph symbol, Jam innerJam) : base(pin, symbol) { Tracer.Assert(innerJam != null && innerJam.CircuitSymbol.LogicalCircuit == symbol.Circuit); this.innerJam = innerJam; }
public JamItem(BasePin pin, CircuitGlyph symbol) { Tracer.Assert(pin.Circuit == symbol.Circuit); this.Pin = pin; this.CircuitSymbol = symbol; }