summaryrefslogtreecommitdiff
path: root/rtl/core/cp15/cyclecnt.sv
blob: b079a1b76464a975f5a3bf18dc6afd8ccdedd5e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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