Skip to content

Commit

Permalink
Fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshanlon committed Sep 24, 2023
1 parent efc9937 commit 6b7d194
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/slang/numeric/ConstantValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ struct SLANG_EXPORT ConstantRange {
int32_t left = 0;
int32_t right = 0;

ConstantRange(int32_t left, int32_t right) : left(left), right(right) {}

/// Gets the width of the range, regardless of the order in which
/// the bounds are specified.
bitwidth_t width() const {
Expand Down
4 changes: 2 additions & 2 deletions tools/netlist/include/SplitVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AnalyseVariableReference {
return {multiplierElem * rw, fixedSizeElem};
}

SLANG_ASSERT(0 && "unsupported type for getTypeBitWidth");
SLANG_UNREACHABLE;
}

/// Return the bit width of a slang type, treating unpacked arrays as
Expand Down Expand Up @@ -107,7 +107,7 @@ class AnalyseVariableReference {
return arrayType.range;
}
else {
SLANG_ASSERT(0 && "unexpected array type");
SLANG_UNREACHABLE;
}
}

Expand Down
3 changes: 2 additions & 1 deletion tools/netlist/tests/VariableSelectorsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

#include "NetlistTest.h"
#include "SplitVariables.h"
#include "slang/util/Util.h"
#include <stdexcept>

/// Helper method to extract a variable reference from a netlist and return the
/// bit range associated with it.
ConstantRange getBitRange(Netlist& netlist, std::string_view variableSyntax) {
auto* node = netlist.lookupVariableReference(variableSyntax);
if (node == nullptr) {
throw std::runtime_error(fmt::format("Could not find node {}", variableSyntax));
SLANG_THROW(fmt::format("Could not find node {}", variableSyntax));
}
return AnalyseVariableReference::create(*node).getBitRange();
}
Expand Down

0 comments on commit 6b7d194

Please sign in to comment.