Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/bitstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,21 @@ jobs:
if: steps.strategy.outputs.bitstreamStrategy != 'cached'
run: |
. util/build_consts.sh

vlnv_path=lowrisc_systems_chip_${{ inputs.top_name }}_${{ inputs.design_suffix }}_0.1
design_name=chip_${{ inputs.top_name }}_${{ inputs.design_suffix }}

echo "Synthesis log"
cat $OBJ_DIR/hw/top_${{ inputs.top_name }}/build.fpga_${{ inputs.design_suffix }}/synth-vivado/lowrisc_systems_chip_${{ inputs.top_name }}_${{ inputs.design_suffix }}_0.1.runs/synth_1/runme.log || true
cat $OBJ_DIR/hw/top_${{ inputs.top_name }}/${design_name}/build.fpga_${{ inputs.design_suffix }}/${vlnv_path}/synth-vivado/${vlnv_path}.runs/synth_1/runme.log || true

echo "Implementation log"
cat $OBJ_DIR/hw/top_${{ inputs.top_name }}/build.fpga_${{ inputs.design_suffix }}/synth-vivado/lowrisc_systems_chip_${{ inputs.top_name }}_${{ inputs.design_suffix }}_0.1.runs/impl_1/runme.log || true
cat $OBJ_DIR/hw/top_${{ inputs.top_name }}/${design_name}/build.fpga_${{ inputs.design_suffix }}/${vlnv_path}/synth-vivado/${vlnv_path}.runs/impl_1/runme.log || true

echo "Utilization report"
cat $OBJ_DIR/hw/top_${{ inputs.top_name }}/${design_name}/build.fpga_${{ inputs.design_suffix }}/${vlnv_path}/synth-vivado/${vlnv_path}.runs/impl_1/${design_name}_utilization_placed.rpt || true

echo "Timing summary report"
cat $OBJ_DIR/hw/top_${{ inputs.top_name }}/${design_name}/build.fpga_${{ inputs.design_suffix }}/${vlnv_path}/synth-vivado/${vlnv_path}.runs/impl_1/${design_name}_timing_summary_routed.rpt || true

- name: Upload step outputs
uses: actions/upload-artifact@v4
Expand Down
39 changes: 36 additions & 3 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion doc/contributing/fpga/ref_manual_fpga.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For example, see the `//hw/bitstream:rom` target defined in [hw/bitstream/BUILD]
There are two prerequisites in order for this flow to work:

* The boot ROM during the build process must be correctly inferred by the tool.
* See [prim_rom](https://github.com/lowRISC/opentitan/blob/master/hw/ip/prim_generic/rtl/prim_generic_rom.sv) and [vivado_hook_opt_design_post.tcl](https://github.com/lowRISC/opentitan/blob/master/hw/top_earlgrey/util/vivado_hook_opt_design_post.tcl).
* See [prim_rom](https://github.com/lowRISC/opentitan/blob/master/hw/ip/prim_generic/rtl/prim_rom.sv) and [vivado_hook_opt_design_post.tcl](https://github.com/lowRISC/opentitan/blob/master/hw/top_earlgrey/util/vivado_hook_opt_design_post.tcl).
* The MMI file outlining the physical boot ROM placement and mapping to FPGA block RAM primitives needs to be generated by the tool.
* See [vivado_hook_write_bitstream_pre.tcl](https://github.com/lowRISC/opentitan/blob/master/hw/top_earlgrey/util/vivado_hook_write_bitstream_pre.tcl).

Expand Down
2 changes: 1 addition & 1 deletion hw/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fusesoc_build(
data = ["//hw/ip/otbn:rtl_files"],
make_options = ":make_options",
output_groups = {
"binary": ["sim-verilator/Vchip_sim_tb"],
"binary": ["lowrisc_dv_top_earlgrey_chip_verilator_sim_0.1/sim-verilator/Vchip_sim_tb"],
},
systems = ["lowrisc:dv:chip_verilator_sim"],
tags = [
Expand Down
24 changes: 13 additions & 11 deletions hw/bitstream/vivado/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ load("//rules:bitstreams.bzl", "bitstream_manifest_fragment")
package(default_visibility = ["//visibility:public"])

# The readmem directives in the fusesoc-ized build tree will be in the subdir
# ${build_root}/src/lowrisc_prim_util_memload_0/rtl/prim_util_memload.svh,
# ${build_root}/${core}/${target}-${tool}/src/lowrisc_prim_util_memload_0/rtl/prim_util_memload.svh,
# and ${build_root} will be a subdirectory called `build.fpga_cw310` inside of
# bazel-out/k8-{configname}/bin/hw/bitstream/vivado.
# Therefore, the relative path between prim_util_memload.svh and the project-root
# relative $(location ...) resolved labels is up 10 subdirectories.
_PREFIX = "../../../../../../../../../.."
_PREFIX = "../../../../../../../../../../.."

_CW310_TESTROM = "//sw/device/lib/testing/test_rom:test_rom_fpga_cw310_scr_vmem"

Expand All @@ -31,6 +31,8 @@ _CW340_TESTROM_PATH = _CW310_TESTROM_PATH

_OTP_RMA_PATH = "{}/$(location {})".format(_PREFIX, _OTP_RMA)

_FPGA_PATH_TMPL = "lowrisc_systems_{}_0.1/synth-vivado/{}"

# Note: all of the targets are tagged with "manual" to prevent them from being
# matched by bazel wildcards like "//...". In order to build the bitstream,
# you need to ask for it directly or by dependency via another rule, such as
Expand All @@ -50,9 +52,9 @@ fusesoc_build(
"--OtpMacroMemInitFile=" + _OTP_RMA_PATH,
],
output_groups = {
"bitstream": ["synth-vivado/lowrisc_systems_chip_earlgrey_cw310_0.1.bit"],
"mmi": ["synth-vivado/memories.mmi"],
"logs": ["synth-vivado/lowrisc_systems_chip_earlgrey_cw310_0.1.runs/"],
"bitstream": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw310", "lowrisc_systems_chip_earlgrey_cw310_0.1.bit")],
"mmi": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw310", "memories.mmi")],
"logs": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw310", "lowrisc_systems_chip_earlgrey_cw310_0.1.runs/")],
},
systems = ["lowrisc:systems:chip_earlgrey_cw310"],
tags = ["manual"],
Expand Down Expand Up @@ -91,9 +93,9 @@ fusesoc_build(
"--OtpMacroMemInitFile=" + _OTP_RMA_PATH,
],
output_groups = {
"bitstream": ["synth-vivado/lowrisc_systems_chip_earlgrey_cw310_hyperdebug_0.1.bit"],
"mmi": ["synth-vivado/memories.mmi"],
"logs": ["synth-vivado/lowrisc_systems_chip_earlgrey_cw310_hyperdebug_0.1.runs/"],
"bitstream": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw310_hyperdebug", "lowrisc_systems_chip_earlgrey_cw310_hyperdebug_0.1.bit")],
"mmi": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw310_hyperdebug", "memories.mmi")],
"logs": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw310_hyperdebug", "lowrisc_systems_chip_earlgrey_cw310_hyperdebug_0.1.runs/")],
},
systems = ["lowrisc:systems:chip_earlgrey_cw310_hyperdebug"],
tags = ["manual"],
Expand Down Expand Up @@ -132,9 +134,9 @@ fusesoc_build(
"--OtpMacroMemInitFile=" + _OTP_RMA_PATH,
],
output_groups = {
"bitstream": ["synth-vivado/lowrisc_systems_chip_earlgrey_cw340_0.1.bit"],
"mmi": ["synth-vivado/memories.mmi"],
"logs": ["synth-vivado/lowrisc_systems_chip_earlgrey_cw340_0.1.runs/"],
"bitstream": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw340", "lowrisc_systems_chip_earlgrey_cw340_0.1.bit")],
"mmi": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw340", "memories.mmi")],
"logs": [_FPGA_PATH_TMPL.format("chip_earlgrey_cw340", "lowrisc_systems_chip_earlgrey_cw340_0.1.runs/")],
},
systems = ["lowrisc:systems:chip_earlgrey_cw340"],
tags = ["manual"],
Expand Down
4 changes: 2 additions & 2 deletions hw/dv/dpi/dpi_sim_cfg.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
build_modes: [
{
name: vcs_dpi_build_opts
build_opts: ["-CFLAGS -I{build_dir}/src/{dpi_common_dir}", "-lutil"]
build_opts: ["-CFLAGS -I{build_dir}/fusesoc-work/src/{dpi_common_dir}", "-lutil"]
}

{
name: xcelium_dpi_build_opts
build_opts: ["-I{build_dir}/src/{dpi_common_dir}", "-lutil"]
build_opts: ["-I{build_dir}/fusesoc-work/src/{dpi_common_dir}", "-lutil"]
}
]
}
2 changes: 1 addition & 1 deletion hw/dv/sv/sec_cm/prim_sparse_fsm_flop_if.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface prim_sparse_fsm_flop_if #(
string msg_id = $sformatf("%m");

string path = dv_utils_pkg::get_parent_hier($sformatf("%m"));
string signal_forced = $sformatf("%s.u_state_flop.q_o", path);
string signal_forced = $sformatf("%s.state_o", path);

// The prim_sparse_fsm_flop module is usually created with the PRIM_FLOP_SPARSE_FSM macro, which
// (when in simulation) passes an extra CustomForceName parameter to control how it should be
Expand Down
3 changes: 3 additions & 0 deletions hw/dv/tools/dvsim/common_sim_cfg.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"{dv_root}/tools/dvsim/bazel.hjson",
"{dv_root}/tools/dvsim/{tool}.hjson"]

sv_flist_gen_flags: ["--flag=fileset_{design_level}",
"--mapping=lowrisc:prim_generic:all:0.1"]

Comment on lines +16 to +18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to set a default mapping here, we should document how to override sv_flist_gen_flags + what is ordinarily set here. I feel iffy about putting prim selection in a generically-named property like this, though. It probably should be called out more specifically.

For dvsim, I think we should document the base configurations and explicitly require fusesoc as a dependency. If there were any hope of somehow abstracting away that dependency, that is gone now, hehe. Downstream user configuration files will explicitly have fusesoc-specific parameters in them.

This can all be done in future PRs.

// Default directory structure for the output
build_dir: "{scratch_path}/{build_mode}"
run_dir_name: "{index}.{test}"
Expand Down
4 changes: 2 additions & 2 deletions hw/dv/tools/dvsim/fusesoc.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"run",
"{sv_flist_gen_flags}",
"--target=sim",
"--build-root={build_dir}",
"--work-root={build_dir}/fusesoc-work",
"--setup {fusesoc_core}"]
fusesoc_cores_root_dirs: ["--cores-root {proj_root}/hw"]
sv_flist_gen_dir: "{build_dir}/sim-vcs"
sv_flist_gen_dir: "{build_dir}/fusesoc-work"
sv_flist: "{sv_flist_gen_dir}/{fusesoc_core_}.scr"
sv_flist_gen_flags: ["--flag=fileset_{design_level}"]
}
2 changes: 1 addition & 1 deletion hw/dv/tools/dvsim/xcelium.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// Ignore warning "Include directory <path> given but not used". This is benign.
"-nowarn SPDUSD",
// Needed for including "secded_enc.h".
"-I{build_dir}/src/lowrisc_dv_secded_enc_0",
"-I{build_dir}/fusesoc-work/src/lowrisc_dv_secded_enc_0",
// This warning is thrown when a scalar enum variable is assigned to an enum array.
// Other tools (e.g., FPV) treat such assignments as an error, hence we bump it to
// an error in simulation so that this can be caught early in CI.
Expand Down
2 changes: 1 addition & 1 deletion hw/dv/verilator/cpp/scrambled_ecc32_mem_area.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ScrambledEcc32MemArea::ScrambledEcc32MemArea(const std::string &scope,
bool repeat_keystream)
: Ecc32MemArea(SVScoped::join_sv_scopes(scope,
"u_prim_ram_1p_adv.gen_ram_inst[0]."
"u_mem.gen_generic.u_impl_generic"),
"u_mem"),
size, width_32),
scr_scope_(scope) {
addr_width_ = vbits(size);
Expand Down
26 changes: 13 additions & 13 deletions hw/dv/verilator/memutil_dpi_scrambled_opts.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@
build_modes: [
{
name: vcs_memutil_dpi_scrambled_build_opts
build_opts: ["-CFLAGS -I{build_dir}/src/{memutil_dpi_src_dir}/cpp",
"-CFLAGS -I{build_dir}/src/{memutil_dpi_scrambled_src_dir}/cpp",
"-CFLAGS -I{build_dir}/src/{secded_enc_src_dir}",
"-CFLAGS -I{build_dir}/src/{scramble_model_dir}",
"-CFLAGS -I{build_dir}/src/{prince_ref_src_dir}",
build_opts: ["-CFLAGS -I{build_dir}/fusesoc-work/src/{memutil_dpi_src_dir}/cpp",
"-CFLAGS -I{build_dir}/fusesoc-work/src/{memutil_dpi_scrambled_src_dir}/cpp",
"-CFLAGS -I{build_dir}/fusesoc-work/src/{secded_enc_src_dir}",
"-CFLAGS -I{build_dir}/fusesoc-work/src/{scramble_model_dir}",
"-CFLAGS -I{build_dir}/fusesoc-work/src/{prince_ref_src_dir}",
"-lelf"]
}

{
name: xcelium_memutil_dpi_scrambled_build_opts
build_opts: ["-I{build_dir}/src/{memutil_dpi_src_dir}/cpp",
"-I{build_dir}/src/{memutil_dpi_scrambled_src_dir}/cpp",
"-I{build_dir}/src/{prince_ref_src_dir}",
"-I{build_dir}/src/{scramble_model_dir}",
build_opts: ["-I{build_dir}/fusesoc-work/src/{memutil_dpi_src_dir}/cpp",
"-I{build_dir}/fusesoc-work/src/{memutil_dpi_scrambled_src_dir}/cpp",
"-I{build_dir}/fusesoc-work/src/{prince_ref_src_dir}",
"-I{build_dir}/fusesoc-work/src/{scramble_model_dir}",
"-lelf"]
}

{
name: dsim_memutil_dpi_scrambled_build_opts
build_opts: ["-c-opts -I{build_dir}/src/{memutil_dpi_src_dir}/cpp",
"-c-opts -I{build_dir}/src/{memutil_dpi_scrambled_src_dir}/cpp",
"-c-opts -I{build_dir}/src/{prince_ref_src_dir}",
"-c-opts -I{build_dir}/src/{scramble_model_dir}",
build_opts: ["-c-opts -I{build_dir}/fusesoc-work/src/{memutil_dpi_src_dir}/cpp",
"-c-opts -I{build_dir}/fusesoc-work/src/{memutil_dpi_scrambled_src_dir}/cpp",
"-c-opts -I{build_dir}/fusesoc-work/src/{prince_ref_src_dir}",
"-c-opts -I{build_dir}/fusesoc-work/src/{scramble_model_dir}",
"-ld-opts -lelf"]
}
]
Expand Down
Loading
Loading