diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-12-10 19:36:38 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-12-10 19:36:38 -0600 |
| commit | 8026947ecdf9b023c3720b26bf257bf46f7a2805 (patch) | |
| tree | 8b2fbd0beb29c575730a76b010e8aa35977d5417 /rtl/core/cp15/syscfg.sv | |
| parent | 02f76bae32e295bf1da04e38dfa12dfbc5832aec (diff) | |
Implement rest of cp15 registers
Diffstat (limited to 'rtl/core/cp15/syscfg.sv')
| -rw-r--r-- | rtl/core/cp15/syscfg.sv | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/rtl/core/cp15/syscfg.sv b/rtl/core/cp15/syscfg.sv new file mode 100644 index 0000000..599b682 --- /dev/null +++ b/rtl/core/cp15/syscfg.sv @@ -0,0 +1,66 @@ +`include "core/uarch.sv" +`include "core/cp15/map.sv" + +module core_cp15_syscfg +( + input logic clk, + rst_n, + + input logic load, + transfer, + input cp_opcode op2, + input word write, + + output word read +); + + logic mmu_enable, dcache_enable, icache_enable, high_vectors; + + cp15_syscfg_ctrl ctrl, write_ctrl; + + assign write_ctrl = write; + + always_comb begin + ctrl = {$bits(ctrl){1'b0}}; + ctrl.m = mmu_enable; + ctrl.c = dcache_enable; + ctrl.l = 1; + ctrl.d = 1; + ctrl.p = 1; + ctrl.z = 1; + ctrl.i = icache_enable; + ctrl.v = high_vectors; + ctrl.dt = 1; + ctrl.it = 1; + + unique case(op2) + `CP15_SYSCFG_CTRL: + read = ctrl; + + `CP15_SYSCFG_ACCESS: + read = 0; + + default: + read = 0; + endcase + end + + always @(posedge clk or negedge rst_n) + if(!rst_n) begin + mmu_enable <= 0; + high_vectors <= 0; + dcache_enable <= 0; + icache_enable <= 0; + end else if(transfer && !load) + unique case(op2) + `CP15_SYSCFG_CTRL: begin + mmu_enable <= write_ctrl.m; + high_vectors <= write_ctrl.v; + dcache_enable <= write_ctrl.c; + icache_enable <= write_ctrl.i; + end + + default: ; + endcase + +endmodule |
