Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fallen/milkymist-mmu
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2b79691a1126
Choose a base ref
...
head repository: fallen/milkymist-mmu
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: de964d411ce8
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 12, 2012

  1. Copy the full SHA
    836f789 View commit details
  2. Copy the full SHA
    de964d4 View commit details
Showing with 20 additions and 6 deletions.
  1. +16 −4 cores/lm32/rtl/lm32_cpu.v
  2. +4 −2 software/bios/dtlb_exception_handling_tests.c
20 changes: 16 additions & 4 deletions cores/lm32/rtl/lm32_cpu.v
Original file line number Diff line number Diff line change
@@ -2216,33 +2216,45 @@ begin
`ifdef CFG_DEBUG_ENABLED
if (non_debug_exception_q_w == `TRUE)
begin
// Save and then clear ITLB enable
// Save and then clear ITLB and DTLB enable
lm32_csr_psw_reg[`LM32_CSR_PSW_EITLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_EDTLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE] <= `FALSE;
lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE] <= `FALSE;
end
else if (debug_exception_q_w == `TRUE)
begin
// Save and then clear TLB enable
lm32_csr_psw_reg[`LM32_CSR_PSW_BITLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE] <= `FALSE;
lm32_csr_psw_reg[`LM32_CSR_PSW_BDTLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE] <= `FALSE;
end
`else
if (exception_q_w == `TRUE)
begin
// Save and then clear ITLB enable
// Save and then clear ITLB and DTLB enable
lm32_csr_psw_reg[`LM32_CSR_PSW_EITLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE] <= `FALSE;
lm32_csr_psw_reg[`LM32_CSR_PSW_EDTLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE] <= `FALSE;
end
`endif
else if (stall_x == `FALSE)
begin
if (eret_q_x == `TRUE)
// Restore ITLB enable
begin
// Restore ITLB and DTLB enable
lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_EITLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_EDTLBE];
end
`ifdef CFG_DEBUG_ENABLED
else if (bret_q_x == `TRUE)
// Restore ITLB enable
begin
// Restore ITLB and DTLB enable
lm32_csr_psw_reg[`LM32_CSR_PSW_ITLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_BITLBE];
lm32_csr_psw_reg[`LM32_CSR_PSW_DTLBE] <= lm32_csr_psw_reg[`LM32_CSR_PSW_BDTLBE];
end
`endif
else if (csr_write_enable_q_x == `TRUE)
begin
6 changes: 4 additions & 2 deletions software/bios/dtlb_exception_handling_tests.c
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ void dtlb_exception_handling_tests() {
printf("\n<= Reading %d from virtual address 0x%08X\n\n", data, addr);

printf("=> Invalidating the mapping of virtual address 0x%08X in the TLB\n", addr);
mmu_dtlb_invalidate_line(addr);
mmu_dtlb_invalidate_line(get_pfn(addr));

data = 43;
printf("=> Writing %d to physical address 0x%08X\n", data, addr);
@@ -67,7 +67,7 @@ void dtlb_exception_handling_tests() {
check_for_error(ret);

printf("=> Invalidating the mapping of virtual address 0x%08X in the TLB\n", addr);
mmu_dtlb_invalidate_line(addr); // AND invalidate the mapping
mmu_dtlb_invalidate_line(get_pfn(addr)); // AND invalidate the mapping

data = 44;
printf("=> Writting %d to physical address 0x%08X\n", data, addr+0x1000);
@@ -77,5 +77,7 @@ void dtlb_exception_handling_tests() {
printf("=> Activating the MMU and reading form virtual address 0x%08X\n", addr);
data = read_word_with_mmu_enabled(addr);
printf("\n<= Reading %d from virtual address 0x%08X\n\n", data, addr);
data = *(unsigned int *)addr;
printf("\n<= Reading %d from physical address 0x%08X\n\n", data, addr);

}