Skip to content
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

Merge dev-integrate -> main #255

Merged
merged 24 commits into from
Oct 25, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f34255e
Merge pull request #241 from chipsalliance/main
calebofearth Oct 5, 2023
147774f
Explicitly define the one-hot cases for csrng_reg_top and (#247)
howardtr Oct 13, 2023
4834f1c
Merged PR 127071: UVM validation FW fix - check/clear error interrupt…
calebofearth Oct 2, 2023
e92adc5
Merged PR 127106: Fix rd_data cg instantiation
upadhyayulakiran Oct 3, 2023
bac4890
Merged PR 127097: More fixes to coverage merging
Nitsirks Oct 3, 2023
677aea2
Merged PR 127448: MSFT sync: Manual file-copy from GH dev-integrate t…
calebofearth Oct 5, 2023
9faace5
Merged PR 127773: Adding caliptra top tb directed regression to cover…
Nitsirks Oct 6, 2023
94ae9e9
Merged PR 127232: UVM fix for soc_ifc_rand_test deadlock edge case
calebofearth Oct 6, 2023
5b1a68f
Merged PR 127980: Fixing MBOX spurious double ecc error
Nitsirks Oct 6, 2023
94d1a60
Merged PR 128205: UVM regression fix for multi-agent arb issue, force…
calebofearth Oct 9, 2023
9d106cd
Merged PR 127470: Disable timers after first timeout before NMI check
upadhyayulakiran Oct 10, 2023
3d18311
Merged PR 128247: [UVM] Fixes in val env. for several regression fail…
calebofearth Oct 12, 2023
d7c4dcc
Merged PR 128855: [Bug fix] Mailbox rd_valid_f signal rst/init value;…
calebofearth Oct 13, 2023
822092f
Remove integ spec PDF as we migrate to Markdown format
calebofearth Oct 17, 2023
77a85df
README updates:
calebofearth Oct 17, 2023
396e5b9
Formatting
calebofearth Oct 17, 2023
1be2d3d
Formatting
calebofearth Oct 17, 2023
bb8288d
Formatting
calebofearth Oct 17, 2023
7a22a64
Formatting
calebofearth Oct 17, 2023
1b3e919
Formatting
calebofearth Oct 17, 2023
c54c3ec
README: Tool version info
calebofearth Oct 17, 2023
751abe7
Merge pull request #253 from chipsalliance/dev-goog
calebofearth Oct 20, 2023
3fed8d2
Merge pull request #252 from chipsalliance/dev-msft-20231017
calebofearth Oct 20, 2023
28adde5
Merge pull request #254 from chipsalliance/dev-msft
calebofearth Oct 21, 2023
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
44 changes: 35 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and<BR>
limitations under the License.*_<BR>

# **Caliptra Hands-On Guide** #
_*Last Update: 2023/09/06*_
_*Last Update: 2023/10/17*_


## **Tools Used** ##
@@ -37,6 +37,8 @@ Simulation:
- `Version 2021.2.1` of AHB/APB models
- UVM installation
- `Version 1.1d`
- Mentor Graphics UVM-Frameworks
- `2022.3`

Synthesis:
- Synopsys DC
@@ -121,6 +123,9 @@ VF files provide absolute filepaths (prefixed by the `CALIPTRA_ROOT` environment
The "Integration" sub-component contains the top-level fileset for Caliptra. `src/integration/config/compile.yml` defines the required filesets and sub-component dependencies for this build target. All of the files/dependencies are explicitly listed in `src/integration/config/caliptra_top_tb.vf`. Users may compile the entire design using only this VF filelist.<BR>


## **Verilog File Lists** ##
Verilog file lists are generated via VCS and included in the config directory for each unit. New files added to the design should be included in the vf list. They can be included manually or by using VCS to regenerate the vf file. File lists define the compilation sources (including all dependencies) required to build and simulate a given module or testbench, and should be used for simulation, lint, and synthesis.

## **Scripts Description** ##

`demo.rdl`:Sample RDL file<BR>
@@ -142,17 +147,20 @@ The "Integration" sub-component contains the top-level fileset for Caliptra. `sr
1. Setup tools, add to PATH (ensure riscv64-unknown-elf-gcc is also available)
2. Define all environment variables above
- For the initial test run after downloading repository, `iccm_lock` is recommended for TESTNAME
- See [Regression Tests](#Regression-Tests) for information about available tests.
3. Create a run folder for build outputs (and cd to it)
4. [OPTIONAL] By default, this run flow will use the riscv64 toolchain to compile test firmware (according to TESTNAME) into program.hex, iccm.hex, dccm.hex, and mailbox.hex. As a first pass, integrators may alternatively use the pre-built hexfiles for convenience (available for `iccm_lock` test). To do this, copy `iccm_lock.hex` to the run directory and rename to `program.hex`. `dccm.hex` should also be copied to the run directory, as-is. Use `touch iccm.hex mailbox.hex` to create empty hex files, as these are unnecessary for `iccm_lock` test.
5. Invoke `${CALIPTRA_ROOT}/tools/scripts/Makefile` with target 'program.hex' to produce SRAM initialization files from the firmware found in `src/integration/test_suites/${TESTNAME}`
- E.g.: `make -f ${CALIPTRA_ROOT}/tools/scripts/Makefile program.hex`
- NOTE: TESTNAME may also be overridden in the makefile command line invocation, e.g. `make -f ${CALIPTRA_ROOT}/tools/scripts/Makefile TESTNAME=iccm_lock program.hex`
6. Compile complete project using `src/integration/config/caliptra_top_tb.vf` as a compilation target in VCS. When running the `vcs` command to generate simv, users should ensure that `caliptra_top_tb` is explicitly specified as the top-level component in their command to ensure this is the sole "top" that gets simulated.
7. Simulate project with `caliptra_top_tb` as the top target

### Verilator Steps: ###
1. Setup tools, add to PATH (ensure Verilator, GCC, and riscv64-unknown-elf-gcc are available)
2. Define all environment variables above
- For the initial test run after downloading repository, `iccm_lock` is recommended for TESTNAME
- See [Regression Tests](#Regression-Tests) for information about available tests.
3. Create a run folder for build outputs
- Recommended to place run folder under `${CALIPTRA_WORKSPACE}/scratch/$USER/verilator/<date>`
4. [OPTIONAL] By default, this run flow will use the riscv64 toolchain to compile test firmware (according to TESTNAME) into program.hex, iccm.hex, dccm.hex, and mailbox.hex. As a first pass, integrators may alternatively use the pre-built hexfiles for convenience (available for `iccm_lock` test). To do this, copy `iccm_lock.hex` to the run directory and rename to `program.hex`. `dccm.hex` should also be copied to the run directory, as-is. Use `touch iccm.hex mailbox.hex` to create empty hex files, as these are unnecessary for `iccm_lock` test.
@@ -178,20 +186,38 @@ The UVM Framework generation tool was used to create the baseline UVM testbench
**Prerequisites**:<BR>
- QVIP 2021.2.1 for Mentor Graphics (provides the AHB/APB VIP)
- UVM 1.1d installation
- Mentor Graphics UVM-Framework installation

Steps:<BR>
1. Compile UVM 1.1d library
2. Compile the AHB/APB QVIP source
3. Compile the UVMF wrapper for APB/AHB in Caliptra/src/libs/uvmf
4. Compile the `verification_ip` provided for `soc_ifc` found in `Caliptra/src/soc_ifc/uvmf_soc_ifc`
5. Compile the `caliptra_top` testbench found in `Caliptra/src/integration/uvmf_caliptra_top`
6. `Caliptra/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/testbench/hdl_top.sv` is the top-level TB wrapper for the system
7. Select a test to run from the set of tests in `Caliptra/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/tests/src`
8. Provide `+UVM_TESTNAME=<test>` argument to simulation
1. Compile the AHB/APB QVIP source
1. Compile the Mentor Graphics UVM-Frameworks base library
1. Compile the UVMF wrapper for APB/AHB in Caliptra/src/libs/uvmf
1. Compile the `verification_ip` provided for `soc_ifc` found in `Caliptra/src/soc_ifc/uvmf_soc_ifc`
1. Compile the `caliptra_top` testbench found in `Caliptra/src/integration/uvmf_caliptra_top`
1. `Caliptra/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/testbench/hdl_top.sv` is the top-level TB wrapper for the system
1. Compile the validation firmware (as described in [Regression Tests](#Regression-Tests)) that will run on Caliptra's embedded RISC-V core
- The expected output products are `program.hex`, `caliptra_fmc.hex`, `caliptra_rt.hex` and must be placed in the simulation run directory
- `make -f ${CALIPTRA_ROOT}/tools/scripts/Makefile TESTNAME=caliptra_top program.hex`
- `make -f ${CALIPTRA_ROOT}/tools/scripts/Makefile TESTNAME=caliptra_fmc caliptra_fmc.hex`
- `make -f ${CALIPTRA_ROOT}/tools/scripts/Makefile TESTNAME=caliptra_rt caliptra_rt.hex`
1. Select a test to run from the set of tests in `Caliptra/src/integration/uvmf_caliptra_top/uvmf_template_output/project_benches/caliptra_top/tb/tests/src`
1. Provide `+UVM_TESTNAME=<test>` argument to simulation

## **Regression Tests** ##

Only tests from the L0 Regression List should be run.
### Standalone SystemVerilog Testbench Regression ###
Only tests from the L0 Regression List should be run.
The list is defined in the file [L0_regression.yml](https://github.com/chipsalliance/caliptra-rtl/blob/main/src/integration/stimulus/L0_regression.yml)

### UVM Regression ###
The UVM simulation environment for `caliptra_top` uses a special set of validation firmware to generate stimulus as required for the test plan. This firmware suite is found in `src/integration/test_suites` and includes:
- `caliptra_top`: A C-based program that emulates a minimal set of bringup functions similar to the function of the ROM. This C file transitions very early to either a the FMC image or Runtime image based on bringup (reset reason) conditions.
- `caliptra_fmc`: A C-based program that emulates the functionality of the First Mutable Code. In this reduced-functionality validation implementation, the FMC code is a simple intermediary that runs from ICCM and serves to boot the Runtime Firmware.
- `caliptra_rt`: A C-based program that emulates the functionality of the production Runtime code. This program receives and services interrupts, defines a minimal Non-Maskable Interrupt handler, generates FW resets as needed, processes mailbox commands (generated through the UVM validation test plan), and runs some baseline Watchdog Timer testing.

These three programs are designed to be run within the context of a UVM simulation, and will fail to generate meaningful stimulus in the standalone `caliptra_top_tb` test.

## **NOTES** ##

* The internal registers are auto rendered at the [GitHub page](https://chipsalliance.github.io/caliptra-rtl/main/internal-regs)
Binary file removed docs/Caliptra_Integration_Specification.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions src/caliptra_prim/rtl/caliptra_prim_assert.sv
Original file line number Diff line number Diff line change
@@ -49,8 +49,8 @@
// Static assertions for checks inside SV packages. If the conditions is not true, this will
// trigger an error during elaboration.
`define CALIPTRA_ASSERT_STATIC_IN_PACKAGE(__name, __prop) \
function automatic bit assert_static_in_package_``__name(); \
bit unused_bit [((__prop) ? 1 : -1)]; \
function automatic logic assert_static_in_package_``__name(); \
logic unused_bit [((__prop) ? 1 : -1)]; \
unused_bit = '{default: 1'b0}; \
return unused_bit[0]; \
endfunction
36 changes: 18 additions & 18 deletions src/csrng/rtl/csrng_reg_top.sv
Original file line number Diff line number Diff line change
@@ -1947,74 +1947,74 @@ module csrng_reg_top #(
// Read data return
always_comb begin
reg_rdata_next = '0;
unique case (1'b1)
addr_hit[0]: begin
unique case (addr_hit)
17'h00001: begin
reg_rdata_next[0] = intr_state_cs_cmd_req_done_qs;
reg_rdata_next[1] = intr_state_cs_entropy_req_qs;
reg_rdata_next[2] = intr_state_cs_hw_inst_exc_qs;
reg_rdata_next[3] = intr_state_cs_fatal_err_qs;
end

addr_hit[1]: begin
17'h00002: begin
reg_rdata_next[0] = intr_enable_cs_cmd_req_done_qs;
reg_rdata_next[1] = intr_enable_cs_entropy_req_qs;
reg_rdata_next[2] = intr_enable_cs_hw_inst_exc_qs;
reg_rdata_next[3] = intr_enable_cs_fatal_err_qs;
end

addr_hit[2]: begin
17'h00004: begin
reg_rdata_next[0] = '0;
reg_rdata_next[1] = '0;
reg_rdata_next[2] = '0;
reg_rdata_next[3] = '0;
end

addr_hit[3]: begin
17'h00008: begin
reg_rdata_next[0] = '0;
reg_rdata_next[1] = '0;
end

addr_hit[4]: begin
17'h00010: begin
reg_rdata_next[0] = regwen_qs;
end

addr_hit[5]: begin
17'h00020: begin
reg_rdata_next[3:0] = ctrl_enable_qs;
reg_rdata_next[7:4] = ctrl_sw_app_enable_qs;
reg_rdata_next[11:8] = ctrl_read_int_state_qs;
end

addr_hit[6]: begin
17'h00040: begin
reg_rdata_next[31:0] = '0;
end

addr_hit[7]: begin
17'h00080: begin
reg_rdata_next[0] = sw_cmd_sts_cmd_rdy_qs;
reg_rdata_next[1] = sw_cmd_sts_cmd_sts_qs;
end

addr_hit[8]: begin
17'h00100: begin
reg_rdata_next[0] = genbits_vld_genbits_vld_qs;
reg_rdata_next[1] = genbits_vld_genbits_fips_qs;
end

addr_hit[9]: begin
17'h00200: begin
reg_rdata_next[31:0] = genbits_qs;
end

addr_hit[10]: begin
17'h00400: begin
reg_rdata_next[3:0] = int_state_num_qs;
end

addr_hit[11]: begin
17'h00800: begin
reg_rdata_next[31:0] = int_state_val_qs;
end

addr_hit[12]: begin
17'h01000: begin
reg_rdata_next[15:0] = hw_exc_sts_qs;
end

addr_hit[13]: begin
17'h02000: begin
reg_rdata_next[0] = recov_alert_sts_enable_field_alert_qs;
reg_rdata_next[1] = recov_alert_sts_sw_app_enable_field_alert_qs;
reg_rdata_next[2] = recov_alert_sts_read_int_state_field_alert_qs;
@@ -2023,7 +2023,7 @@ module csrng_reg_top #(
reg_rdata_next[13] = recov_alert_sts_cs_main_sm_alert_qs;
end

addr_hit[14]: begin
17'h04000: begin
reg_rdata_next[0] = err_code_sfifo_cmd_err_qs;
reg_rdata_next[1] = err_code_sfifo_genbits_err_qs;
reg_rdata_next[2] = err_code_sfifo_cmdreq_err_qs;
@@ -2052,11 +2052,11 @@ module csrng_reg_top #(
reg_rdata_next[30] = err_code_fifo_state_err_qs;
end

addr_hit[15]: begin
17'h08000: begin
reg_rdata_next[4:0] = err_code_test_qs;
end

addr_hit[16]: begin
17'h10000: begin
reg_rdata_next[7:0] = main_sm_state_qs;
end
endcase
Loading