mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-13 21:21:27 +00:00
Make Const::Const(long long) constructor use packed bits internally if possible
This commit is contained in:
parent
31fc0f53e5
commit
e206b059f6
3 changed files with 52 additions and 1 deletions
|
@ -88,6 +88,31 @@ namespace RTLIL {
|
|||
EXPECT_TRUE(cs1.is_bits());
|
||||
}
|
||||
|
||||
{
|
||||
Const c(0x12345678);
|
||||
EXPECT_TRUE(c.is_str());
|
||||
EXPECT_EQ(c.as_int(), 0x12345678);
|
||||
}
|
||||
|
||||
{
|
||||
Const c(0xab, 8);
|
||||
EXPECT_TRUE(c.is_str());
|
||||
EXPECT_EQ(c.as_int(), 0xab);
|
||||
}
|
||||
|
||||
{
|
||||
Const c(0x12345678, 80);
|
||||
EXPECT_TRUE(c.is_str());
|
||||
EXPECT_EQ(c.as_int(), 0x12345678);
|
||||
EXPECT_EQ(c[79], S0);
|
||||
}
|
||||
|
||||
{
|
||||
Const c(-1, 80);
|
||||
EXPECT_TRUE(c.is_str());
|
||||
EXPECT_EQ(c.as_int(), -1);
|
||||
EXPECT_EQ(c[79], S1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(KernelRtlilTest, ConstConstIteratorWorks) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue