Skip to content

Commit

Permalink
Merge pull request #1646 from JL102/docs-tests
Browse files Browse the repository at this point in the history
docs: Add info on chipyard's tests directory and how to do multithreading in RTL simulations
  • Loading branch information
jerryz123 committed Nov 4, 2023
2 parents f8172d8 + 5136b7e commit e3106fe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/Simulation/Software-RTL-Simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ For example:

.. _sw-sim-custom:

Custom Benchmarks/Tests
-------------------------------

To compile your own bare-metal code to run in a Verilator/VCS simulation, add it to Chipyard's ``tests`` directory then add its name to the list of ``PROGRAMS`` inside the ``Makefile``. These binaries are compiled with the libgloss-htif library, which implements a minimal set of useful syscalls for bare-metal binaries. Then when you run ``make``, all of the programs inside ``tests`` will be compiled into ``.riscv`` ELF binaries, which can be used with the simulator as described above.

.. code-block:: shell
# Enter Tests directory
cd tests
make
# Enter Verilator or VCS directory
cd ../sims/verilator
make run-binary BINARY=../../tests/hello.riscv
.. Note:: On multi-core configurations, only hart (**har**\ dware **t**\ hread) 0 executes the ``main()`` function. All other harts execute the secondary ``__main()`` function, which defaults to a busy loop. To run a multi-threaded workload on a Verilator/VCS simulation, override ``__main()`` with your own code. More details can be found `here <https://github.com/ucb-bar/libgloss-htif>`_


Makefile Variables and Commands
-------------------------------
You can get a list of useful Makefile variables and commands available from the Verilator or VCS directories. simply run ``make help``:
Expand Down

0 comments on commit e3106fe

Please sign in to comment.