mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-14 11:15:40 +00:00
Tescases for Width Limit, Resize and Overflow
This commit is contained in:
parent
eb4e29810e
commit
086c50763d
4 changed files with 40 additions and 0 deletions
6
tests/rtlil/bug1206_memory.ys
Normal file
6
tests/rtlil/bug1206_memory.ys
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
logger -expect error "Memory width .* out of range" 1
|
||||
read_rtlil <<EOT
|
||||
module \foo
|
||||
memory width 1073741824 \mem
|
||||
end
|
||||
EOT
|
||||
6
tests/rtlil/bug1206_memory_overflow.ys
Normal file
6
tests/rtlil/bug1206_memory_overflow.ys
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
logger -expect error "Memory width .* out of range" 1
|
||||
read_rtlil <<EOT
|
||||
module \foo
|
||||
memory width 4294967396 \mem
|
||||
end
|
||||
EOT
|
||||
6
tests/rtlil/bug1206_overflow.ys
Normal file
6
tests/rtlil/bug1206_overflow.ys
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
logger -expect error "Wire width .* out of range" 1
|
||||
read_rtlil <<EOT
|
||||
module \foo
|
||||
wire width 4294967396 \bar
|
||||
end
|
||||
EOT
|
||||
|
|
@ -284,6 +284,28 @@ namespace RTLIL {
|
|||
EXPECT_EQ(c, Const(0xe, 4));
|
||||
}
|
||||
|
||||
TEST_F(KernelRtlilTest, ConstResizeWidthLimit) {
|
||||
Const c;
|
||||
EXPECT_DEATH(c.resize(RTLIL::WIDTH_LIMIT, Sx), "");
|
||||
EXPECT_NO_FATAL_FAILURE(c.resize(RTLIL::WIDTH_LIMIT - 1, Sx));
|
||||
}
|
||||
|
||||
TEST_F(KernelRtlilTest, ConstFromLongLongWidthLimit) {
|
||||
EXPECT_DEATH(Const(0, RTLIL::WIDTH_LIMIT), "");
|
||||
EXPECT_NO_FATAL_FAILURE(Const(0, RTLIL::WIDTH_LIMIT - 1));
|
||||
}
|
||||
|
||||
TEST_F(KernelRtlilTest, ConstFromStateWidthLimit) {
|
||||
EXPECT_DEATH(Const(Sx, RTLIL::WIDTH_LIMIT), "");
|
||||
EXPECT_NO_FATAL_FAILURE(Const(Sx, RTLIL::WIDTH_LIMIT - 1));
|
||||
}
|
||||
|
||||
TEST_F(KernelRtlilTest, ModuleAddWireWidthLimit) {
|
||||
std::unique_ptr<Module> mod = std::make_unique<Module>();
|
||||
EXPECT_DEATH(mod->addWire(ID(test), RTLIL::WIDTH_LIMIT), "");
|
||||
EXPECT_NO_FATAL_FAILURE(mod->addWire(ID(test), RTLIL::WIDTH_LIMIT - 1));
|
||||
}
|
||||
|
||||
TEST_F(KernelRtlilTest, ConstEqualStr) {
|
||||
EXPECT_EQ(Const("abc"), Const("abc"));
|
||||
EXPECT_NE(Const("abc"), Const("def"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue