@@ -1895,30 +1895,28 @@ ChannelBufProps::ChannelBufProps(unsigned minTrans,
1895
1895
: minTrans(minTrans), maxTrans(maxTrans), minOpaque(minOpaque),
1896
1896
maxOpaque(maxOpaque){};
1897
1897
1898
- std::optional<ChannelBufProps>
1899
- ChannelBufProps::subtractTrans (unsigned numSlots) {
1900
- std::optional<unsigned > newMaxTrans;
1901
- if (maxTrans.has_value ()) {
1902
- if (maxTrans.value () < numSlots)
1903
- return {};
1904
- newMaxTrans = maxTrans.value () - numSlots;
1905
- }
1906
-
1907
- unsigned newMinTrans = minTrans < numSlots ? 0U : minTrans - numSlots;
1908
- return ChannelBufProps (newMinTrans, minTrans, minOpaque, maxOpaque);
1909
- }
1910
-
1911
- std::optional<ChannelBufProps>
1912
- ChannelBufProps::subtractOpaque (unsigned numSlots) {
1913
- std::optional<unsigned > newMaxOpaque;
1914
- if (maxOpaque.has_value ()) {
1915
- if (maxOpaque.value () < numSlots)
1916
- return {};
1917
- newMaxOpaque = maxOpaque.value () - numSlots;
1918
- }
1919
-
1920
- unsigned newMinOpaque = minOpaque < numSlots ? 0U : minOpaque - numSlots;
1921
- return ChannelBufProps (minTrans, maxTrans, newMinOpaque, newMaxOpaque);
1898
+ bool ChannelBufProps::isSatisfiable () const {
1899
+ return (!maxTrans.has_value () || maxTrans.value () > minTrans) &&
1900
+ (!maxOpaque.has_value () || maxOpaque.value () > minOpaque);
1901
+ }
1902
+
1903
+ bool ChannelBufProps::operator ==(const ChannelBufProps &rhs) const {
1904
+ return (this ->minTrans == rhs.minTrans ) && (this ->maxTrans == rhs.maxTrans ) &&
1905
+ (this ->minOpaque == rhs.minOpaque ) &&
1906
+ (this ->maxOpaque == rhs.maxOpaque );
1907
+ }
1908
+
1909
+ std::ostream &operator <<(std::ostream &os, const ChannelBufProps &props) {
1910
+ std::string maxTransStr = props.maxTrans .has_value ()
1911
+ ? (std::to_string (props.maxTrans .value ()) + " ]" )
1912
+ : " inf)" ;
1913
+ std::string maxOpaqueStr =
1914
+ props.maxOpaque .has_value ()
1915
+ ? (std::to_string (props.maxOpaque .value ()) + " ]" )
1916
+ : " inf)" ;
1917
+ os << " T: [" << props.minTrans << " , " << maxTransStr << " , O: ["
1918
+ << props.minOpaque << " , " << maxOpaqueStr;
1919
+ return os;
1922
1920
}
1923
1921
1924
1922
llvm::hash_code dynamatic::hash_value (const ChannelBufProps &props) {
0 commit comments