-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95ee06a
commit fd56cb6
Showing
7 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TEST_FILES := $(TEST_DIR)/dut.sv | ||
TOP_MODULE := dut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package pkg; | ||
|
||
typedef enum logic { | ||
TEST_1, | ||
TEST_2 | ||
} test_t; | ||
|
||
function test_t swap(test_t test); | ||
unique case (test) | ||
TEST_1: return TEST_2; // works with pkg::TEST_1 | ||
TEST_2: return TEST_1; // works with pkg::TEST_2 | ||
endcase | ||
endfunction | ||
|
||
endpackage | ||
|
||
module dut ( | ||
input logic clk, | ||
input pkg::test_t a, | ||
output pkg::test_t b | ||
); | ||
always_comb b = pkg::swap(a); | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source ../yosys_common.tcl | ||
|
||
prep -top \\dut | ||
write_verilog | ||
write_verilog yosys.sv | ||
sim -rstlen 10 -vcd dump.vcd |