3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-15 14:11:29 +00:00

Optimize Const::hash_into to hash packed bits efficiently

This commit is contained in:
Robert O'Callahan 2025-08-29 03:48:16 +00:00
parent 7814aa0c31
commit c2ad2a407a
3 changed files with 47 additions and 6 deletions

View file

@ -222,6 +222,18 @@ namespace RTLIL {
EXPECT_NE(Const(v1), Const("a"));
}
static Hasher::hash_t hash(const Const &c) {
Hasher h;
h = c.hash_into(h);
return h.yield();
}
TEST_F(KernelRtlilTest, ConstEqualHashStrBits) {
std::vector<State> v1 = {S0, S0, S0, S0, S0, S1, S0, S0};
EXPECT_EQ(hash(Const(v1)), hash(Const(" ")));
EXPECT_NE(hash(Const(v1)), hash(Const("a")));
}
class WireRtlVsHdlIndexConversionTest :
public KernelRtlilTest,
public testing::WithParamInterface<std::tuple<bool, int, int>>