Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mmu unify 2 #1850

Closed
wants to merge 190 commits into from
Closed
Show file tree
Hide file tree
Changes from 189 commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
6aa0980
create mmu_unify folder
AngelaGonzalezMarino Nov 20, 2023
7b6d59f
first version of unified TLB
AngelaGonzalezMarino Nov 21, 2023
5a4a714
update data types related to unified mmu
AngelaGonzalezMarino Nov 21, 2023
2634865
undo last commit
AngelaGonzalezMarino Nov 21, 2023
7f180fc
modify data structures for mmu
AngelaGonzalezMarino Nov 21, 2023
1d2b65f
created first version of common shared tlb
AngelaGonzalezMarino Nov 22, 2023
3973054
cva6_tlb unified : dv-riscv-mmu-sv32-test.sh passes correctly
AngelaGonzalezMarino Nov 24, 2023
34a72cc
unify shared TLB - dv-riscv-mmu-sv32-test.sh passes correctly
AngelaGonzalezMarino Nov 24, 2023
65bf15b
unified PTW - dv-riscv-mmu-sv32-test.sh passes correctly
AngelaGonzalezMarino Nov 28, 2023
d8f7705
unified mmu top level - dv-riscv-mmu-sv32-test.sh passes correctly
AngelaGonzalezMarino Nov 29, 2023
7639846
fix errors in mmu
AngelaGonzalezMarino Nov 29, 2023
71a73c7
modify load_store_unit to instantiate unified mmu also for sv39
AngelaGonzalezMarino Nov 29, 2023
42a7362
add missing ASID_LEN Parameter at mmu and shared_tlb
AngelaGonzalezMarino Nov 29, 2023
835353c
correct multiple driver warnings
AngelaGonzalezMarino Nov 29, 2023
53705c4
test only tlb unified
AngelaGonzalezMarino Dec 1, 2023
bca87bc
correct double assignment to tags_n in TLB.
AngelaGonzalezMarino Dec 1, 2023
7f3e7df
complete MMU unified - sv32 boots linux, sv39 does not
AngelaGonzalezMarino Dec 4, 2023
bf3dd82
Correct size assignment for PTE
AngelaGonzalezMarino Dec 4, 2023
2e2ccd7
Correct tlb page_match order
AngelaGonzalezMarino Dec 6, 2023
ace52fe
correct req_port_o.data_size in ptw
AngelaGonzalezMarino Dec 6, 2023
891f9e8
top mmu with no shared tlb, common top with no common exceptions
AngelaGonzalezMarino Dec 6, 2023
888e49f
parameterize top no exceptions based on sv39 with no shared tlb
AngelaGonzalezMarino Dec 6, 2023
2a10823
change all mmu to "is_page" concept
AngelaGonzalezMarino Dec 6, 2023
bcbe49b
add common exceptions in top
AngelaGonzalezMarino Dec 6, 2023
53125fb
Revert "add common exceptions in top"
AngelaGonzalezMarino Dec 7, 2023
724227e
Revert "Revert "add common exceptions in top""
AngelaGonzalezMarino Dec 7, 2023
9ffe052
Revert "correct req_port_o.data_size in ptw"
AngelaGonzalezMarino Dec 7, 2023
11573d2
Revert "Revert "correct req_port_o.data_size in ptw""
AngelaGonzalezMarino Dec 7, 2023
2a9c97b
Revert "add common exceptions in top"
AngelaGonzalezMarino Dec 7, 2023
669208d
Revert "change all mmu to "is_page" concept"
AngelaGonzalezMarino Dec 7, 2023
23f5b10
Revert "parameterize top no exceptions based on sv39 with no shared tlb"
AngelaGonzalezMarino Dec 7, 2023
db49cf4
Revert "top mmu with no shared tlb, common top with no common excepti…
AngelaGonzalezMarino Dec 7, 2023
c1f50d8
common top sv39 with shared tlb
AngelaGonzalezMarino Dec 7, 2023
fd36bae
correct is_page assignment in shared tlb
AngelaGonzalezMarino Dec 7, 2023
6a4867d
Merge branch 'tmp' into mmu_unify
AngelaGonzalezMarino Dec 7, 2023
882b9df
Revert "Merge branch 'tmp' into mmu_unify"
AngelaGonzalezMarino Dec 7, 2023
6ea3a34
common top clean up
AngelaGonzalezMarino Dec 7, 2023
e44d91d
Merge branch 'tmp' into mmu_unify
AngelaGonzalezMarino Dec 7, 2023
e9336d0
Revert "Revert "top mmu with no shared tlb, common top with no common…
AngelaGonzalezMarino Dec 7, 2023
950cbb4
Revert "Revert "parameterize top no exceptions based on sv39 with no …
AngelaGonzalezMarino Dec 7, 2023
31fdec0
Revert "Revert "change all mmu to "is_page" concept""
AngelaGonzalezMarino Dec 7, 2023
b4e8616
Revert "Revert "add common exceptions in top""
AngelaGonzalezMarino Dec 7, 2023
499d271
common mmu unified sv39 and sv32
AngelaGonzalezMarino Dec 7, 2023
65668ab
correct page match assignment in shared tlb
AngelaGonzalezMarino Dec 7, 2023
0bb4d31
add missing itlb_req signal
AngelaGonzalezMarino Dec 7, 2023
48e0968
common top clean up and fix lsu ppn o assignment in top
AngelaGonzalezMarino Dec 13, 2023
9c95d3d
change cv64a6 config pkg (TLB=2)
AngelaGonzalezMarino Dec 13, 2023
698c9fa
Merge branch 'tmp' into mmu_unify
AngelaGonzalezMarino Dec 13, 2023
219ad69
parametrization compliance update and cleanup
AngelaGonzalezMarino Dec 13, 2023
ee54587
parametrization compliance and cleanup in packages
AngelaGonzalezMarino Dec 13, 2023
f9a106b
parametrization compliance and cleanup in modules
AngelaGonzalezMarino Dec 13, 2023
91ae8b9
definition of MMU parameters in LSU
AngelaGonzalezMarino Dec 13, 2023
257f6e0
update pte_cva6_t and tlb_update_cva6_t data types to support hypervi…
AngelaGonzalezMarino Dec 14, 2023
478ff59
translation parameterized and content in tlb_update_t data type dimen…
AngelaGonzalezMarino Dec 14, 2023
3e7f23f
complete tlb merge for sv39x4 v0
AngelaGonzalezMarino Dec 15, 2023
af0e57f
common tlb with hypervisor support
AngelaGonzalezMarino Dec 15, 2023
8e826b2
Revert "common tlb with hypervisor support"
AngelaGonzalezMarino Dec 15, 2023
6d8b0c3
Revert "complete tlb merge for sv39x4 v0"
AngelaGonzalezMarino Dec 15, 2023
fb94420
Revert "translation parameterized and content in tlb_update_t data ty…
AngelaGonzalezMarino Dec 15, 2023
d7a3512
Revert "update pte_cva6_t and tlb_update_cva6_t data types to support…
AngelaGonzalezMarino Dec 15, 2023
8a3f58f
Revert "Revert "update pte_cva6_t and tlb_update_cva6_t data types to…
AngelaGonzalezMarino Dec 15, 2023
89e11c9
Revert "Revert "translation parameterized and content in tlb_update_t…
AngelaGonzalezMarino Dec 15, 2023
79fc1d0
Revert "Revert "complete tlb merge for sv39x4 v0""
AngelaGonzalezMarino Dec 15, 2023
8fc35ff
Revert "Revert "common tlb with hypervisor support""
AngelaGonzalezMarino Dec 15, 2023
6b1e61b
fix some tlb issues
AngelaGonzalezMarino Dec 18, 2023
4019f32
fix assignment of page structure
AngelaGonzalezMarino Dec 18, 2023
1475404
correct assignment of vaddr in HYP extension
AngelaGonzalezMarino Dec 18, 2023
227894b
merge 1lb with hypervisor, sv39 boots ok
AngelaGonzalezMarino Dec 19, 2023
6890acb
common mmu top interface and instantiation in load store unit
AngelaGonzalezMarino Dec 19, 2023
a0c2e11
top mmu
AngelaGonzalezMarino Dec 20, 2023
dd0db5b
Revert "top mmu"
AngelaGonzalezMarino Dec 22, 2023
a14089d
Revert "common mmu top interface and instantiation in load store unit"
AngelaGonzalezMarino Dec 22, 2023
f05ebfb
common tlb
AngelaGonzalezMarino Jan 25, 2024
7a2730b
cleanup tlb
AngelaGonzalezMarino Jan 25, 2024
78f12c5
common top - step 1
AngelaGonzalezMarino Jan 29, 2024
7547e8c
fix lsu_vaddr connection, sv39 boots
AngelaGonzalezMarino Jan 29, 2024
4821c4f
fix remaining indexes in tlb
AngelaGonzalezMarino Jan 29, 2024
aabce85
unconnect unused output in mmu top
AngelaGonzalezMarino Jan 29, 2024
e9918ad
FIX TLB ERROR
AngelaGonzalezMarino Jan 29, 2024
458b5c4
common ptw no shared tlb
AngelaGonzalezMarino Feb 2, 2024
708b8c2
fix data padding for all configurations
AngelaGonzalezMarino Feb 2, 2024
2b8ec86
shared tlb pass tests
AngelaGonzalezMarino Feb 5, 2024
165bfc2
attempt shared TLB
AngelaGonzalezMarino Feb 6, 2024
53dded2
fix ptw go to latency instead of idel on error propagation
AngelaGonzalezMarino Feb 7, 2024
7a747a2
Common mmu, ptw and tlb - OK sv32, sv39 and sv39x4
AngelaGonzalezMarino Feb 14, 2024
cb56334
Common shared TLB - sv32 and sv39 ok. sv39x4 fails
AngelaGonzalezMarino Feb 14, 2024
c426c2d
Polish commonalization with sv39x4 - changes required to use this MMU…
AngelaGonzalezMarino Feb 15, 2024
52c05d4
add parameter to bypass shared TLB
AngelaGonzalezMarino Feb 16, 2024
b7a0695
Documentation v0
AngelaGonzalezMarino Feb 16, 2024
4303d1b
diagrams for design document updated
AngelaGonzalezMarino Feb 16, 2024
066cde1
fix integration of hypervisor extension
AngelaGonzalezMarino Feb 16, 2024
159e53d
cleanup code, remove ASID_LEN parameter, remove BYPASS option in shar…
AngelaGonzalezMarino Feb 19, 2024
27a0e39
remove bypass option at top mmu
AngelaGonzalezMarino Feb 19, 2024
300bee5
fix assignment of asid_width in LSU for simulation
AngelaGonzalezMarino Feb 19, 2024
ba208be
clean up package files
AngelaGonzalezMarino Feb 19, 2024
dd431e3
linting
AngelaGonzalezMarino Feb 19, 2024
ff708b3
linting
AngelaGonzalezMarino Feb 19, 2024
8865ce5
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
a06d54f
Update core/mmu_unify/cva6_mmu.sv
AngelaGonzalezMarino Feb 19, 2024
c57fdc6
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
f33cf80
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
0ddafaf
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
78ad38f
linting
AngelaGonzalezMarino Feb 19, 2024
a8c527c
linting
AngelaGonzalezMarino Feb 19, 2024
a5dea8a
linting
AngelaGonzalezMarino Feb 19, 2024
9b2d73a
linting
AngelaGonzalezMarino Feb 19, 2024
ff88078
linting
AngelaGonzalezMarino Feb 19, 2024
f24e7b7
linting
AngelaGonzalezMarino Feb 19, 2024
1a4218b
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
fc7e10a
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
e46d398
linting
AngelaGonzalezMarino Feb 19, 2024
debfbf7
linting
AngelaGonzalezMarino Feb 19, 2024
9f5ff3c
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
cc9bd21
linting
AngelaGonzalezMarino Feb 19, 2024
8f574c7
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
a429c1d
linting
AngelaGonzalezMarino Feb 19, 2024
4180129
linting
AngelaGonzalezMarino Feb 19, 2024
911da2d
linting
AngelaGonzalezMarino Feb 19, 2024
8623338
linting
AngelaGonzalezMarino Feb 19, 2024
1206093
linting
AngelaGonzalezMarino Feb 19, 2024
d69a046
linting
AngelaGonzalezMarino Feb 19, 2024
fb4e6bc
linting
AngelaGonzalezMarino Feb 19, 2024
75593ef
linting
AngelaGonzalezMarino Feb 19, 2024
714ae60
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
47339be
linting
AngelaGonzalezMarino Feb 19, 2024
4c6254b
Update core/mmu_unify/cva6_mmu.sv
AngelaGonzalezMarino Feb 19, 2024
820ceff
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
bffcde3
linting
AngelaGonzalezMarino Feb 19, 2024
a394c58
linting
AngelaGonzalezMarino Feb 19, 2024
80a0868
linting
AngelaGonzalezMarino Feb 19, 2024
88a3dcb
linting
AngelaGonzalezMarino Feb 19, 2024
7fbb419
linting
AngelaGonzalezMarino Feb 19, 2024
5bfbac6
linting
AngelaGonzalezMarino Feb 19, 2024
9e44f5e
linting
AngelaGonzalezMarino Feb 19, 2024
cb89216
linting
AngelaGonzalezMarino Feb 19, 2024
7515e6a
linting
AngelaGonzalezMarino Feb 19, 2024
e8425a3
linting
AngelaGonzalezMarino Feb 19, 2024
040d325
linting
AngelaGonzalezMarino Feb 19, 2024
aaa4e10
linting
AngelaGonzalezMarino Feb 19, 2024
c31f00d
linting
AngelaGonzalezMarino Feb 19, 2024
3bd12fe
linting
AngelaGonzalezMarino Feb 19, 2024
f2c9357
Update core/mmu_unify/cva6_mmu.sv
AngelaGonzalezMarino Feb 19, 2024
d7a50ce
Update core/mmu_unify/cva6_mmu.sv
AngelaGonzalezMarino Feb 19, 2024
2c45722
linting
AngelaGonzalezMarino Feb 19, 2024
1b54f2e
linting
AngelaGonzalezMarino Feb 19, 2024
04e6db6
linting
AngelaGonzalezMarino Feb 19, 2024
94d06af
linting
AngelaGonzalezMarino Feb 19, 2024
b561139
LINTING
AngelaGonzalezMarino Feb 19, 2024
d624161
linting
AngelaGonzalezMarino Feb 19, 2024
fd8f7a6
linting
AngelaGonzalezMarino Feb 19, 2024
f456bd7
linting
AngelaGonzalezMarino Feb 19, 2024
f144f7d
linting
AngelaGonzalezMarino Feb 19, 2024
92f990d
linting
AngelaGonzalezMarino Feb 19, 2024
4073824
linting
AngelaGonzalezMarino Feb 19, 2024
fb11c58
linting
AngelaGonzalezMarino Feb 19, 2024
daf8052
linting
AngelaGonzalezMarino Feb 19, 2024
a457a7b
linting
AngelaGonzalezMarino Feb 19, 2024
917f5af
linting
AngelaGonzalezMarino Feb 19, 2024
95b2120
linting
AngelaGonzalezMarino Feb 19, 2024
a25f9dc
linting
AngelaGonzalezMarino Feb 19, 2024
21acb14
linting
AngelaGonzalezMarino Feb 19, 2024
5e57510
linting
AngelaGonzalezMarino Feb 19, 2024
f79055e
linting
AngelaGonzalezMarino Feb 19, 2024
0bb6cac
linting
AngelaGonzalezMarino Feb 19, 2024
c261261
verible-formatter-mmu
AngelaGonzalezMarino Feb 19, 2024
9441263
linting
AngelaGonzalezMarino Feb 19, 2024
ff786ae
linting
AngelaGonzalezMarino Feb 19, 2024
c8cbc80
linting
AngelaGonzalezMarino Feb 19, 2024
fd6147e
linting
AngelaGonzalezMarino Feb 19, 2024
2fe2546
linting
AngelaGonzalezMarino Feb 19, 2024
6840405
Update core/mmu_unify/cva6_mmu.sv
AngelaGonzalezMarino Feb 19, 2024
f1c20f6
linting
AngelaGonzalezMarino Feb 19, 2024
91381cd
Merge branch 'mmu_unify_2' of github.com:planvtech/cva6 into mmu_unify_2
AngelaGonzalezMarino Feb 19, 2024
08dd0af
linting
AngelaGonzalezMarino Feb 19, 2024
f137416
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
14b638f
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
41b0d7d
linting
AngelaGonzalezMarino Feb 19, 2024
996be08
linting
AngelaGonzalezMarino Feb 19, 2024
7aacc52
linting
AngelaGonzalezMarino Feb 19, 2024
a55fd1d
linting ptw
AngelaGonzalezMarino Feb 19, 2024
58438d8
linting
AngelaGonzalezMarino Feb 19, 2024
8dcc129
Apply suggestions from code review
AngelaGonzalezMarino Feb 19, 2024
50e0c4b
linting
AngelaGonzalezMarino Feb 19, 2024
a733bcc
Merge branch 'mmu_unify_2' of github.com:planvtech/cva6 into mmu_unify_2
AngelaGonzalezMarino Feb 19, 2024
4e7b61d
verible format ptw
AngelaGonzalezMarino Feb 19, 2024
d03f5c0
verible format shared tlb
AngelaGonzalezMarino Feb 19, 2024
75ae9fc
veribla tlb format
AngelaGonzalezMarino Feb 19, 2024
448d03f
Revert "diagrams for design document updated"
AngelaGonzalezMarino Feb 19, 2024
a4ac343
Revert "Documentation v0"
AngelaGonzalezMarino Feb 19, 2024
300e5ba
verible format cva6 mmu top
AngelaGonzalezMarino Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,32 @@ sources:
- core/include/cv32a6_imac_sv0_config_pkg.sv
- core/include/riscv_pkg.sv
- core/include/ariane_pkg.sv
- core/mmu_sv32/cva6_tlb_sv32.sv
- core/mmu_sv32/cva6_mmu_sv32.sv
- core/mmu_unify/cva6_tlb.sv
- core/mmu_unify/cva6_mmu.sv
- core/mmu_sv32/cva6_ptw_sv32.sv
- core/mmu_unify/cva6_ptw.sv
- core/cva6_accel_first_pass_decoder_stub.sv

- target: cv32a6_imac_sv32
files:
- core/include/cv32a6_imac_sv32_config_pkg.sv
- core/include/riscv_pkg.sv
- core/include/ariane_pkg.sv
- core/mmu_sv32/cva6_tlb_sv32.sv
- core/mmu_sv32/cva6_mmu_sv32.sv
- core/mmu_unify/cva6_tlb.sv
- core/mmu_unify/cva6_mmu.sv
- core/mmu_sv32/cva6_ptw_sv32.sv
- core/mmu_unify/cva6_ptw.sv
- core/cva6_accel_first_pass_decoder_stub.sv

- target: cv32a6_imafc_sv32
files:
- core/include/cv32a6_imafc_sv32_config_pkg.sv
- core/include/riscv_pkg.sv
- core/include/ariane_pkg.sv
- core/mmu_sv32/cva6_tlb_sv32.sv
- core/mmu_sv32/cva6_mmu_sv32.sv
- core/mmu_unify/cva6_tlb.sv
- core/mmu_unify/cva6_mmu.sv
- core/mmu_sv32/cva6_ptw_sv32.sv
- core/mmu_unify/cva6_ptw.sv
- core/cva6_accel_first_pass_decoder_stub.sv

# included via target core/include/${TARGET_CFG}_config_pkg.sv
Expand Down
3 changes: 3 additions & 0 deletions ariane.core
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ filesets:
- src/miss_handler.sv
- src/mmu_sv39/mmu.sv
- src/mmu_sv32/cva6_mmu_sv32.sv
- src/mmu_unify/cva6_mmu.sv
- src/mult.sv
- src/nbdcache.sv
- src/pcgen_stage.sv
- src/perf_counters.sv
- src/mmu_sv39/ptw.sv
- src/mmu_sv32/cva6_ptw_sv32.sv
- src/mmu_unify/cva6_ptw.sv
- src/regfile_ff.sv
- src/scoreboard.sv
- src/store_buffer.sv
- src/store_unit.sv
- src/mmu_sv39/tlb.sv
- src/mmu_sv32/cva6_tlb_sv32.sv
- src/mmu_unify/cva6_tlb.sv
file_type : systemVerilogSource
depend :
- pulp-platform.org::axi_mem_if
Expand Down
15 changes: 5 additions & 10 deletions core/Flist.cva6
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,10 @@ ${CVA6_REPO_DIR}/common/local/util/tc_sram_wrapper.sv
${CVA6_REPO_DIR}/vendor/pulp-platform/tech_cells_generic/src/rtl/tc_sram.sv
${CVA6_REPO_DIR}/common/local/util/sram.sv

// MMU Sv39
${CVA6_REPO_DIR}/core/mmu_sv39/mmu.sv
${CVA6_REPO_DIR}/core/mmu_sv39/ptw.sv
${CVA6_REPO_DIR}/core/mmu_sv39/tlb.sv

// MMU Sv32
${CVA6_REPO_DIR}/core/mmu_sv32/cva6_mmu_sv32.sv
${CVA6_REPO_DIR}/core/mmu_sv32/cva6_ptw_sv32.sv
${CVA6_REPO_DIR}/core/mmu_sv32/cva6_tlb_sv32.sv
${CVA6_REPO_DIR}/core/mmu_sv32/cva6_shared_tlb_sv32.sv
// MMU Unify
${CVA6_REPO_DIR}/core/mmu_unify/cva6_mmu.sv
${CVA6_REPO_DIR}/core/mmu_unify/cva6_tlb.sv
${CVA6_REPO_DIR}/core/mmu_unify/cva6_shared_tlb.sv
${CVA6_REPO_DIR}/core/mmu_unify/cva6_ptw.sv

// end of manifest
4 changes: 2 additions & 2 deletions core/include/cv64a6_imafdc_sv39_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ package cva6_config_pkg;
localparam CVA6ConfigNrStorePipeRegs = 0;
localparam CVA6ConfigNrLoadBufEntries = 2;

localparam CVA6ConfigInstrTlbEntries = 16;
localparam CVA6ConfigDataTlbEntries = 16;
localparam CVA6ConfigInstrTlbEntries = 2;
localparam CVA6ConfigDataTlbEntries = 2;

localparam CVA6ConfigRASDepth = 2;
localparam CVA6ConfigBTBEntries = 32;
Expand Down
43 changes: 29 additions & 14 deletions core/include/riscv_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ package riscv;
// Warning: VLEN must be superior or equal to PLEN
localparam VLEN = (XLEN == 32) ? 32 : 64; // virtual address length
localparam PLEN = (XLEN == 32) ? 34 : 56; // physical address length

localparam GPLEN = (XLEN == 32) ? 34 : 41;
localparam GPPNW = (XLEN == 32) ? 22 : 29;
localparam GPPN2 = (XLEN == 32) ? riscv::VLEN - 33 : 10;
localparam IS_XLEN32 = (XLEN == 32) ? 1'b1 : 1'b0;
localparam IS_XLEN64 = (XLEN == 32) ? 1'b0 : 1'b1;
localparam ModeW = (XLEN == 32) ? 1 : 4;
Expand Down Expand Up @@ -326,19 +328,24 @@ package riscv;
// ----------------------
localparam logic [XLEN-1:0] INSTR_ADDR_MISALIGNED = 0;
localparam logic [XLEN-1:0] INSTR_ACCESS_FAULT = 1; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ILLEGAL_INSTR = 2;
localparam logic [XLEN-1:0] BREAKPOINT = 3;
localparam logic [XLEN-1:0] LD_ADDR_MISALIGNED = 4;
localparam logic [XLEN-1:0] LD_ACCESS_FAULT = 5; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ST_ADDR_MISALIGNED = 6;
localparam logic [XLEN-1:0] ST_ACCESS_FAULT = 7; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ENV_CALL_UMODE = 8; // environment call from user mode
localparam logic [XLEN-1:0] ENV_CALL_SMODE = 9; // environment call from supervisor mode
localparam logic [XLEN-1:0] ENV_CALL_MMODE = 11; // environment call from machine mode
localparam logic [XLEN-1:0] INSTR_PAGE_FAULT = 12; // Instruction page fault
localparam logic [XLEN-1:0] LOAD_PAGE_FAULT = 13; // Load page fault
localparam logic [XLEN-1:0] STORE_PAGE_FAULT = 15; // Store page fault
localparam logic [XLEN-1:0] DEBUG_REQUEST = 24; // Debug request
localparam logic [XLEN-1:0] ILLEGAL_INSTR = 2;
localparam logic [XLEN-1:0] BREAKPOINT = 3;
localparam logic [XLEN-1:0] LD_ADDR_MISALIGNED = 4;
localparam logic [XLEN-1:0] LD_ACCESS_FAULT = 5; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ST_ADDR_MISALIGNED = 6;
localparam logic [XLEN-1:0] ST_ACCESS_FAULT = 7; // Illegal access as governed by PMPs and PMAs
Comment on lines +331 to +336
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
localparam logic [XLEN-1:0] ILLEGAL_INSTR = 2;
localparam logic [XLEN-1:0] BREAKPOINT = 3;
localparam logic [XLEN-1:0] LD_ADDR_MISALIGNED = 4;
localparam logic [XLEN-1:0] LD_ACCESS_FAULT = 5; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ST_ADDR_MISALIGNED = 6;
localparam logic [XLEN-1:0] ST_ACCESS_FAULT = 7; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ILLEGAL_INSTR = 2;
localparam logic [XLEN-1:0] BREAKPOINT = 3;
localparam logic [XLEN-1:0] LD_ADDR_MISALIGNED = 4;
localparam logic [XLEN-1:0] LD_ACCESS_FAULT = 5; // Illegal access as governed by PMPs and PMAs
localparam logic [XLEN-1:0] ST_ADDR_MISALIGNED = 6;
localparam logic [XLEN-1:0] ST_ACCESS_FAULT = 7; // Illegal access as governed by PMPs and PMAs

localparam logic [XLEN-1:0] ENV_CALL_UMODE = 8; // environment call from user mode or virtual user mode
localparam logic [XLEN-1:0] ENV_CALL_SMODE = 9; // environment call from hypervisor-extended supervisor mode
localparam logic [XLEN-1:0] ENV_CALL_VSMODE = 10; // environment call from virtual supervisor mode
localparam logic [XLEN-1:0] ENV_CALL_MMODE = 11; // environment call from machine mode
localparam logic [XLEN-1:0] INSTR_PAGE_FAULT = 12; // Instruction page fault
localparam logic [XLEN-1:0] LOAD_PAGE_FAULT = 13; // Load page fault
localparam logic [XLEN-1:0] STORE_PAGE_FAULT = 15; // Store page fault
localparam logic [XLEN-1:0] INSTR_GUEST_PAGE_FAULT= 20; // Instruction guest-page fault
localparam logic [XLEN-1:0] LOAD_GUEST_PAGE_FAULT = 21; // Load guest-page fault
localparam logic [XLEN-1:0] VIRTUAL_INSTRUCTION = 22; // virtual instruction
localparam logic [XLEN-1:0] STORE_GUEST_PAGE_FAULT= 23; // Store guest-page fault
localparam logic [XLEN-1:0] DEBUG_REQUEST = 24; // Debug request
Comment on lines +340 to +348
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[verible-verilog-format] reported by reviewdog 🐶

Suggested change
localparam logic [XLEN-1:0] ENV_CALL_MMODE = 11; // environment call from machine mode
localparam logic [XLEN-1:0] INSTR_PAGE_FAULT = 12; // Instruction page fault
localparam logic [XLEN-1:0] LOAD_PAGE_FAULT = 13; // Load page fault
localparam logic [XLEN-1:0] STORE_PAGE_FAULT = 15; // Store page fault
localparam logic [XLEN-1:0] INSTR_GUEST_PAGE_FAULT= 20; // Instruction guest-page fault
localparam logic [XLEN-1:0] LOAD_GUEST_PAGE_FAULT = 21; // Load guest-page fault
localparam logic [XLEN-1:0] VIRTUAL_INSTRUCTION = 22; // virtual instruction
localparam logic [XLEN-1:0] STORE_GUEST_PAGE_FAULT= 23; // Store guest-page fault
localparam logic [XLEN-1:0] DEBUG_REQUEST = 24; // Debug request
localparam logic [XLEN-1:0] ENV_CALL_MMODE = 11; // environment call from machine mode
localparam logic [XLEN-1:0] INSTR_PAGE_FAULT = 12; // Instruction page fault
localparam logic [XLEN-1:0] LOAD_PAGE_FAULT = 13; // Load page fault
localparam logic [XLEN-1:0] STORE_PAGE_FAULT = 15; // Store page fault
localparam logic [XLEN-1:0] INSTR_GUEST_PAGE_FAULT = 20; // Instruction guest-page fault
localparam logic [XLEN-1:0] LOAD_GUEST_PAGE_FAULT = 21; // Load guest-page fault
localparam logic [XLEN-1:0] VIRTUAL_INSTRUCTION = 22; // virtual instruction
localparam logic [XLEN-1:0] STORE_GUEST_PAGE_FAULT = 23; // Store guest-page fault
localparam logic [XLEN-1:0] DEBUG_REQUEST = 24; // Debug request


localparam int unsigned IRQ_S_SOFT = 1;
localparam int unsigned IRQ_M_SOFT = 3;
Expand All @@ -361,6 +368,14 @@ package riscv;
localparam logic [XLEN-1:0] S_EXT_INTERRUPT = (1 << (XLEN - 1)) | XLEN'(IRQ_S_EXT);
localparam logic [XLEN-1:0] M_EXT_INTERRUPT = (1 << (XLEN - 1)) | XLEN'(IRQ_M_EXT);

// ----------------------
// PseudoInstructions Codes
// ----------------------
localparam logic [XLEN-1:0] READ_32_PSEUDOINSTRUCTION = 32'h00002000;
localparam logic [XLEN-1:0] WRITE_32_PSEUDOINSTRUCTION = 32'h00002020;
localparam logic [XLEN-1:0] READ_64_PSEUDOINSTRUCTION = 64'h00003000;
localparam logic [XLEN-1:0] WRITE_64_PSEUDOINSTRUCTION = 64'h00003020;

// -----
// CSRs
// -----
Expand Down
98 changes: 50 additions & 48 deletions core/load_store_unit.sv
Original file line number Diff line number Diff line change
Expand Up @@ -140,63 +140,65 @@ module load_store_unit
// -------------------
// MMU e.g.: TLBs/PTW
// -------------------
if (MMU_PRESENT && (riscv::XLEN == 64)) begin : gen_mmu_sv39
mmu #(
.CVA6Cfg (CVA6Cfg),
.INSTR_TLB_ENTRIES(ariane_pkg::INSTR_TLB_ENTRIES),
.DATA_TLB_ENTRIES (ariane_pkg::DATA_TLB_ENTRIES),
.ASID_WIDTH (ASID_WIDTH)
) i_cva6_mmu (
// misaligned bypass
.misaligned_ex_i(misaligned_exception),
.lsu_is_store_i (st_translation_req),
.lsu_req_i (translation_req),
.lsu_vaddr_i (mmu_vaddr),
.lsu_valid_o (translation_valid),
.lsu_paddr_o (mmu_paddr),
.lsu_exception_o(mmu_exception),
.lsu_dtlb_hit_o (dtlb_hit), // send in the same cycle as the request
.lsu_dtlb_ppn_o (dtlb_ppn), // send in the same cycle as the request
// connecting PTW to D$ IF
.req_port_i (dcache_req_ports_i[0]),
.req_port_o (dcache_req_ports_o[0]),
// icache address translation requests
.icache_areq_i (icache_areq_i),
.asid_to_be_flushed_i,
.vaddr_to_be_flushed_i,
.icache_areq_o (icache_areq_o),
.pmpcfg_i,
.pmpaddr_i,
.*
);
end else if (MMU_PRESENT && (riscv::XLEN == 32)) begin : gen_mmu_sv32
cva6_mmu_sv32 #(
if (MMU_PRESENT) begin : gen_mmu

localparam HYP_EXT = 0; //CVA6Cfg.CVA6ConfigHExtEn
localparam VPN_LEN = (riscv::XLEN == 64) ? (HYP_EXT ? 29 : 27) : 20;
localparam PT_LEVELS = (riscv::XLEN == 64) ? 3 : 2;
localparam int unsigned mmu_ASID_WIDTH[HYP_EXT:0] = {ASID_WIDTH};


cva6_mmu #(
.CVA6Cfg (CVA6Cfg),
.INSTR_TLB_ENTRIES(ariane_pkg::INSTR_TLB_ENTRIES),
.DATA_TLB_ENTRIES (ariane_pkg::DATA_TLB_ENTRIES),
.ASID_WIDTH (ASID_WIDTH)
.HYP_EXT (HYP_EXT),
.ASID_WIDTH (mmu_ASID_WIDTH),
.VPN_LEN (VPN_LEN),
.PT_LEVELS (PT_LEVELS)
) i_cva6_mmu (
.clk_i (clk_i),
.rst_ni (rst_ni),
.flush_i (flush_i),
.enable_translation_i ({enable_translation_i}),
.en_ld_st_translation_i({en_ld_st_translation_i}),
.icache_areq_i (icache_areq_i),
.icache_areq_o (icache_areq_o),
// misaligned bypass
.misaligned_ex_i(misaligned_exception),
.lsu_is_store_i (st_translation_req),
.lsu_req_i (translation_req),
.lsu_vaddr_i (mmu_vaddr),
.misaligned_ex_i (misaligned_exception),
.lsu_req_i (translation_req),
.lsu_vaddr_i (mmu_vaddr),
.lsu_tinst_i (0),
.lsu_is_store_i (st_translation_req),
.csr_hs_ld_st_inst_o (),
.lsu_dtlb_hit_o (dtlb_hit), // send in the same cycle as the request
.lsu_dtlb_ppn_o (dtlb_ppn), // send in the same cycle as the request

.lsu_valid_o (translation_valid),
.lsu_paddr_o (mmu_paddr),
.lsu_exception_o(mmu_exception),
.lsu_dtlb_hit_o (dtlb_hit), // send in the same cycle as the request
.lsu_dtlb_ppn_o (dtlb_ppn), // send in the same cycle as the request
// connecting PTW to D$ IF
.req_port_i (dcache_req_ports_i[0]),
.req_port_o (dcache_req_ports_o[0]),
// icache address translation requests
.icache_areq_i (icache_areq_i),
.asid_to_be_flushed_i,
.vaddr_to_be_flushed_i,
.icache_areq_o (icache_areq_o),

.priv_lvl_i (priv_lvl_i),
.ld_st_priv_lvl_i(ld_st_priv_lvl_i),

.sum_i ({sum_i}),
.mxr_i ({mxr_i}),
.hlvx_inst_i (0),
.hs_ld_st_inst_i(0),

.satp_ppn_i ({satp_ppn_i}),
.asid_i ({asid_i}),
.asid_to_be_flushed_i ({asid_to_be_flushed_i}),
.vaddr_to_be_flushed_i({vaddr_to_be_flushed_i}),
.flush_tlb_i ({flush_tlb_i}),

.itlb_miss_o(itlb_miss_o),
.dtlb_miss_o(dtlb_miss_o),

.req_port_i(dcache_req_ports_i[0]),
.req_port_o(dcache_req_ports_o[0]),
.pmpcfg_i,
.pmpaddr_i,
.*
.pmpaddr_i
);
end else begin : gen_no_mmu

Expand Down
1 change: 1 addition & 0 deletions core/mmu_unify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unification of MMUs: sv32, sv39 and sv39x4
Loading
Loading