@@ -57,7 +57,14 @@ reset:
5757
5858 op add RAM_END {{RAM_START}} RAM_SIZE
5959
60+ # don't trigger ipt_overrun after resetting
61+ set current_tick @tick
62+
6063next_tick:
64+ # check this here to speed up the hot path a bit, at the cost of making debugging somewhat more difficult
65+ jump ipt_overrun notEqual current_tick @tick
66+
67+ next_tick_no_check_overrun:
6168 wait 1e-5
6269
6370 # poll hardware
@@ -227,7 +234,7 @@ end_instruction_with_rd:
227234 # continue into end_instruction
228235
229236# all instructions jump here after completing successfully
230- # cost: 9 (included in base cost)
237+ # cost: 8 (included in base cost)
231238end_instruction:
232239 # increment instret
233240 op add csr_minstret csr_minstret 1
@@ -239,9 +246,6 @@ end_instruction:
239246 op sub accumulator accumulator 3
240247
241248end_instruction_trap:
242- # check this first to aid in debugging
243- jump ipt_overrun notEqual current_tick @tick
244-
245249 # next_pc is set to pc + 4 at the start of main
246250 # if we're in the icache, icache_var was already incremented
247251 # if next_pc was modified, icache_var should have also been set to null
@@ -270,7 +274,8 @@ ipt_overrun:
270274
271275 printflush {{ERROR_OUTPUT}}
272276 write @this {{CONTROLLER}} "prev_proc"
273- jump state->halt always
277+ set state "halt"
278+ jump next_tick_no_check_overrun always
274279
275280default_mtvec_handler:
276281 print "Control transferred to {{SYSCON}} (default mtvec), halting."
@@ -2165,7 +2170,7 @@ parallel_decode__loop:
21652170
21662171 # bail out if the decode operation was cancelled
21672172 read state {{CONTROLLER}} "state"
2168- jump next_tick notEqual state "decoding"
2173+ jump next_tick_no_check_overrun notEqual state "decoding"
21692174
21702175 op add decode_address decode_address 4
21712176 jump parallel_decode__loop lessThan decode_address end_decode_address
@@ -2183,7 +2188,7 @@ parallel_decode__wait:
21832188 jump parallel_decode__wait equal state "decoding"
21842189
21852190 # if we're not the worker that initially encountered the decode instruction, go to the next tick
2186- jump next_tick notEqual is_first_decoding_worker true
2191+ jump next_tick_no_check_overrun notEqual is_first_decoding_worker true
21872192
21882193 # otherwise, finish this instruction and then go to the next tick
21892194 set is_first_decoding_worker null
0 commit comments