1 package net.mograsim.logic.model.verilog.converter;
3 import java.util.Objects;
5 import net.mograsim.logic.model.model.components.ModelComponent;
6 import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
8 public class PinNameBit
10 private final String name;
11 private final int bit;
13 public PinNameBit(String name, int bit)
15 this.name = Objects.requireNonNull(name);
24 throw new IllegalArgumentException("Bit out of range: " + bit);
27 public String getName()
37 public PinBit toPinBit(ModelComponent pinParent)
39 return new PinBit(pinParent.getPin(name), bit);
42 public PinBit toSubmodelPinBit(SubmodelComponent submodelComponent)
44 return new PinBit(submodelComponent.getSubmodelPin(name), bit);
48 public String toString()
50 return name + "[" + bit + "]";
58 result = prime * result + bit;
59 result = prime * result + ((name == null) ? 0 : name.hashCode());
64 public boolean equals(Object obj)
70 if (getClass() != obj.getClass())
72 PinNameBit other = (PinNameBit) obj;
77 if (other.name != null)
79 } else if (!name.equals(other.name))