File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ reset__zero_registers:
108108 set pc 0
109109
110110 # reset instret
111+ set instret 0
111112 write 0 CSRS CSR_INSTRET
112113 write 0 CSRS CSR_INSTRETH
113114
@@ -397,29 +398,26 @@ decode_type_I:
397398# all instructions jump here after completing successfully
398399end_instruction:
399400 # increment instret
400- read low CSRS CSR_INSTRET
401- op add low low 1
402- jump end_instruction__no_overflow lessThan low 0x100000000
401+ op add instret instret 1
402+ jump end_instruction__no_overflow lessThan instret 0x100000000
403403
404- op shr overflow low 32
405- op mod low low 0x100000000 # trunc 32
404+ set instret 0
406405
407406 read high CSRS CSR_INSTRETH
408- op add high high overflow
407+ op add high high 1
409408 write high CSRS CSR_INSTRETH
410409
411410end_instruction__no_overflow:
412- write low CSRS CSR_INSTRET
411+ write instret CSRS CSR_INSTRET
413412
414413end_instruction_preserve_instret:
415414 op add pc pc 4
416- op mod pc pc 0x100000000 # trunc 32
417415
418416end_instruction_preserve_pc:
419417 # halt if the reset switch was manually enabled
420418 sensor enabled RESET_SWITCH @enabled
421- jump halt equal enabled true
422- jump main always
419+ jump main notEqual enabled true
420+ jump halt always
423421
424422# exceptions
425423
You can’t perform that action at this time.
0 commit comments