lowRISC / lowRISC/ibex

failed to synthesize RTL with Yosys

Open
#2,260 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Question
Dominant language
SystemVerilog
Stars
2.1k
Forks
810
Avg merge
5d 23h
Merged PRs (30d)
9

Description

I took an error when I run './syn_yosys.sh'

syn_yosys.sh ------------------------------

#!/bin/bash

set -e
set -o pipefail

error () {
echo >&2 "$@"
exit 1
}

teelog () {
tee "$LR_SYNTH_OUT_DIR/log/$1.log"
}

if [ ! -f syn_setup.sh ]; then
error "No syn_setup.sh file: see README.md for instructions"
fi

source syn_setup.sh

LR_DEP_SOURCES=(
"../vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_buf.sv"
"../vendor/lowrisc_ip/ip/prim_generic/rtl/prim_generic_flop.sv"

)

mkdir -p "$LR_SYNTH_OUT_DIR/generated"
mkdir -p "$LR_SYNTH_OUT_DIR/log"
mkdir -p "$LR_SYNTH_OUT_DIR/reports/timing"

for file in "${LR_DEP_SOURCES[@]}"; do
module=$(basename -s .sv "$file")

sv2v \
    --define=SYNTHESIS --define=YOSYS \
    -I../vendor/lowrisc_ip/ip/prim/rtl \
    "$file" \
    > "$LR_SYNTH_OUT_DIR"/generated/"${module}".v

done

for file in ../rtl/*.sv; do
module=$(basename -s .sv "$file")

if echo "$module" | grep -q '_pkg$'; then
continue
fi

sv2v
--define=SYNTHESIS --define=YOSYS
../rtl/*_pkg.sv
../vendor/lowrisc_ip/ip/prim/rtl/prim_ram_1p_pkg.sv
../vendor/lowrisc_ip/ip/prim/rtl/prim_secded_pkg.sv
../vendor/lowrisc_ip/ip/prim/rtl/prim_lfsr.sv
../vendor/lowrisc_ip/ip/prim/rtl/prim_count.sv
../vendor/lowrisc_ip/ip/prim/rtl/prim_count_pkg.sv
-I../vendor/lowrisc_ip/ip/prim/rtl
-I../vendor/lowrisc_ip/dv/sv/dv_utils
"$file"
> "$LR_SYNTH_OUT_DIR"/generated/"${module}".v

sed -i 's/prim_buf/prim_generic_buf/g' "$LR_SYNTH_OUT_DIR"/generated/"${module}".v
sed -i 's/prim_flop/prim_generic_flop/g' "$LR_SYNTH_OUT_DIR"/generated/"${module}".v
done

rm -f "$LR_SYNTH_OUT_DIR"/generated/ibex_tracer.v

rm -f "$LR_SYNTH_OUT_DIR"/generated/ibex_register_file_ff.v
rm -f "$LR_SYNTH_OUT_DIR"/generated/ibex_register_file_fpga.v

yosys -c ./tcl/yosys_run_synth.tcl |& teelog syn || {
error "Failed to synthesize RTL with Yosys"
}

sta ./tcl/sta_run_reports.tcl |& teelog sta || {
error "Failed to run static timing analysis"
}

./translate_timing_rpts.sh

python/get_kge.py "$LR_SYNTH_CELL_LIBRARY_PATH" "$LR_SYNTH_OUT_DIR"/reports/area.rpt


I modified the code for yosys_run_synth.tcl
yosys "read_verilog -sv ./rtl/prim_clock_gating.v $lr_synth_out_dir/generated/*.v" (delete '-defer')


I got this error

  1. Executing Liberty frontend.
    Imported 135 cell types from liberty file.

  2. Executing Verilog-2005 frontend: ./rtl/prim_clock_gating.v
    Parsing SystemVerilog input from ./rtl/prim_clock_gating.v' to AST representation. Generating RTLIL representation for module \prim_clock_gating'.
    Successfully finished Verilog frontend.

  3. Executing Verilog-2005 frontend: syn_out/ibex_05_03_2025_20_43_12/generated/ibex_alu.v
    syn_out/ibex_05_03_2025_20_43_12/generated/ibex_alu.v:47: ERROR: Condition for generate if is not constant!
    Failed to synthesize RTL with Yosys

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with syn_yosys.sh and tcl/yosys_run_synth.tcl, then inspect generated/ibex_alu.v at line 47 and the Yosys generate-if diagnostic. Reproduce with ./syn_yosys.sh and determine why the generated RTL is rejected; done when synthesis completes without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
embedded-iot, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.