aboutsummaryrefslogtreecommitdiff
path: root/model/riscv_vmem_common.sail
AgeCommit message (Collapse)AuthorFilesLines
2024-10-05Remove old Sail workaround for Virtual Memory paramsJordan Carlin1-11/+0
With the move to Sail 0.18 this is no longer needed.
2024-04-01Unify VM code Rishiyur S. Nikhil1-149/+96
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
2024-02-08Shorten copyright notice at the top of each fileTim Hutt1-65/+3
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() ```
2024-01-31Update bitfield syntaxAlasdair1-4/+4
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.
2023-08-01Rename EXTZ and EXTSAlasdair1-2/+2
Rename EXTZ to zero_extend and EXTS to sign_extend. Two main reasons for doing this - it means that the source more closely follows the descriptions in the documentation with more readable names, and EXTS and EXTZ are visually very close to each other with just the S and Z. They are also following an odd convention where they are ALLCAPS rather than snake_case like other functions in the spec. I think this convention comes from early Power specs in Sail, which influenced Sail MIPS and CHERI-MIPS, but I don't think it's a very good convention we should be keeping in sail-riscv
2023-05-29apply_headers: regenerate copyright headersupdate-copyright-headersPhilipp Tomsich1-1/+3
2021-08-22Fix incorrect SV48_Vaddr bitfielddylux1-1/+1
2021-07-29Use headache to apply copyright header at request of Peter Sewell.Robert Norton1-0/+68
2019-08-09Allow accumulation of information during page-table-walk for extensions.Prashanth Mundkur1-5/+10
2019-07-16Use reserved bits in PTEs for vmem extensions on RV64, as allowed by the ↵Prashanth Mundkur1-0/+2
spec. This is not possible for RV32, so pass zeros there.
2019-07-15Allow extensions to types of memory access, and factor out PTE and PTW ↵Prashanth Mundkur1-89/+0
definitions.
2019-06-28Avoid implicit casts to stringAlasdair1-1/+3
Can have unintended consequences, due to how overloading interacts with casts. For example, x : X == y : X can be interpreted as eq_string(cast(x), cast(y)) if x and y are both castable to string, even when there is an equality function (X, X) -> bool. Sail->SMT can't handle strings very well so it's best to just ensure that this can never occur. Rather than implicitly casting in logging statements like: print("xyz" ^ x ^ " foo " ^ y) it's now print("xyz" ^ to_str(x) ^ " foo " ^ to_str(y)) which ensures that the conversion to strings only happens where intended. I also added a warning to Sail itself to try to catch these cases in future.
2019-02-22Fix address translation bug in ordering of width-extension and shift in pte. ↵Prashanth Mundkur1-1/+1
This showed up in RV32, but not in RV64, presumably because the highest address bits are not typically exercised typical physical memory maps.
2019-02-13Pull out the Sv39 and its TLB into separate files.Prashanth Mundkur1-75/+0
2019-02-13Make more address translation types reusable.Prashanth Mundkur1-15/+9
2019-02-13Attempt to reuse types for Sv39 and Sv48 to the extent possible for ↵Prashanth Mundkur1-55/+81
simplicity. This might need revisiting for Sv59 and Sv64.
2019-02-12Start extracting bits of vmem that should be common to RV32, and add some ↵Prashanth Mundkur1-0/+294
definitions for Sv32 and Sv48.