Skip to content

[prim] Remove primgen and replace with virtual cores #23555

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

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bafed35
[ralgen] Specified position ralgen files should be inserted.
HU90m Nov 25, 2024
7afa465
[python] Update FuseSoC to 2.4.3
HU90m Apr 15, 2025
cb7e9af
[prim] Replace primgen with virtual prim cores
HU90m Nov 22, 2024
5daabf5
[dv] Retarget forced signal for prim_sparse_fsm_flop_if
a-will Jun 14, 2024
1671c0d
[fpga,sim_verilator] Adjust paths for new fusesoc
HU90m Nov 25, 2024
1eb169c
[prim] Rename all files to match virtual cores
a-will Jun 15, 2024
8756abc
[otbn,sim] Adjust Verilator public module config for prims
a-will Dec 9, 2024
a9e685a
[flash_ctrl] Fix lint error for size member
a-will Dec 10, 2024
77f6c57
[dv/hmac] Adjust paths for fusesoc update
HU90m Dec 4, 2024
9408e98
[fpga] Adjust output paths for new fusesoc
HU90m Dec 2, 2024
2bd6e3c
[flash_ctrl] Set explicit width to fix lint error
HU90m Apr 15, 2025
538df97
[hw,ast] Fix the lint waiver
HU90m Apr 15, 2025
a19d4d2
[hw] Removed references to non virtual primitive cores.
HU90m Dec 10, 2024
b3c6ed5
[prim/lint] Update file names ascent lint waivers
HU90m Dec 17, 2024
c328336
[dvsim] Adjust search path for ascent lint parser
HU90m Dec 17, 2024
f2b10d0
[ipgen] Fix missing deps for various reg tops
a-will Dec 18, 2024
c1d87e1
[prim_generic] Leave macros out of prim_generic:all
a-will Jan 30, 2025
f8d40a8
[prim_xilinx] Add missing dependency to prim_ram_1p_pkg
a-will Jan 31, 2025
5ac0f82
[prim_xilinx*] Leave macros out of prim_generic:all
HU90m Apr 16, 2025
ce28a47
[prim_xilinx*] Add usb_diff_rx to all fileset
HU90m Apr 16, 2025
6bfe2ce
[prims] Added mappings for each of the primitives
HU90m Apr 16, 2025
6590212
[dvsim] Use the mapping from prim_generic:all in common sim cfg
HU90m Jan 31, 2025
d32cc4d
[otbn] Remove dependency on prim_generic:all
a-will Jan 31, 2025
f9a8b90
[earlgrey,englishbreakfast] Fix up paths
a-will Feb 1, 2025
d75dc71
[hw,darjeeling] Removed empty file list from chip sim
HU90m Apr 30, 2025
147d1a3
[hw,pwrmgr] Add conditional lc_ctrl_pkg dependency to pwrmgr_pkg
HU90m Apr 30, 2025
8948ae9
[chip_darjeeling_asic.core] Add missing non-partner `scan_role_pkg`
andreaskurth May 1, 2025
6e0c1ce
[top_darjeeling/dv] Fix hierarchical paths to mem and otp
andreaskurth May 1, 2025
d7acec1
[dvsim] Map prims to prim_generic for linting
andreaskurth May 1, 2025
a1b1362
Revert "[dvsim] Map prims to prim_generic for linting"
HU90m May 11, 2025
ed9ef0f
[dvsim] Map prims to prim_generic for linting
HU90m May 11, 2025
a5a8a0b
[top_earlgrey] Added mappings for top specific virtual ips and constants
HU90m May 11, 2025
895a29b
[dvsim] Use earlgrey mappings for linting
HU90m May 11, 2025
ef7950d
[otp_macro] Clean up straggling core
HU90m May 11, 2025
93dc618
[bazel,fusesoc] A temporary fix for fusesoc caching error
HU90m May 11, 2025
a09cbc7
[top_darjeeling] Added mappings for top specific virtual ips and cons…
HU90m May 13, 2025
417d599
[dvsim] Added `additional_fusesoc_argment` to lint configuration.
HU90m May 13, 2025
23b6b2d
[top_earlgrey,lint] Added Earl Grey specific mappings to the lints
HU90m May 13, 2025
9c94224
[top_darjeeling,lint] Added darjeeling specific mappings to the lints
HU90m May 13, 2025
ec22481
[earlgrey,dv] Remove lowrisc:dv:chip_sim virtual
HU90m May 13, 2025
22fc03b
[prim_xilinx] Switch to xilinx specific rom implementation in `:all`
HU90m May 14, 2025
23ba6cf
[prim_generic] Include `flop_no_rst` to `:all` core file
HU90m May 14, 2025
5c8362f
[dv,otp_macro] otp_macro_env was missing it's dependency on cip_lib
HU90m May 14, 2025
61d4312
[prim_xilinx] Renamed rom prim's module name to conform to interface
HU90m May 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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

Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, this commit is all to do with the change to the new FuseSoc version. Again, maybe we need to squash with that commit so that (we think) everything works at each commit?

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"],
Copy link
Contributor

Choose a reason for hiding this comment

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

When did these pathnames change? Are they wrong on master already? (if so, maybe we could split this out into a separate PR?)

},
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);
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid having a "known broken state" in the history, should this commit be merged with the switch to virtual prim cores?


// This signal only has to be forced if the associated parameter
// CustomForceName in prim_sparse_fsm_flop is set to a non-empty string.
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"]

// 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
1 change: 1 addition & 0 deletions hw/ip/adc_ctrl/dv/env/adc_ctrl_env.core
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ generate:
parameters:
name: adc_ctrl
ip_hjson: ../../data/adc_ctrl.hjson
position: prepend

targets:
default:
Expand Down
Loading
Loading