diff --git a/kernel/drivertools.cc b/kernel/drivertools.cc index 9627a467015..31e3c98ffbf 100644 --- a/kernel/drivertools.cc +++ b/kernel/drivertools.cc @@ -21,6 +21,30 @@ YOSYS_NAMESPACE_BEGIN +DriveBitWire::DriveBitWire(Wire *wire, int offset) : wire(wire), offset(offset) {} + +bool DriveBitWire::operator==(const DriveBitWire &other) const +{ + return wire == other.wire && offset == other.offset; +} + +bool DriveBitWire::operator<(const DriveBitWire &other) const +{ + if (wire != other.wire) + return wire->name < other.wire->name; + return offset < other.offset; +} + +unsigned int DriveBitWire::hash() const +{ + return mkhash_add(wire->name.hash(), offset); +} + +DriveBitWire::operator SigBit() const +{ + return SigBit(wire, offset); +} + DriveBit::DriveBit(SigBit const &bit) { if (bit.is_wire()) diff --git a/kernel/drivertools.h b/kernel/drivertools.h index 065431fa491..5930101b795 100644 --- a/kernel/drivertools.h +++ b/kernel/drivertools.h @@ -57,32 +57,18 @@ enum class DriveType : unsigned char struct DriveBitWire { - Wire *wire; - int offset; + Wire *wire; + int offset; - DriveBitWire(Wire *wire, int offset) : wire(wire), offset(offset) {} + DriveBitWire(Wire *wire, int offset); - bool operator==(const DriveBitWire &other) const - { - return wire == other.wire && offset == other.offset; - } + bool operator==(const DriveBitWire &other) const; - bool operator<(const DriveBitWire &other) const - { - if (wire != other.wire) - return wire->name < other.wire->name; - return offset < other.offset; - } + bool operator<(const DriveBitWire &other) const; - unsigned int hash() const - { - return mkhash_add(wire->name.hash(), offset); - } + unsigned int hash() const; - operator SigBit() const - { - return SigBit(wire, offset); - } + operator SigBit() const; }; struct DriveBitPort