mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-12 04:31:29 +00:00
Const::decode_string() doesn't need to call bitvectorize
This commit is contained in:
parent
a57b7dfd2e
commit
9c96e61e9b
2 changed files with 26 additions and 1 deletions
|
@ -542,7 +542,6 @@ std::string RTLIL::Const::decode_string() const
|
||||||
if (auto str = get_if_str())
|
if (auto str = get_if_str())
|
||||||
return *str;
|
return *str;
|
||||||
|
|
||||||
bitvectorize_internal();
|
|
||||||
bitvectype& bv = get_bits();
|
bitvectype& bv = get_bits();
|
||||||
const int n = GetSize(bv);
|
const int n = GetSize(bv);
|
||||||
const int n_over_8 = n / 8;
|
const int n_over_8 = n / 8;
|
||||||
|
|
|
@ -131,6 +131,32 @@ namespace RTLIL {
|
||||||
EXPECT_EQ(c.as_string(), "00000010");
|
EXPECT_EQ(c.as_string(), "00000010");
|
||||||
EXPECT_TRUE(c.is_str());
|
EXPECT_TRUE(c.is_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Const c(" ");
|
||||||
|
EXPECT_TRUE(c.is_str());
|
||||||
|
EXPECT_EQ(c.decode_string(), " ");
|
||||||
|
EXPECT_TRUE(c.is_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Const c(" ");
|
||||||
|
EXPECT_TRUE(c.is_str());
|
||||||
|
EXPECT_EQ(c.decode_string(), " ");
|
||||||
|
EXPECT_TRUE(c.is_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<State> v = {S0, S0, S0, S0, S0, S1, S0, S0};
|
||||||
|
Const c(v);
|
||||||
|
EXPECT_EQ(c.decode_string(), " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<State> v = {S0, S0, S0, S0, S0, S1, S0, Sx};
|
||||||
|
Const c(v);
|
||||||
|
EXPECT_EQ(c.decode_string(), " ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(KernelRtlilTest, ConstConstIteratorWorks) {
|
TEST_F(KernelRtlilTest, ConstConstIteratorWorks) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue