aboutsummaryrefslogtreecommitdiff
path: root/ocaml_emulator
AgeCommit message (Collapse)AuthorFilesLines
2024-07-05Add support for B extensionVed Shanbhogue2-0/+5
This adds support for the B extension. If `misa[B]` is set then Zba, Zbb and Zbs are supported. There's a command line flag for this: `-B`. Note that even if you don't support B then you're allowed to support Zba, Zbb and Zbs anyway, and the Sail model currently does. In other words, currently passing `-B` only changes `misa[B]`. In future we will allow enabling the sub extensions individually.
2024-05-07fixup! fixup! Add Svinval extension.Martin Berger1-2/+2
2024-05-07fixup! Add Svinval extension.Martin Berger2-0/+5
2024-04-15Implement Zcb extensionTim Hutt2-0/+5
This adds an implementation of the Zcb code size extension. Co-authored-by: Martin Berger <martinberger@users.noreply.github.com>
2024-02-05Improve PMP supportTim Hutt2-5/+13
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: Ben Fletcher <benjamin.fletcher@codasip.com>
2023-10-17RISC-V Vector Extension SupportXinlai Wan2-0/+5
This PR adds the following: General Framework and Configurations: * Introduced the V extension's general framework and configuration setting instructions. * Updated model/riscv_insts_vext_vset.sail and effect matching functions in riscv_vlen.sail. * Addressed code formatting issues and made revisions post the Nov 22 meeting. * Co-authored by Nicolas Brunie and Jessica Clarke. Vector Load/Store Instructions: * Integrated vector load and store instructions. * Enhanced the implementation of SEW, LMUL, VLEN and removed real numbers from the code. * Updated vstart settings and removed unnecessary assert statements. * Rectified bugs in vleff instructions and overhauled coding styles. * Incorporated guards for vector encdec clauses and optimized memory access post vector load/store failures. Vector Integer/Fixed-Point Instructions: * Added vector integer/fixed-point arithmetic and mask instructions. * Improved vector EEW and EMUL checking functions and introduced illegal instruction check functions. * Fine-tuned code formatting for vector instruction checks. Vector Floating-Point Instructions: * Rolled out vector floating-point instructions and updated their conversion counterparts. * Refreshed copyright headers specific to the vector extension code. Vector Reduction and Mask Instructions: * Integrated vector mask and reduction instructions. * Addressed register overlap checks for vector mask instructions. Miscellaneous Enhancements and Fixes: * Updated vector CSR vtype.vill settings and judgements. * Systematized patterns for vector illegal instruction checks. * Rectified issues in vector load/store and reduction operations. * Purged redundant elements from the V extension code and vector floating-point functions. * Cleaned up softfloat makefiles and renamed EXTZ and EXTS within the V extension code. * Addressed a clang-format check issue and NaN boxing anomalies. Provided annotations for pending RVV configurations. * Initialized default VLEN value and set vlenb CSR. * Set constraints for vector variable initialization and added mstatus.VS settings specific to the vector extension.
2023-10-11Rename enable-fiom to enable-writable-fiomTim Hutt2-4/+4
This is a much clearer name because the option allows code to enable FIOM, it doesn't enable FIOM itself.
2023-10-11Implement menvcfgTim Hutt2-0/+5
This implements the m/senvcfg(h) CSRs. This CSR is used to enable/disable extensions and behaviours for lower privilege modes. Currently the only implemented bit is FIOM which affects how fences work. It also affects how atomic memory accesses work in non-cacheable regions, but the model does not currently support PMAs so that can't easily be implemented.
2023-06-15Run the pre-commit hook on all filesAlex Richardson1-1/+0
This strips trailing whitespace and fixes line endings. I had to add the *.dump files to the exclude list to avoid excessive changes, but ideally these would not be part of the repository since they can just be generated by running objdump manually.
2023-05-29Add Zfa extension support (excl. quad-precision)Philipp Tomsich1-0/+27
This commit adds the following: - infrastructure for Zfa (e.g., existence macro) - support for the following instructions: + FLI.[HSD] + FMINM.[HSD] and FMAXM.[HSD] + FROUND.[HSD] and FROUNDNX.[HSD] + FMVH.X.D and FMVP.D.X + FLEQ.[HSD] and FLTQ.[HSD] + FCVTMOD.W.D Note the following implementation details: FMINM and FMAXM provide similar functionality to FMIN and FMAX, differing only in their NaN-handling: * FMIN/FMAX return a canonical NaN only if both operands are a NaN * FMINM/FMAXM return a canonical Nan if any operand is a NaN Consequently, the implementation is identical to FMIN/FMAX with only the NaN-related tests changed. FROUND instruction rounds a floating-point number in floating-point register rs1 and writes that integer, represented as a floating-point number to floating-point register rd while: * Zero and infinite inputs are copied to rd unmodified. * NaN inputs cause the invalid operation exception flag to be set. FROUNDNX instruction is defined similarly, but also sets the inexact exception flag if the input differs from the rounded result and is not NaN. FMVH.X.D instruction is available for RV32 only and moves bits 63:32 of floating-point register rs1 into integer register rd. FMVP.D.X instruction is available for RV32 only and moves a double-precision number from a pair of integer registers into a floating-point register. Integer registers rs1 and rs2 supply bits 31:0 and 63:32, respectively. FLEQ and FLTQ instructions are defined like the FLE and FLT instructions, except that quiet NaN inputs do not cause the invalid operation exception flag to be set. The FCVTMOD.W.D instruction is defined similarly to the FCVT.W.D instruction, with the following differences: * FCVTMOD.W.D always rounds towards zero. * Bits 31:0 are taken from the rounded, unbounded two's complement result, then sign-extended to XLEN bits and written to integer register rd. * Positive infinity, negative infinity and NaN are converted to zero. Signed-off-by: Charalampos Mitrodimas <charalampos.mitrodimas@vrull.eu> Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
2022-01-19Configurable word size for test signature file output (#136)Bilal Sakhawat1-7/+14
2022-01-19Add support for Zfh extension (#129)Bilal Sakhawat1-0/+63
2021-11-22Implement support for Zfinx (#130)Jessica Clarke1-0/+1
NB: Smstateen support is missing in the model so enabling the Zfinx extension provides an architectural covert channel via FCSR if privileged software is not aware of Zfinx's existence. Co-authored-by: Jessica Clarke <jrtc27@jrtc27.com> Co-authored-by: Ibrahim Abu Kharmeh <abukharmeh@gmail.com>
2021-11-17Revert "Initial introduction of zfinx (#75)"Jessica Clarke1-2/+0
This reverts commit c5e62ea4b3d481fcd491b22b317cc319b089f05d.
2021-11-17Initial introduction of zfinx (#75)Ibrahim Abu Kharmeh1-0/+2
* Adds Zfinx enable flag * Hardwire misa.{f,d} and mstats.FS to 0 * Moving nan boxing functions to fdext_reg * Swaps register names for floating point instructions Adds new mapping to swap register names, and use it in all assembly clauses * Disable Floating point loads, stores and moves * Add X_or_F_s and X_or_F_d functions, and use them to access all registers for floating points Changes register accessed for floating point instructions and modify nan boxing functions for zfinx * Formatting Remove couple of misplaced whitespace, unnecessary parens * Fix inconsistent indentation in insts_dext file * Fix spacing in fdext_regs * Remove redundant comparasion with true/ false * Constistant tuples spacing and removes couple of unnecessary parens. * Consistent functions declaration & calls spacing and removes couple of unnecessary parens. * Consistent spacing and removes couple of unnecessary comparasion with true/false * Make spacing consistent * Remove checks from execution stage * Add checks to encdec stage
2021-10-18scalar-crypto: Initial commit of 1.0.0-rc2 spec work. (#99)Ben Marshall1-0/+5
Merged scalar-crypto pull request #99 of 1.0.0-rc2 spec work from Ben Marshall. See https://github.com/riscv/sail-riscv/pull/99.
2021-02-11Make N extension configurable.Prashanth Mundkur2-0/+5
2020-04-07Switch floating-point comparisons to using softfloat to avoid missed ↵Prashanth Mundkur1-0/+17
corner-cases in hand-rolled helpers.
2019-11-26Add individual ocaml stubs for the softfloat functions.Prashanth Mundkur2-6/+91
2019-11-06Add hooks for misa.{F,D} for C and OCaml, and fix 64-bit OCaml build.Prashanth Mundkur1-0/+7
2019-06-26Merge branch 'master-cleanup' into pmpPrashanth Mundkur1-0/+5
2019-06-26Add command line option in c_emulator for disabling tracing. Add builtins ↵Robert Norton1-0/+5
for getting values of config_print_xxx variables to speed up emulation when not tracing.
2019-06-24Add PMP checks to physical memory accesses.Prashanth Mundkur2-0/+5
- unify AccessType and ReadType since they were essentially redundant, making it easier to implement PMP checks for ReadWrite/atomic accesses. - add command line options to enable PMP in the platform - also fix the matching for the case when all entries are off
2019-04-18Parameterise memory read/write primitives by address lengthJon French1-2/+2
2019-04-12Merge branch 'master' into rmem_interpreterrmem_interpreterJon French2-12/+23
2019-04-12ocaml emulator: add ocaml impls for new standard Sail memory functionsJon French1-0/+12
2019-03-29Generalize the previous commit to handle hardwired misa.c.Prashanth Mundkur2-12/+23
2019-03-14Use Bytes.get instead of square bracket notation. I think this is an ocaml ↵Robert Norton1-4/+4
version incompatibility.
2019-03-11Fixes for Sv39 TLB.Prashanth Mundkur1-2/+1
- fix and simplify model initialization, to enable generic TLB initialization - re-enable sfence.vma
2019-02-27Add an option to write signatures for the compliance suite.Prashanth Mundkur2-8/+62
2019-02-26Reduce default ram to 64MB in ocaml emulator.Prashanth Mundkur1-1/+1
2019-02-26Remove old license header from ml files.Prashanth Mundkur2-100/+0
2019-02-22Add rv32 support to the trace comparer.Prashanth Mundkur1-8/+67
2019-02-21Fix the ocaml platform to respect the architectural width.Prashanth Mundkur1-13/+20
2019-02-20Some changes for arch-specific initialization.Prashanth Mundkur3-25/+50
2019-02-20Add an option to report the model architecture to the emulators.Prashanth Mundkur1-0/+7
2019-02-20Add ELF architecture checks to the loaders in the OCaml and C emulators.Prashanth Mundkur1-1/+17
2019-01-16Make it clearer that the outer c,ocaml sub-dirs contain supporting files for ↵Prashanth Mundkur6-0/+800
the emulators.