You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+81-8Lines changed: 81 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,26 @@
2
2
3
3
**Sunburst Chip** is an open-source microcontroller chip design based around the CHERI-enabled [CHERIoT Ibex](https://github.com/microsoft/CherIoT-ibex) RISC-V core.
4
4
5
-
This repository hosts the logical design, verification environment, and associated bare-metal test software for Sunburst Chip.
5
+
This repository hosts the logical design, design verification (DV) environment, and associated bare-metal test software for Sunburst Chip.
6
6
It has been put together by [lowRISC C.I.C.](https://lowrisc.org/)
7
7
8
8
Sunburst Chip is part of the [Sunburst Project](https://www.sunburst-project.org) funded by [UKRI](https://www.ukri.org/) / [DSbD](https://www.dsbd.tech/) under grant number 107540.
-[Sonata XL development board](#sonata-xl-development-board)
21
+
-[Vendoring](#vendoring)
22
+
-[Porting](#porting)
23
+
-[Licence](#licence)
24
+
10
25
## Overview
11
26
12
27
Sunburst Chip combines the CHERIoT Ibex core with a useful selection of peripherals (amongst other bits) from the open-source [OpenTitan](https://github.com/lowRISC/opentitan) project, along with some bits from the open-source [Sonata](https://github.com/lowRISC/sonata-system) project.
@@ -63,8 +78,13 @@ Some parts of Sunburst Chip are currently using temporary workarounds that must
63
78
Key pre-tapeout actions include (but are not be limited to):
64
79
65
80
- Implement a true random number generator
66
-
- Currently generate pseudo-random numbers in `dif_rv_core_ibex_read_rnd_data`.
67
-
- Possibly want to replicate the interface in [OpenTitan `rv_core_ibex`](https://opentitan.org/book/hw/ip/rv_core_ibex/doc/registers.html#rnd_data) for software compatibility.
81
+
- Currently, pseudo-random numbers are generated in `dif_rv_core_ibex_read_rnd_data` due to the lack of true random numbers.
82
+
- May want to replicate the interface in [OpenTitan `rv_core_ibex`](https://opentitan.org/book/hw/ip/rv_core_ibex/doc/registers.html#rnd_data) for software compatibility.
83
+
- Implement a real reset and clock manager.
84
+
- Currently, there are only simulation and FPGA-specific implementations.
85
+
- Implement top-level tests for all blocks for which performing integration testing makes sense.
86
+
- Currently, only some key blocks have top-level tests defined in [*top_chip_sim_cfg.hjson*](hw/top_chip/dv/top_chip_sim_cfg.hjson).
87
+
- Triage the many TODOs throughout the codebase.
68
88
69
89
## Dependencies
70
90
@@ -157,9 +177,12 @@ The primary simulator for running top-level tests is Xcelium, via DVsim.
157
177
Note that DVsim does not build the test software for you.
158
178
It must have already been compiled using the instructions in the [Test software section](#Test-software) before you call DVsim.
159
179
180
+
All DVsim tests and test sets are defined in [*top_chip_sim_cfg.hjson*](hw/top_chip/dv/top_chip_sim_cfg.hjson).
181
+
Each test
182
+
160
183
### Build & run
161
184
162
-
The **`smoke` regression test set**(defined in top_chip_sim_cfg.hjson) can be built and run under Xcellium using the following commands:
185
+
The **`smoke` regression test set** can be built and run under Xcellium using the following commands:
163
186
164
187
```sh
165
188
# -- Build and run top-level `smoke` regression set using Xcelium --
@@ -169,7 +192,7 @@ The **`smoke` regression test set** (defined in top_chip_sim_cfg.hjson) can be b
Newer versions of vendored code, or new patches, can be vendored in using the following command:
455
+
Many blocks in the design and associated code have been imported from the Ibex, OpenTitan, and Sonata repositories using the 'vendor' flow.
456
+
The goal is to import select parts of the target repositories, optionally from a particular revision, and automatically apply local patches that make Sunburst Chip-specific changes.
457
+
The [*vendor.py*](util/vendor.py) script automates this process based on the *\*.vendor.hjson* configuration files in *hw/vendor*.
458
+
All the vendored code ends up in subdirectories under *hw/vendor*.
459
+
460
+
The vendoring flow can be run using the following command:
433
461
434
462
```sh
435
463
# -- Apply patches to vendored OpenTitan IP --
@@ -438,6 +466,51 @@ Newer versions of vendored code, or new patches, can be vendored in using the fo
If the target *.vendor.hjson* file does not specify specific revision, then the `-Dupstream.rev` option is redundant.
470
+
Otherwise (when *.vendor.hjson* specifies a branch), dropping the `-Dupstream.rev` option will cause code from a newer revision of the relevant repository to be imported.
471
+
472
+
## Porting
473
+
474
+
Modifying and integrating the imported blocks and associated code is often more involved than simply vendoring it in, particularly for top-level verification.
475
+
Porting top-level DV elements such as UVM agents, virtual sequences (vseq), and test software for an OpenTitan block can be take days to weeks depending on the complexity.
476
+
Factors include the complexity of the top-level DV for that block, applicable differences between OpenTitan and Sunburst Chip (e.g. PLIC interrupt granularity), and familiarity with the two projects.
477
+
478
+
Here are some notes on common steps required when porting top-level DV for a block from OpenTitan to Sunburst Chip:
479
+
480
+
- UVM agent integration (for I/O blocks)
481
+
- Add and connect to the DUT the appropriate virtual interface (such as `spi_if`) in the testbench *hw/top_chip/dv/tb/tb.sv* for export using `uvm_config_db`.
482
+
- This may require adding an enable signal if the DUT connections need to be shared with a DPI model.
483
+
- OpenTitan has an additional level of interface in the form of [chip_if.sv](https://github.com/lowRISC/opentitan/blob/earlgrey_1.0.0/hw/top_earlgrey/dv/env/chip_if.sv), but this has been omitted to keep Sunburst Chip simpler.
484
+
- Add a sequencer variable or array thereof to *hw/top_chip/dv/env/top_chip_dv_virtual_sequencer.sv*
485
+
- Add an agent or array of agents to *hw/top_chip/dv/env/top_chip_dv_env.sv*.
486
+
- Instantiate and set in `uvm_config_db` in the `build_phase()`.
487
+
- Store handles to their sequencers into the virtual sequencer in the `connect_phase()`.
488
+
- Add a randomised agent config in *hw/top_chip/dv/env/top_chip_dv_env_cfg.sv*.
489
+
Initialise it in `initialize()`.
490
+
- Add the agent to *hw/top_chip/dv/env/top_chip_dv_env.core*
491
+
- Import the agent’s package in *hw/top_chip/dv/env/top_chip_dv_env_pkg.sv*
492
+
- Virtual sequence porting
493
+
- Copy vseq into *hw/top_chip/dv/env/seq_lib/*
494
+
- Check for any block-specific base vseq and copy that too.
495
+
- Rename vseq to use Sunburst Chip top-level prefix `top_chip_dv_`.
496
+
- Remember to update it in the `uvm_object_utils` call too.
497
+
- Change `chip_sw_base_vseq` to `top_chip_dv_base_vseq` in `class ... extends` section.
498
+
- Replace OpenTitan chip constants (such as `NUM_SPI_HOSTS`) with an equivalent in *hw/top_chip/dv/env/top_chip_dv_env_pkg.sv* or other appropriate package.
499
+
- Prepend `p_sequencer.` to `cfg.*` usages.
500
+
- Merge contents of task `cpu_init()` with the top of task `body()`.
501
+
- Add `p_sequencer.ifs.peri_clk_if.wait_for_reset();` near the start of `body()`, if required.
502
+
- Change clock interface from `peri_clk_if` if the block is driven by a different clock.
503
+
- Replace `` `DV_WAIT `` with `wait`, removing any failure message (unfortunately).
504
+
- Waits that check against `sw_logger_vif` should be removed/reworked, as the logger interface is not working at present.
- Rework interrupt code (if any) to account for the PLIC only having one interrupt per block rather than per cause in each block.
511
+
- Move inlined `irq_global_ctrl()` call (if any) to be inside `test_main()` rather than any sub-function to avoid trouble with interrupt-clearing backward sentries.
512
+
441
513
## Licence
442
514
443
-
Unless otherwise noted, everything in the repository is covered by the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html), Version 2.0. See the [LICENSE](https://github.com/lowRISC/sonata-system/blob/main/LICENSE) file for more information on licensing.
515
+
Unless otherwise noted, everything in the repository is covered by the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html), Version 2.0.
516
+
See the [LICENSE](https://github.com/lowRISC/sonata-system/blob/main/LICENSE) file for more information on licensing.
0 commit comments