-
Notifications
You must be signed in to change notification settings - Fork 4
Add Yosys elaboration support #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ezelioli
wants to merge
1
commit into
master
Choose a base branch
from
ez/yosys
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,19 @@ | ||
# Copyright 2025 ETH Zurich and University of Bologna. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
ROOT := $(shell pwd) | ||
|
||
include yosys/yosys.mk |
This file contains hidden or 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,29 @@ | ||
// Copyright 2025 ETH Zurich and University of Bologna. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
`include "register_interface/typedef.svh" | ||
|
||
package clic_synth_pkg; | ||
|
||
localparam int N_SOURCE = 256; | ||
localparam int SRC_W = $clog2(N_SOURCE); | ||
localparam int INTCTLBITS = 8; | ||
localparam bit SSCLIC = 1; | ||
localparam bit USCLIC = 0; | ||
|
||
`REG_BUS_TYPEDEF_ALL(reg, logic [31:0], logic [31:0], logic [3:0]) | ||
|
||
endpackage |
This file contains hidden or 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,58 @@ | ||
// Copyright 2025 ETH Zurich and University of Bologna. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module clic_synth_wrap | ||
import clic_synth_pkg::*; | ||
( | ||
input logic clk_i, | ||
input logic rst_ni, | ||
input reg_req_t reg_req_i, | ||
output reg_rsp_t reg_rsp_o, | ||
input logic [N_SOURCE-1:0] intr_src_i, | ||
output logic irq_valid_o, | ||
input logic irq_ready_i, | ||
output logic [SRC_W-1:0] irq_id_o, | ||
output logic [7:0] irq_level_o, | ||
output logic irq_shv_o, | ||
output logic [1:0] irq_priv_o, | ||
output logic irq_kill_req_o, | ||
input logic irq_kill_ack_i | ||
); | ||
|
||
clic #( | ||
.reg_req_t ( reg_req_t ), | ||
.reg_rsp_t ( reg_rsp_t ), | ||
.N_SOURCE ( N_SOURCE ), | ||
.INTCTLBITS ( INTCTLBITS ), | ||
.SSCLIC ( SSCLIC ), | ||
.USCLIC ( USCLIC ) | ||
) i_clic ( | ||
.clk_i ( clk_i ), | ||
.rst_ni ( rst_ni ), | ||
.reg_req_i ( reg_req_i ), | ||
.reg_rsp_o ( reg_rsp_o ), | ||
.intr_src_i ( intr_src_i ), | ||
.irq_valid_o ( irq_valid_o ), | ||
.irq_ready_i ( irq_ready_i ), | ||
.irq_id_o ( irq_id_o ), | ||
.irq_level_o ( irq_level_o ), | ||
.irq_shv_o ( irq_shv_o ), | ||
.irq_priv_o ( irq_priv_o ), | ||
.irq_kill_req_o ( irq_kill_req_o ), | ||
.irq_kill_ack_i ( irq_kill_ack_i ) | ||
); | ||
|
||
endmodule |
This file contains hidden or 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,3 @@ | ||
out/ | ||
reports/ | ||
*.flist |
This file contains hidden or 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,32 @@ | ||
# Copyright 2025 ETH Zurich and University of Bologna. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set top_design clic_synth_wrap | ||
|
||
yosys plugin -i slang.so | ||
|
||
yosys read_slang --top ${top_design} -F clic.flist \ | ||
--compat-mode --keep-hierarchy \ | ||
--allow-use-before-declare --ignore-unknown-modules \ | ||
--ignore-assertions -Wno-error=duplicate-definition | ||
|
||
yosys hierarchy -top ${top_design} | ||
yosys check | ||
|
||
yosys tee -q -o "reports/clic_elaborated.rpt" stat | ||
yosys write_verilog -norename -noexpr -attr2comment out/clic_elaborated.v | ||
|
||
exit |
This file contains hidden or 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,37 @@ | ||
# Copyright 2025 ETH Zurich and University of Bologna. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
BENDER ?= bender | ||
YOSYS ?= oseda -2025.03 yosys | ||
|
||
YOSYS_ROOT_DIR ?= $(ROOT)/yosys | ||
YOSYS_OUT_DIR := $(YOSYS_ROOT_DIR)/out | ||
YOSYS_REPORTS_DIR := $(YOSYS_ROOT_DIR)/reports | ||
|
||
$(YOSYS_ROOT_DIR)/clic.flist: Bender.yml | ||
$(BENDER) script flist-plus -t rtl -t synthesis -t asic -t clic_synth_test > $@ | ||
|
||
$(YOSYS_OUT_DIR)/clic_elaborated.v: $(YOSYS_ROOT_DIR)/clic.flist | ||
mkdir -p $(YOSYS_OUT_DIR) $(YOSYS_REPORTS_DIR) | ||
cd $(YOSYS_ROOT_DIR) && $(YOSYS) -C elaborate.tcl | ||
|
||
.PHONY: yosys-elaborate | ||
yosys-elaborate: $(YOSYS_OUT_DIR)/clic_elaborated.v | ||
@echo "Synthesized CLIC successfully" | ||
|
||
.PHONY: yosys-clean | ||
yosys-clean: | ||
rm -rf $(YOSYS_OUT_DIR) $(YOSYS_REPORTS_DIR) $(YOSYS_ROOT_DIR)/clic.flist |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this target needs to be phony?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it because it's not a file created by make?