diff options
Diffstat (limited to '')
| -rw-r--r-- | hdl/mem_cache.sv | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/hdl/mem_cache.sv b/hdl/mem_cache.sv index 5f3db73..2257a4f 100644 --- a/hdl/mem_cache.sv +++ b/hdl/mem_cache.sv | |||
| @@ -6,6 +6,8 @@ module mem_cache | |||
| 6 | ( input bit clock | 6 | ( input bit clock |
| 7 | , input bit reset | 7 | , input bit reset |
| 8 | 8 | ||
| 9 | , input bit clear | ||
| 10 | |||
| 9 | , output bit core_command_ready | 11 | , output bit core_command_ready |
| 10 | , input bit core_command_valid | 12 | , input bit core_command_valid |
| 11 | , input pdp_command_t core_command_data | 13 | , input pdp_command_t core_command_data |
| @@ -52,16 +54,19 @@ module mem_cache | |||
| 52 | core_response_valid = 0; | 54 | core_response_valid = 0; |
| 53 | outstanding_fill = 0; | 55 | outstanding_fill = 0; |
| 54 | reset_entry = 0; | 56 | reset_entry = 0; |
| 55 | end else if (reset_entry < (1<<SET_BITS)) begin | ||
| 56 | cache[reset_entry] = 0; | ||
| 57 | ++reset_entry; | ||
| 58 | end else begin | 57 | end else begin |
| 58 | if (clear) | ||
| 59 | reset_entry = 0; | ||
| 60 | |||
| 59 | if (ram_command_ready && ram_command_valid) | 61 | if (ram_command_ready && ram_command_valid) |
| 60 | ram_command_valid = 0; | 62 | ram_command_valid = 0; |
| 61 | if (core_response_ready && core_response_valid) | 63 | if (core_response_ready && core_response_valid) |
| 62 | core_response_valid = 0; | 64 | core_response_valid = 0; |
| 63 | 65 | ||
| 64 | if (ram_response_ready && ram_response_valid) begin | 66 | if (!outstanding_fill && !reset_entry[SET_BITS]) begin |
| 67 | cache[reset_entry[SET_BITS-1:0]] = 0; | ||
| 68 | ++reset_entry; | ||
| 69 | end else if (ram_response_ready && ram_response_valid && outstanding_fill) begin | ||
| 65 | automatic address_tag_t tag; | 70 | automatic address_tag_t tag; |
| 66 | automatic set_t set; | 71 | automatic set_t set; |
| 67 | automatic cache_entry_t entry; | 72 | automatic cache_entry_t entry; |
| @@ -100,7 +105,7 @@ module mem_cache | |||
| 100 | end | 105 | end |
| 101 | end | 106 | end |
| 102 | 107 | ||
| 103 | core_command_ready = !ram_command_valid && !core_response_valid && !outstanding_fill; | 108 | core_command_ready = reset_entry[SET_BITS] && !ram_command_valid && !core_response_valid && !outstanding_fill; |
| 104 | ram_response_ready = !core_response_valid; | 109 | ram_response_ready = !core_response_valid; |
| 105 | end | 110 | end |
| 106 | end | 111 | end |
