1. Apr 30, 2024
    • Martin Berger's avatar
      Add Svinval extension. · 41071ea6
      Martin Berger authored
      
      
      These changes add the "Svinval" Standard Extension for Fine-Grained
      Address-Translation Cache Invalidation, Version 1.0 to the sail-riscv
      model.
      
      This extension defines five new instructions: SINVAL.VMA,
      SFENCE.W.INVAL, SFENCE.INVAL.IR, HINVAL.VVMA, HINVAL.GVMA.
      
      HINVAL.VVMA & HINVAL.GVMA are omitted since they build on the
      Hypervisor Extension which is yet to be included in the model.
      
      SFENCE.W.INVAL & SFENCE.INVAL.IR are treated as nops pending
      integration of the coherency model (rmem) with sail.
      
      The specification says that SINVAL.VMA behaves just as SFENCE.VMA,
      except there are additional ordering constraints with respect to the
      new SFENCE.W.INVAL & SFENCE.INVAL.IR instructions. Since these are
      nops, we can treat SINVAL.VMA as if it were SFENCE.VMA.
      
      Co-authored-by: default avatarKristin Barber <kristinbarber@google.com>
      41071ea6
    • Martin Berger's avatar
      fc618e69
    • Martin Berger's avatar
      fixup! fixup! Add Svinval extension. · db931c49
      Martin Berger authored
      db931c49
    • Martin Berger's avatar
      fixup! Add Svinval extension. · f06a04e8
      Martin Berger authored
      f06a04e8
    • Martin Berger's avatar
      Add Svinval extension. · ff98dccc
      Martin Berger authored
          These changes add the "Svinval" Standard Extension for Fine-Grained
          Address-Translation Cache Invalidation, Version 1.0 to the sail-riscv model.
      
          This extension defines five new instructions: SINVAL.VMA, SFENCE.W.INVAL,
          SFENCE.INVAL.IR, HINVAL.VVMA, HINVAL.GVMA.
      
          HINVAL.VVMA & HINVAL.GVMA are omitted since they build on the
          Hypervisor Extension which is yet to be included in the model.
      
          SFENCE.W.INVAL & SFENCE.INVAL.IR are treated as nops pending integration
          of the coherency model (rmem) with sail.
      
          The specification says that SINVAL.VMA behaves just as SFENCE.VMA,
          except there are additional ordering constraints with respect to the new
          SFENCE.W.INVAL & SFENCE.INVAL.IR instructions. Since these are nops, we
          can treat SINVAL.VMA as if it were SFENCE.VMA.
      ff98dccc
    • Jordan Carlin's avatar
      c5ee87df
    • Jordan Carlin's avatar
      Correct fcvtmod.w.d flag generation logic · d7373930
      Jordan Carlin authored
      d7373930
  2. Apr 27, 2024
  3. Apr 24, 2024
  4. Apr 16, 2024
  5. Apr 15, 2024
  6. Apr 12, 2024
    • Tim Hutt's avatar
      Remove & rename duplicate word_width <-> bytes mappings · e187e022
      Tim Hutt authored
      * Remove the duplicate mapping functions.
      * Rename to `size_bytes` for consistency with the other two functions.
      * Rename `size_bits` to `size_enc`, otherwise it's quite confusing that `size_bits` is not just `8 * size_bytes`.
      
      Fixes #423
      e187e022
  7. Apr 09, 2024
    • Tim Hutt's avatar
      Clean up memory checking functions slightly · 5c7d1f2a
      Tim Hutt authored
      * Move `write_knd_of_flags` into its own function.
      * Wrap really long lines
      * Move PMP check into `phys_access_check` function. This is needed for two reasons:
        - The CBO extension needs to do explicit access checks.
        - In future it will also check PMAs so the name needs changing.
      5c7d1f2a
  8. Apr 03, 2024
    • Tim Hutt's avatar
      Fix flen=32 compilation · a2ffa851
      Tim Hutt authored
      This has been broken for at least 2 years. This fixes the compilation.
      
      Fixes #351
      a2ffa851
  9. Apr 01, 2024
    • Rishiyur S. Nikhil's avatar
      Unify VM code · f601c866
      Rishiyur S. Nikhil authored
      Old vmem code had much 'cut-and-paste' replication for RV32 (Sv32) and (#408)
      
      RV64 (Sv39, Sv48), and was scattered over several files.
      
      New code unifies them into single set of parameterized functions
      that works for RV32/RV64 and Sv32/Sv39/Sv48 (and is ready for Sv57).
      
      Deleted old files:
          riscv_vmem_rv32.sail    riscv_vmem_rv64.sail
          riscv_vmem_sv32.sail    riscv_vmem_sv39.sail    riscv_vmem_sv48.sail
          riscv_pte.sail
          riscv_ptw.sail
      
      Current files: all named riscv_vmem_*
          riscv_vmem.sail    (root file for vmem)
          riscv_vmem_common.sail
          riscv_vmem_pte.sail
          riscv_vmem_ptw.sail
          riscv_vmem_tlb.sail
          riscv_vmem_types.sail
      
      Modified top-level Makefile accordingly.
      
      Added documentation on new vmem code: doc/notes_Virtual_Memory.adoc
      f601c866
  10. Mar 25, 2024
  11. Feb 27, 2024
  12. Feb 09, 2024
    • Tim Hutt's avatar
      Add m/senvcfg to CSR name map · 9602e3a5
      Tim Hutt authored
      These were missed when those CSRs were implemented.
      9602e3a5
    • Tim Hutt's avatar
      Shorten copyright notice at the top of each file · 2eb3e3d2
      Tim Hutt authored
      This script was used to do the modification:
      
      ```
      from pathlib import Path
      import re
      
      RE_LINE = r"/\*={50,150}\*/\n"
      RE_MIDDLE = r"/\*.*\*/\n"
      
      NEW_TEXT = """/*=======================================================================================*/
      /*  This Sail RISC-V architecture model, comprising all files and                        */
      /*  directories except where otherwise noted is subject the BSD                          */
      /*  two-clause license in the LICENSE file.                                              */
      /*                                                                                       */
      /*  SPDX-License-Identifier: BSD-2-Clause                                                */
      /*=======================================================================================*/
      """
      
      REPLACEMENT = re.compile(rf"^{RE_LINE}(?:{RE_MIDDLE}){{10,100}}{RE_LINE}")
      
      def main():
          for file in Path("model").glob("**/*.sail"):
              text = file.read_text(encoding="utf-8")
              text = REPLACEMENT.sub(NEW_TEXT, text, 1)
              file.write_text(text, encoding="utf-8")
      
      if __name__ == "__main__":
          main()
      ```
      2eb3e3d2
  13. Feb 06, 2024
    • Tim Hutt's avatar
      Improve PMP support · 4de2bff1
      Tim Hutt authored
      
      
      This implements a lot of missing functionality for PMPs.
      
      * Support 64 PMPs as well as 0 and 16.
      * Support setting PMP grain
      * Return correct address bits on read (some read as 0 or 1 depending on the grain and match type)
      * Unlock PMPs on reset
      * Implement pmpcfg WARL legalisation
      
      Co-authored-by: default avatarBen Fletcher <benjamin.fletcher@codasip.com>
      4de2bff1
  14. Feb 05, 2024
  15. Feb 02, 2024
    • Tim Hutt's avatar
      Simplify prelude.sail by including generic_equality.sail and mapping.sail · 23f18200
      Tim Hutt authored
      This change includes `generic_equality.sail` and `mapping.sail` from the Sail standard library which defines a lot of things that were defined in `prelude.sail`.
      
      I also removed `reg_deref` which is no longer required.
      
      The `mapping.sail` and `hex_bits.sail` files are in Sail 0.18 which is not yet released, so they have been temporarily copied here.
      23f18200
  16. Feb 01, 2024
    • Alasdair's avatar
      Update bitfield update syntax · e7c369d6
      Alasdair authored
      Bitfields allow [<bitfield> with field = value], like bitvectors,
      so use that instead of the old-style `update_field` overloads.
      e7c369d6
    • Alasdair's avatar
      Update bitfield syntax · 563446c4
      Alasdair authored
      Use newer bitfield syntax, which has been part of Sail for
      a while now. Should in theory be more efficient as it removes
      a level of indirection for bitfield accesses.
      
      It's also much more friendly to `sail -fmt`, which has no idea
      how to handle the old bitfield syntax.
      563446c4
  17. Dec 20, 2023
    • Alasdair's avatar
      lem: Fix issues created by vector extension · d7a3d801
      Alasdair authored
      Switch to bitlist representation because the machine words
      can't handle the vector code currently
      
      Remove RMEM target from default set of targets in Makefile.
      This is only interesting for RMEM maintainers. There's no reason for it
      to be generated by default, and it's also broken.
      
      While we are hacking on these files purge the duplicate versions for Sail 0.11+
      d7a3d801
    • Alasdair's avatar
      lem: Fix use of 'class' in riscv_insts_vext_utils · 6beb7c24
      Alasdair authored
      class is a reserved keyword in lem, so the use of class as a variable
      name was causing issues. While ultimately this should be fixed in Sail
      this can easily be worked around here.
      
      Fortunately the code in questions was ultimately using a pattern like
      
      let class = f(x);
      let y = match class {
        ...
      };
      y
      
      which can be simplified to
      
      match f(x) {
        ...
      }
      
      removing the variable entirely, and making the code simpler so a
      win-win overall!
      6beb7c24
  18. Dec 13, 2023
  19. Dec 07, 2023
    • Alasdair's avatar
      Fix kext warning · 393e7ed9
      Alasdair authored
      Use fixed-length vectors for AES tables
      
      Note that because we have `default Order dec`, Sail vectors
      are indexed the same as bitvectors, in decreasing order, hence why
      the indexing in sbox_lookup becomes
      ```
      table[255 - unsigned(x)]
      ```
      rather than
      ```
      table[unsigned(x)]
      ```
      The alternative would be to flip all the literals
      393e7ed9
  20. Dec 06, 2023