Make mcycle/minstret inhibited by default
This commit is contained in:
parent
2bbc3637a2
commit
8a003dbbed
908
doc/hazard3.pdf
908
doc/hazard3.pdf
File diff suppressed because it is too large
Load Diff
|
@ -310,8 +310,8 @@ Counter inhibit. Read-write. The table below lists the fields which are _not_ ha
|
||||||
[cols="10h,20h,~", options="header"]
|
[cols="10h,20h,~", options="header"]
|
||||||
|===
|
|===
|
||||||
| Bits | Name | Description
|
| Bits | Name | Description
|
||||||
| 2 | `ir` | When 1, inhibit counting of `minstret`/`minstreth`
|
| 2 | `ir` | When 1, inhibit counting of `minstret`/`minstreth`. Resets to 1.
|
||||||
| 0 | `cy` | When 1, inhibit counting of `mcycle`/`mcycleh`
|
| 0 | `cy` | When 1, inhibit counting of `mcycle`/`mcycleh`. Resets to 1.
|
||||||
|===
|
|===
|
||||||
|
|
||||||
==== mhpmevent3...31
|
==== mhpmevent3...31
|
||||||
|
|
|
@ -440,8 +440,8 @@ always @ (posedge clk or negedge rst_n) begin
|
||||||
minstreth <= X0;
|
minstreth <= X0;
|
||||||
minstret <= X0;
|
minstret <= X0;
|
||||||
// Counters inhibited by default to save energy
|
// Counters inhibited by default to save energy
|
||||||
mcountinhibit_cy <= 1'b0;
|
mcountinhibit_cy <= 1'b1;
|
||||||
mcountinhibit_ir <= 1'b0;
|
mcountinhibit_ir <= 1'b1;
|
||||||
end else if (CSR_COUNTER) begin
|
end else if (CSR_COUNTER) begin
|
||||||
// Optionally hold the top (2 * XLEN - W_COUNTER) bits constant to
|
// Optionally hold the top (2 * XLEN - W_COUNTER) bits constant to
|
||||||
// save gates (noncompliant if enabled)
|
// save gates (noncompliant if enabled)
|
||||||
|
|
|
@ -54,11 +54,20 @@ j \name
|
||||||
|
|
||||||
|
|
||||||
.reset_handler:
|
.reset_handler:
|
||||||
la sp, __stack_top
|
// Set counters running, as they are off by default. This may trap if counters
|
||||||
// mtvec LSB enables vectoring
|
// are unimplemented, so catch the trap and continue.
|
||||||
|
la a0, 1f
|
||||||
|
csrw mtvec, a0
|
||||||
|
csrci mcountinhibit, 0x5
|
||||||
|
.p2align 2
|
||||||
|
1:
|
||||||
|
// Set up trap vector table. mtvec LSB enables vectoring
|
||||||
la t0, .vector_table + 1
|
la t0, .vector_table + 1
|
||||||
csrw mtvec, t0
|
csrw mtvec, t0
|
||||||
|
|
||||||
|
// Set up stack pointer before doing anything else
|
||||||
|
la sp, __stack_top
|
||||||
|
|
||||||
// newlib _start expects argc, argv on the stack. Leave stack 16-byte aligned.
|
// newlib _start expects argc, argv on the stack. Leave stack 16-byte aligned.
|
||||||
addi sp, sp, -16
|
addi sp, sp, -16
|
||||||
li a0, 1
|
li a0, 1
|
||||||
|
|
Loading…
Reference in New Issue