mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-22 07:05:51 +00:00
Bump Yosys to latest
This commit is contained in:
commit
77be4d7be7
153 changed files with 3391 additions and 588 deletions
|
|
@ -14,12 +14,24 @@ EOF
|
|||
select -assert-mod-count 3 =*
|
||||
design -stash read
|
||||
|
||||
# empty design does not raise_error
|
||||
design -reset
|
||||
logger -expect log "'raise_error' attribute not found" 1
|
||||
raise_error
|
||||
logger -check-expected
|
||||
|
||||
# raise_error with int exits with status
|
||||
design -load read
|
||||
bugpoint -suffix error -yosys ../../yosys -command raise_error -expect-return 7
|
||||
select -assert-mod-count 1 =*
|
||||
select -assert-mod-count 1 top
|
||||
|
||||
# raise_error -always still uses 'raise_error' attribute if possible
|
||||
design -load read
|
||||
bugpoint -suffix error -yosys ../../yosys -command "raise_error -always" -expect-return 7
|
||||
select -assert-mod-count 1 =*
|
||||
select -assert-mod-count 1 top
|
||||
|
||||
# raise_error with string prints message and exits with 1
|
||||
design -load read
|
||||
rename top abc
|
||||
|
|
@ -41,3 +53,8 @@ rename top abc
|
|||
bugpoint -suffix error -yosys ../../yosys -command "raise_error -stderr" -err-grep "help me" -expect-return 1
|
||||
select -assert-mod-count 1 =*
|
||||
select -assert-mod-count 1 other
|
||||
|
||||
# empty design can raise_error -always
|
||||
design -reset
|
||||
bugpoint -suffix error -yosys ../../yosys -command "raise_error -always" -grep "ERROR: No 'raise_error' attribute found" -expect-return 1
|
||||
bugpoint -suffix error -yosys ../../yosys -command "raise_error -always -stderr" -err-grep "No 'raise_error' attribute found" -expect-return 1
|
||||
|
|
|
|||
72
tests/unit/kernel/ioTest.cc
Normal file
72
tests/unit/kernel/ioTest.cc
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "kernel/io.h"
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
TEST(KernelStringfTest, integerTruncation)
|
||||
{
|
||||
EXPECT_EQ(stringf("%d", 1LL << 32), "0");
|
||||
EXPECT_EQ(stringf("%u", 1LL << 32), "0");
|
||||
EXPECT_EQ(stringf("%x", 0xff12345678LL), "12345678");
|
||||
EXPECT_EQ(stringf("%hu", 0xff12345678LL), "22136");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, charFormat)
|
||||
{
|
||||
EXPECT_EQ(stringf("%c", 256), std::string_view("\0", 1));
|
||||
EXPECT_EQ(stringf("%c", -1), "\377");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, floatFormat)
|
||||
{
|
||||
EXPECT_EQ(stringf("%g", 1.0), "1");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, intToFloat)
|
||||
{
|
||||
EXPECT_EQ(stringf("%g", 1), "1");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, floatToInt)
|
||||
{
|
||||
EXPECT_EQ(stringf("%d", 1.0), "1");
|
||||
EXPECT_EQ(stringf("%d", -1.6), "-1");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, stringParam)
|
||||
{
|
||||
EXPECT_EQ(stringf("%s", std::string("hello")), "hello");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, stringViewParam)
|
||||
{
|
||||
EXPECT_EQ(stringf("%s", std::string_view("hello")), "hello");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, escapePercent)
|
||||
{
|
||||
EXPECT_EQ(stringf("%%"), "%");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, trailingPercent)
|
||||
{
|
||||
EXPECT_EQ(stringf("%"), "%");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, dynamicWidth)
|
||||
{
|
||||
EXPECT_EQ(stringf("%*s", 8, "hello"), " hello");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, dynamicPrecision)
|
||||
{
|
||||
EXPECT_EQ(stringf("%.*f", 4, 1.0), "1.0000");
|
||||
}
|
||||
|
||||
TEST(KernelStringfTest, dynamicWidthAndPrecision)
|
||||
{
|
||||
EXPECT_EQ(stringf("%*.*f", 8, 4, 1.0), " 1.0000");
|
||||
}
|
||||
|
||||
YOSYS_NAMESPACE_END
|
||||
14
tests/verilog/package_import_separate.sv
Normal file
14
tests/verilog/package_import_separate.sv
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package package_import_separate;
|
||||
|
||||
localparam integer
|
||||
DATAWIDTH = 8,
|
||||
ADDRWIDTH = 4;
|
||||
|
||||
localparam logic [2:0]
|
||||
IDLE = 3'b000,
|
||||
START = 3'b001,
|
||||
DATA = 3'b010,
|
||||
STOP = 3'b100,
|
||||
DONE = 3'b101;
|
||||
|
||||
endpackage
|
||||
5
tests/verilog/package_import_separate.ys
Normal file
5
tests/verilog/package_import_separate.ys
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
read_verilog -sv package_import_separate.sv
|
||||
read_verilog -sv package_import_separate_module.sv
|
||||
hierarchy -check
|
||||
proc
|
||||
opt -full
|
||||
19
tests/verilog/package_import_separate_module.sv
Normal file
19
tests/verilog/package_import_separate_module.sv
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import package_import_separate::*;
|
||||
|
||||
module package_import_separate_module;
|
||||
logic [DATAWIDTH-1:0] data;
|
||||
logic [ADDRWIDTH-1:0] addr;
|
||||
logic [2:0] state;
|
||||
|
||||
always_comb begin
|
||||
case (state)
|
||||
IDLE: data = 8'h00;
|
||||
START: data = 8'h01;
|
||||
DATA: data = 8'h02;
|
||||
STOP: data = 8'h04;
|
||||
DONE: data = 8'h05;
|
||||
default: data = 8'hFF;
|
||||
endcase
|
||||
end
|
||||
|
||||
endmodule
|
||||
Loading…
Add table
Add a link
Reference in a new issue