-
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.
Update yosys; rework AST_GENBLOCK's handling (#2502)
This PR updates yosys and adjusts synlig to it: * rework the way, that synlig handles AST_GENBLOCK's, * allow typedefing nested structs and unions inside AST_GENBLOCK's, * add new simple tests, * minor bugfixes.
- Loading branch information
Showing
29 changed files
with
833 additions
and
39 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
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)/top.sv | ||
TOP_MODULE := top |
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,31 @@ | ||
module top(); | ||
if (1) begin : n | ||
typedef enum logic [1:0] { | ||
ALBL, ALBH, AHBL, AHBH | ||
} mult_fsm_e; | ||
mult_fsm_e mult_state_q, mult_state_d; | ||
|
||
logic [1:0] a, b, c; | ||
|
||
always_comb begin | ||
unique case (mult_state_q) | ||
ALBL: begin | ||
a = 0; | ||
c = ALBH; | ||
end | ||
ALBH: begin | ||
a = 1; | ||
c = AHBL; | ||
end | ||
AHBL: begin | ||
a = 2; | ||
c = AHBH; | ||
end | ||
AHBH: begin | ||
a = 3; | ||
c = ALBL; | ||
end | ||
endcase | ||
end | ||
end | ||
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 \\top | ||
write_verilog | ||
write_verilog yosys.sv | ||
sim -rstlen 10 -vcd dump.vcd |
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)/top.sv | ||
TOP_MODULE := top |
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,41 @@ | ||
typedef enum integer { pN = 0, pB = 1, pO = 2, pF = 3 } p_e; | ||
typedef enum logic [6:0] { ALU_N, ALU_B, ALU_H, ALU_BFP } op; | ||
module top #(parameter p_e p = pF) (input op i); | ||
if (p != pN) begin : gen1 | ||
if (p == pO || p == pF) begin : gen2 | ||
logic [7:0][2:0] sel_n; | ||
logic [3:0][1:0] sel_b; | ||
logic [1:0][0:0] sel_h; | ||
|
||
logic [7:0][2:0] sel; | ||
|
||
always_comb begin | ||
unique case (i) | ||
ALU_N: begin | ||
sel = sel_n; | ||
end | ||
|
||
ALU_B: begin | ||
for (int b = 0; b < 4; b++) begin | ||
sel[b*2 + 0] = {sel_b[b], 1'b0}; | ||
sel[b*2 + 1] = {sel_b[b], 1'b1}; | ||
end | ||
end | ||
|
||
ALU_H: begin | ||
for (int h = 0; h < 2; h++) begin | ||
sel[h*4 + 0] = {sel_h[h], 2'b00}; | ||
sel[h*4 + 1] = {sel_h[h], 2'b01}; | ||
sel[h*4 + 2] = {sel_h[h], 2'b10}; | ||
sel[h*4 + 3] = {sel_h[h], 2'b11}; | ||
end | ||
end | ||
|
||
default: begin | ||
sel = sel_n; | ||
end | ||
endcase | ||
end | ||
end | ||
end | ||
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,13 @@ | ||
source ../yosys_common.tcl | ||
|
||
proc_clean | ||
proc_rmdead | ||
proc_prune | ||
proc_init | ||
proc_arst | ||
proc_mux | ||
proc_dff | ||
proc_clean | ||
proc_dlatch | ||
opt | ||
sim -rstlen 10 -vcd dump.vcd |
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)/top.sv | ||
TOP_MODULE := top |
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,13 @@ | ||
module top(); | ||
if (1) begin : n | ||
typedef struct packed { | ||
struct packed { | ||
logic a; | ||
logic b; | ||
} foo; | ||
} bar; | ||
bar x; | ||
end | ||
assign n.x.foo.a = 0; | ||
assign n.x.foo.b = 0; | ||
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 \\top | ||
write_verilog | ||
write_verilog yosys.sv | ||
sim -rstlen 10 -vcd dump.vcd |
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)/top.sv | ||
TOP_MODULE := top |
Oops, something went wrong.