Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Add TestRIG and Direct Instruction Injection support #1

Draft
wants to merge 23 commits into
base: ibex_dii
Choose a base branch
from

Commits on Sep 14, 2022

  1. Initial DII + TestRIG push

    This commit adds some barebones files to try to add support for TestRIG
    as well as its required additions (Direct Instruction Injection).
    This includes a new simulation file, and also adds SocketPacketUtils
    from https://github.com/CTSRD-CHERI/SocketPacketUtils
    (SocketPacketUtils is not vendored in correctly at the moment, this will
    be changed in a later commit)
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    eddacb7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    937a1ca View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ded6e87 View commit details
    Browse the repository at this point in the history
  4. Instantiate bus and RAM in TestRIG toplevel file

    The bus does not currently set the error signal when a request is out of
    ranges, so this commit adds a very simple error detection in the
    toplevel. At the moment writes are not cancelled.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    622cbb8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5dcd062 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    16a2c27 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    be08da0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f851c73 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    dcb7a5d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    283db68 View commit details
    Browse the repository at this point in the history
  11. Handle memory in C++, not systemverilog

    The SRAM block provided by the shared libraries does not handle reset,
    so memory is instead implemented in C++ so that it can be reset.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    981deca View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    417b390 View commit details
    Browse the repository at this point in the history
  13. Receive all RVFI signals

    The in_count and out_count variables might have strange values when we
    encounter exceptions and jumps, so remove these as a factor when
    extracting RVFI data.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    c19a0b1 View commit details
    Browse the repository at this point in the history
  14. Change clocking logic

    Previously, all our verilator "logic" happened while the clock cycle was
    low (apart from setting gnt_i signals which happened after it when
    high). Now, all our logic happens while the clock is high, then we
    evaluate the core so it can update, and then we set the clock low and
    evaluate.
    
    This commit also makes some tracing dependent on the verbosity - the
    next commit makes more printing and tracing dependent on verbosity.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    83fc62f View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    4d7d3d9 View commit details
    Browse the repository at this point in the history
  16. Insert dummy instructions when needed

    If there is no real instruction to insert (ie we have run out of
    instructions, or for some reason our received, in_count or out_count
    variables got messed up), then insert NOPs instead. This should prevent
    the core from locking up if we run out of instructions, and should help
    in debugging.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    449e1b0 View commit details
    Browse the repository at this point in the history
  17. Handle replaying instrs after jump/exc

    When control flow changes occur in the core, the simulation environment
    needs to replay some instructions (since the instructions that have been
    inserted were flushed out of the pipeline). This commit adds that logic
    and also explains it.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    6cf4110 View commit details
    Browse the repository at this point in the history
  18. Add and handle perf_xret_o signal

    This is used to track when a MRET or DRET instruction occurs, so that
    the simulation environment can correctly replay instructions.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    0d186d7 View commit details
    Browse the repository at this point in the history
  19. Set PC WData correctly on xRET/exc

    When an xRET or exception is encountered, the controller goes into the
    FLUSH state. RVFI data is read while the controller is in the FLUSH
    state, but the PC is only available the next cycle, so for RVFI we
    need to set the PC WData again once it is available.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    b9b058b View commit details
    Browse the repository at this point in the history
  20. Set MTVEC to 0 on boot

    In typical uses, MTVEC can be set after the core fetches the first
    instruction and we can use the boot_addr_i signal to set it.
    However, when using TestRIG it is possible that the first
    instruction causes an exception, and in this case there is not enough
    time to set MTVEC before the exception is handled, so the exception
    vector will be whatever was in boot_addr_i on boot.
    This is incompatible with TestRIG, so MTVEC is set to 0 on boot rather
    than using boot_addr_i.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    a073f3f View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    9f7f39d View commit details
    Browse the repository at this point in the history
  22. Update README with progress.

    With the changes so far, Ibex reports the same results in RVFI as the
    Sail-RISCV model modulo the caveats mentioned in the README.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    13362c7 View commit details
    Browse the repository at this point in the history
  23. Properly vendor in SocketPacketUtils

    This was done using the vendor script from the OpenTitan repository. The
    SocketPacketUtils repository is pinned at the latest commit that
    successfully built; later commits seem to break compilation.
    ivanmgribeiro-google committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    98a85a9 View commit details
    Browse the repository at this point in the history