1 package net.mograsim.logic.model.verilog.model.signals;
3 import net.mograsim.logic.core.types.BitVector;
5 public class Constant extends Signal
7 private final BitVector constant;
9 public Constant(BitVector constant)
11 super(Type.CONSTANT, constant.length());
12 this.constant = constant;
19 if (!constant.isBinary())
20 throw new IllegalArgumentException("Constant is not binary: " + constant);
23 public BitVector getConstant()
29 public String toReferenceVerilogCode()
31 return getWidth() + "'b" + constant.toBitstring();
38 int result = super.hashCode();
39 result = prime * result + ((constant == null) ? 0 : constant.hashCode());
44 public boolean equals(Object obj)
48 if (!super.equals(obj))
50 if (getClass() != obj.getClass())
52 Constant other = (Constant) obj;
55 if (other.constant != null)
57 } else if (!constant.equals(other.constant))