diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-12-13 14:59:33 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-12-16 16:29:10 -0600 |
| commit | 1f94f0eb7e214bff29468bf9c39cb99520e290f2 (patch) | |
| tree | f2d3177fcee7d0113682301db15455341957acdf /rtl/core/cp15/cyclecnt.sv | |
| parent | 02712d69cdd859d702cc7577e72db27d6f0c9ad5 (diff) | |
Add cp15 cyclecnt clock source
Diffstat (limited to 'rtl/core/cp15/cyclecnt.sv')
| -rw-r--r-- | rtl/core/cp15/cyclecnt.sv | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rtl/core/cp15/cyclecnt.sv b/rtl/core/cp15/cyclecnt.sv new file mode 100644 index 0000000..b079a1b --- /dev/null +++ b/rtl/core/cp15/cyclecnt.sv @@ -0,0 +1,23 @@ +`include "core/uarch.sv" + +module core_cp15_cyclecnt +( + input logic clk, + rst_n, + + input logic halt, + + output word read +); + + word cyclecnt; + + assign read = cyclecnt; + + always @(posedge clk or negedge rst_n) + if(!rst_n) + cyclecnt <= 0; + else if(!halt) + cyclecnt <= cyclecnt + 1; + +endmodule |
