Skip to content

Commit

Permalink
WIP: synthesis using yosys-slang
Browse files Browse the repository at this point in the history
  • Loading branch information
phsauter committed Mar 6, 2025
1 parent 68a7836 commit b8f0d6f
Show file tree
Hide file tree
Showing 11 changed files with 531 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ target/xilinx/build
target/xilinx/out
target/xilinx/scripts/add_sources.*
vivado*

# Bender/Yosys generated files
target/yosys/out
24 changes: 12 additions & 12 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ packages:
dependencies:
- common_cells
axi_vga:
revision: 3718b9930f94a9eaad8ee50b4bccc71df0403084
version: 0.1.3
revision: 4d3e70d4f47bb74edc1ab68d99ffc02382e0fb9e
version: 0.1.4
source:
Git: https://github.com/pulp-platform/axi_vga.git
dependencies:
Expand All @@ -85,16 +85,16 @@ packages:
- common_cells
- register_interface
common_cells:
revision: 13f28aa0021fc22c0d01a12d618fda58d2c93239
version: 1.33.0
revision: c27bce39ebb2e6bae52f60960814a2afca7bd4cb
version: 1.37.0
source:
Git: https://github.com/pulp-platform/common_cells.git
dependencies:
- common_verification
- tech_cells_generic
common_verification:
revision: 9c07fa860593b2caabd9b5681740c25fac04b878
version: 0.2.3
revision: fb1885f48ea46164a10568aeff51884389f67ae3
version: 0.2.5
source:
Git: https://github.com/pulp-platform/common_verification.git
dependencies: []
Expand Down Expand Up @@ -169,8 +169,8 @@ packages:
- register_interface
- tech_cells_generic
register_interface:
revision: ae616e5a1ec2b41e72d200e5ab09c65e94aebd3d
version: 0.4.4
revision: 5daa85d164cf6b54ad061ea1e4c6f3624556e467
version: 0.4.5
source:
Git: https://github.com/pulp-platform/register_interface.git
dependencies:
Expand All @@ -187,8 +187,8 @@ packages:
- common_cells
- tech_cells_generic
serial_link:
revision: 5a25f5a71074f1ebb6de7b5280f2b16924bcc666
version: 1.1.1
revision: c55df03a1da06b00e567cf968b1b1a5f40c9f802
version: 1.1.2
source:
Git: https://github.com/pulp-platform/serial_link.git
dependencies:
Expand All @@ -203,8 +203,8 @@ packages:
dependencies:
- common_verification
unbent:
revision: e9c9d5cfb635f2d4668c816ce9235798cfecb297
version: 0.1.6
revision: af0c25ba9eaaefade8688a4a47ced999d4c5255d
version: null
source:
Git: https://github.com/pulp-platform/unbent.git
dependencies:
Expand Down
12 changes: 9 additions & 3 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
axi_llc: { git: "https://github.com/pulp-platform/axi_llc.git", version: 0.2.1 }
axi_riscv_atomics: { git: "https://github.com/pulp-platform/axi_riscv_atomics.git", version: 0.8.2 }
axi_rt: { git: "https://github.com/pulp-platform/axi_rt.git", version: 0.0.0-alpha.9 }
axi_vga: { git: "https://github.com/pulp-platform/axi_vga.git", version: 0.1.3 }
axi_vga: { git: "https://github.com/pulp-platform/axi_vga.git", version: 0.1.4 }
clic: { git: "https://github.com/pulp-platform/clic.git", version: 2.0.0 }
clint: { git: "https://github.com/pulp-platform/clint.git", version: 0.2.0 }
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.33.0 }
Expand All @@ -28,8 +28,8 @@ dependencies:
opentitan_peripherals: { git: "https://github.com/pulp-platform/opentitan_peripherals.git", version: 0.4.0 }
register_interface: { git: "https://github.com/pulp-platform/register_interface.git", version: 0.4.4 }
riscv-dbg: { git: "https://github.com/pulp-platform/riscv-dbg.git", version: 0.8.1 }
serial_link: { git: "https://github.com/pulp-platform/serial_link.git", version: 1.1.1 }
unbent: { git: "https://github.com/pulp-platform/unbent.git", version: 0.1.6 }
serial_link: { git: "https://github.com/pulp-platform/serial_link.git", version: 1.1.2 }
unbent: { git: "https://github.com/pulp-platform/unbent.git", rev: af0c25ba9eaaefade8688a4a47ced999d4c5255d }
dram_rtl_sim: { git: "https://github.com/pulp-platform/dram_rtl_sim.git", version: 0.1.1 }

export_include_dirs:
Expand Down Expand Up @@ -60,3 +60,9 @@ sources:
- target/xilinx/src/dram_wrapper_xilinx.sv
- target/xilinx/src/fan_ctrl.sv
- target/xilinx/src/cheshire_top_xilinx.sv

- target: chs_synthesis
files:
- target/yosys/tc_sram_blackbox.sv
- target/yosys/tc_clk_blackbox.sv
- hw/cheshire_synth_wrapper.sv
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2024 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Authors:
# - Philippe Sauter <[email protected]>

Check failure on line 7 in docker-compose.yml

View workflow job for this annotation

GitHub Actions / lint-license

FAILED: First comment ended before licence notice

Check failure on line 7 in docker-compose.yml

View workflow job for this annotation

GitHub Actions / lint-license

FAILED: First comment ended before licence notice
services:
oseda:
image: hpretl/iic-osic-tools:2025.01
environment:
- UID=${UID}
- GID=${GID}
user: "${UID}:${GID}"
volumes:
- ./:/fosic/designs/cheshire
stdin_open: true
tty: true
working_dir: /fosic/designs/cheshire
entrypoint: /dockerstartup/scripts/ui_startup.sh
command: --skip bash
135 changes: 135 additions & 0 deletions hw/cheshire_synth_wrapper.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// Copyright 2025 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Authors:
// Philippe Sauter <[email protected]>

package cheshire_synth_wrapper_pkg;

Check warning on line 8 in hw/cheshire_synth_wrapper.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/cheshire_synth_wrapper.sv#L8

Package declaration name must match the file name (ignoring optional "_pkg" file name suffix). declaration: "cheshire_synth_wrapper_pkg" vs. basename(file): "cheshire_synth_wrapper" [Style: file-names] [package-filename]
Raw output
message:"Package declaration name must match the file name (ignoring optional \"_pkg\" file name suffix).  declaration: \"cheshire_synth_wrapper_pkg\" vs. basename(file): \"cheshire_synth_wrapper\" [Style: file-names] [package-filename]"  location:{path:"hw/cheshire_synth_wrapper.sv"  range:{start:{line:8  column:9}}}  severity:WARNING  source:{name:"verible-verilog-lint"  url:"https://github.com/chipsalliance/verible"}
`include "cheshire/typedef.svh"

import cheshire_pkg::*;

// generate the cheshire configuration used here
function automatic cheshire_cfg_t gen_cheshire_cfg();
cheshire_cfg_t ret = DefaultCfg;
// here you would modify the struct to change your configuration
return ret;
endfunction
localparam cheshire_cfg_t Cfg = gen_cheshire_cfg();

`CHESHIRE_TYPEDEF_ALL(, Cfg)
endpackage


module cheshire_synth_wrapper import cheshire_synth_wrapper_pkg::*; import cheshire_pkg::*; #(
parameter type axi_ext_llc_req_t = axi_llc_req_t,
parameter type axi_ext_llc_rsp_t = axi_llc_rsp_t,
parameter type axi_ext_mst_req_t = axi_mst_req_t,
parameter type axi_ext_mst_rsp_t = axi_mst_rsp_t,
parameter type axi_ext_slv_req_t = axi_slv_req_t,
parameter type axi_ext_slv_rsp_t = axi_slv_rsp_t,
parameter type reg_ext_req_t = reg_req_t,
parameter type reg_ext_rsp_t = reg_rsp_t
) (
input logic clk_i,
input logic rst_ni,
input logic test_mode_i,
input logic [1:0] boot_mode_i,
input logic rtc_i,
// JTAG interface
input logic jtag_tck_i,
input logic jtag_trst_ni,
input logic jtag_tms_i,
input logic jtag_tdi_i,
output logic jtag_tdo_o,
output logic jtag_tdo_oe_o,
// UART interface
output logic uart_tx_o,
input logic uart_rx_i,
// UART modem flow control
output logic uart_rts_no,
output logic uart_dtr_no,
input logic uart_cts_ni,
input logic uart_dsr_ni,
input logic uart_dcd_ni,
input logic uart_rin_ni,
// I2C interface
output logic i2c_sda_o,
input logic i2c_sda_i,
output logic i2c_sda_en_o,
output logic i2c_scl_o,
input logic i2c_scl_i,
output logic i2c_scl_en_o,
// GPIO interface
input logic [31:0] gpio_i,
output logic [31:0] gpio_o,
output logic [31:0] gpio_en_o,
// SPI host interface
output logic spih_sck_o,
output logic spih_sck_en_o,
output logic [SpihNumCs-1:0] spih_csb_o,
output logic [SpihNumCs-1:0] spih_csb_en_o,
output logic [ 3:0] spih_sd_o,
output logic [ 3:0] spih_sd_en_o,
input logic [ 3:0] spih_sd_i,
// USB interface
input logic usb_clk_i,
input logic usb_rst_ni,
input logic [UsbNumPorts-1:0] usb_dm_i,
output logic [UsbNumPorts-1:0] usb_dm_o,
output logic [UsbNumPorts-1:0] usb_dm_oe_o,
input logic [UsbNumPorts-1:0] usb_dp_i,
output logic [UsbNumPorts-1:0] usb_dp_o,
output logic [UsbNumPorts-1:0] usb_dp_oe_o,
// VGA interface
output logic vga_hsync_o,
output logic vga_vsync_o,
output logic [Cfg.VgaRedWidth -1:0] vga_red_o,
output logic [Cfg.VgaGreenWidth-1:0] vga_green_o,
output logic [Cfg.VgaBlueWidth -1:0] vga_blue_o,
// Serial link interface
input logic [SlinkNumChan-1:0] slink_rcv_clk_i,
output logic [SlinkNumChan-1:0] slink_rcv_clk_o,
input logic [SlinkNumChan-1:0][SlinkNumLanes-1:0] slink_i,
output logic [SlinkNumChan-1:0][SlinkNumLanes-1:0] slink_o,
// External AXI LLC (DRAM) port
output axi_ext_llc_req_t axi_llc_mst_req_o,
input axi_ext_llc_rsp_t axi_llc_mst_rsp_i,
// External AXI crossbar ports
input axi_ext_mst_req_t [iomsb(Cfg.AxiExtNumMst):0] axi_ext_mst_req_i,
output axi_ext_mst_rsp_t [iomsb(Cfg.AxiExtNumMst):0] axi_ext_mst_rsp_o,
output axi_ext_slv_req_t [iomsb(Cfg.AxiExtNumSlv):0] axi_ext_slv_req_o,
input axi_ext_slv_rsp_t [iomsb(Cfg.AxiExtNumSlv):0] axi_ext_slv_rsp_i,
// External reg demux slaves
output reg_ext_req_t [iomsb(Cfg.RegExtNumSlv):0] reg_ext_slv_req_o,
input reg_ext_rsp_t [iomsb(Cfg.RegExtNumSlv):0] reg_ext_slv_rsp_i,
// Interrupts from and to external targets
input logic [iomsb(Cfg.NumExtInIntrs):0] intr_ext_i,
output logic [iomsb(Cfg.NumExtOutIntrTgts):0][iomsb(Cfg.NumExtOutIntrs):0] intr_ext_o,
// Interrupt requests to external harts
output logic [iomsb(NumIrqCtxts*Cfg.NumExtIrqHarts):0] xeip_ext_o,
output logic [iomsb(Cfg.NumExtIrqHarts):0] mtip_ext_o,
output logic [iomsb(Cfg.NumExtIrqHarts):0] msip_ext_o,
// Debug interface to external harts
output logic dbg_active_o,
output logic [iomsb(Cfg.NumExtDbgHarts):0] dbg_ext_req_o,
input logic [iomsb(Cfg.NumExtDbgHarts):0] dbg_ext_unavail_i
);

cheshire_soc #(
.Cfg ( Cfg ),
.ExtHartinfo ( '0 ),
.axi_ext_llc_req_t ( axi_llc_req_t ),
.axi_ext_llc_rsp_t ( axi_llc_rsp_t ),
.axi_ext_mst_req_t ( axi_mst_req_t ),
.axi_ext_mst_rsp_t ( axi_mst_rsp_t ),
.axi_ext_slv_req_t ( axi_slv_req_t ),
.axi_ext_slv_rsp_t ( axi_slv_rsp_t ),
.reg_ext_req_t ( reg_req_t ),
.reg_ext_rsp_t ( reg_rsp_t )
) i_cheshire_soc (
.*
);

endmodule
16 changes: 16 additions & 0 deletions start_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
# Copyright (c) 2025 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Authors:
# - Philippe Sauter <[email protected]>

Check failure on line 8 in start_linux.sh

View workflow job for this annotation

GitHub Actions / lint-license

FAILED: First comment ended before licence notice

Check failure on line 8 in start_linux.sh

View workflow job for this annotation

GitHub Actions / lint-license

FAILED: First comment ended before licence notice
export UID=$(id -u)
export GID=$(id -g)

docker compose pull
docker compose run \
-e PS1="\[\033[01;32m\]oseda: \[\033[00m\]\[\033[01;34m\]\w\[\033[00m\] $" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
oseda
18 changes: 18 additions & 0 deletions target/yosys/synthesis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Copyright (c) 2025 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Authors:
# - Philippe Sauter <[email protected]>

Check failure on line 8 in target/yosys/synthesis.sh

View workflow job for this annotation

GitHub Actions / lint-license

FAILED: First comment ended before licence notice

Check failure on line 8 in target/yosys/synthesis.sh

View workflow job for this annotation

GitHub Actions / lint-license

FAILED: First comment ended before licence notice
SCRIPTDIR="$(realpath $(dirname "${BASH_SOURCE[0]}"))"
CHS_BENDER_RTL_FLAGS=${CHS_BENDER_RTL_FLAGS:--t rtl -t cva6 -t cv64a6_imafdcsclic_sv39}
BENDER_TARGETS="-t chs_synthesis -t asic $CHS_BENDER_RTL_FLAGS"
BENDER_DEFINES="-D SYNTHESIS -D COMMON_CELLS_ASSERTS_OFF"

cd $SCRIPTDIR
mkdir -p out
bender script flist-plus $BENDER_TARGETS $BENDER_DEFINES > out/cheshire.f

yosys -s yosys.ys
Loading

0 comments on commit b8f0d6f

Please sign in to comment.